Skip to content

Commit 3e71ed1

Browse files
authored
Merge pull request rust-lang#4034 from rust-lang/rustup-2024-11-15
Automatic Rustup
2 parents 7213a27 + b911657 commit 3e71ed1

File tree

693 files changed

+16208
-7437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

693 files changed

+16208
-7437
lines changed

Cargo.lock

Lines changed: 258 additions & 255 deletions
Large diffs are not rendered by default.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
resolver = "2"
33
members = [
44
"compiler/rustc",
5+
"src/build_helper",
56
"src/etc/test-float-parse",
67
"src/rustc-std-workspace/rustc-std-workspace-core",
78
"src/rustc-std-workspace/rustc-std-workspace-alloc",
89
"src/rustc-std-workspace/rustc-std-workspace-std",
910
"src/rustdoc-json-types",
10-
"src/tools/build_helper",
1111
"src/tools/cargotest",
1212
"src/tools/clippy",
1313
"src/tools/clippy/clippy_dev",

compiler/rustc/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ jemalloc = ['dep:jemalloc-sys']
3131
llvm = ['rustc_driver_impl/llvm']
3232
max_level_info = ['rustc_driver_impl/max_level_info']
3333
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
34-
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']
3534
# tidy-alphabetical-end

compiler/rustc_ast/src/ast.rs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ impl Expr {
11941194
///
11951195
/// Does not ensure that the path resolves to a const param, the caller should check this.
11961196
pub fn is_potential_trivial_const_arg(&self, strip_identity_block: bool) -> bool {
1197-
let this = if strip_identity_block { self.maybe_unwrap_block().1 } else { self };
1197+
let this = if strip_identity_block { self.maybe_unwrap_block() } else { self };
11981198

11991199
if let ExprKind::Path(None, path) = &this.kind
12001200
&& path.is_potential_trivial_const_arg()
@@ -1206,14 +1206,41 @@ impl Expr {
12061206
}
12071207

12081208
/// Returns an expression with (when possible) *one* outter brace removed
1209-
pub fn maybe_unwrap_block(&self) -> (bool, &Expr) {
1209+
pub fn maybe_unwrap_block(&self) -> &Expr {
12101210
if let ExprKind::Block(block, None) = &self.kind
12111211
&& let [stmt] = block.stmts.as_slice()
12121212
&& let StmtKind::Expr(expr) = &stmt.kind
12131213
{
1214-
(true, expr)
1214+
expr
12151215
} else {
1216-
(false, self)
1216+
self
1217+
}
1218+
}
1219+
1220+
/// Determines whether this expression is a macro call optionally wrapped in braces . If
1221+
/// `already_stripped_block` is set then we do not attempt to peel off a layer of braces.
1222+
///
1223+
/// Returns the [`NodeId`] of the macro call and whether a layer of braces has been peeled
1224+
/// either before, or part of, this function.
1225+
pub fn optionally_braced_mac_call(
1226+
&self,
1227+
already_stripped_block: bool,
1228+
) -> Option<(bool, NodeId)> {
1229+
match &self.kind {
1230+
ExprKind::Block(block, None)
1231+
if let [stmt] = &*block.stmts
1232+
&& !already_stripped_block =>
1233+
{
1234+
match &stmt.kind {
1235+
StmtKind::MacCall(_) => Some((true, stmt.id)),
1236+
StmtKind::Expr(expr) if let ExprKind::MacCall(_) = &expr.kind => {
1237+
Some((true, expr.id))
1238+
}
1239+
_ => None,
1240+
}
1241+
}
1242+
ExprKind::MacCall(_) => Some((already_stripped_block, self.id)),
1243+
_ => None,
12171244
}
12181245
}
12191246

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub enum TokenTree {
3838
}
3939

4040
// Ensure all fields of `TokenTree` are `DynSend` and `DynSync`.
41-
#[cfg(parallel_compiler)]
4241
fn _dummy()
4342
where
4443
Token: sync::DynSend + sync::DynSync,

compiler/rustc_ast/src/visit.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ pub trait Visitor<'ast>: Sized {
200200
fn visit_param_bound(&mut self, bounds: &'ast GenericBound, _ctxt: BoundKind) -> Self::Result {
201201
walk_param_bound(self, bounds)
202202
}
203-
fn visit_precise_capturing_arg(&mut self, arg: &'ast PreciseCapturingArg) {
204-
walk_precise_capturing_arg(self, arg);
203+
fn visit_precise_capturing_arg(&mut self, arg: &'ast PreciseCapturingArg) -> Self::Result {
204+
walk_precise_capturing_arg(self, arg)
205205
}
206206
fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef) -> Self::Result {
207207
walk_poly_trait_ref(self, t)
@@ -730,14 +730,10 @@ pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a GenericB
730730
pub fn walk_precise_capturing_arg<'a, V: Visitor<'a>>(
731731
visitor: &mut V,
732732
arg: &'a PreciseCapturingArg,
733-
) {
733+
) -> V::Result {
734734
match arg {
735-
PreciseCapturingArg::Lifetime(lt) => {
736-
visitor.visit_lifetime(lt, LifetimeCtxt::GenericArg);
737-
}
738-
PreciseCapturingArg::Arg(path, id) => {
739-
visitor.visit_path(path, *id);
740-
}
735+
PreciseCapturingArg::Lifetime(lt) => visitor.visit_lifetime(lt, LifetimeCtxt::GenericArg),
736+
PreciseCapturingArg::Arg(path, id) => visitor.visit_path(path, *id),
741737
}
742738
}
743739

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
4545
| asm::InlineAsmArch::X86_64
4646
| asm::InlineAsmArch::Arm
4747
| asm::InlineAsmArch::AArch64
48+
| asm::InlineAsmArch::Arm64EC
4849
| asm::InlineAsmArch::RiscV32
4950
| asm::InlineAsmArch::RiscV64
5051
| asm::InlineAsmArch::LoongArch64

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
204204
"meant for internal use only" {
205205
keyword => rustdoc_internals
206206
fake_variadic => rustdoc_internals
207+
search_unbox => rustdoc_internals
207208
}
208209
);
209210
}
@@ -522,9 +523,18 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
522523
"consider removing `for<...>`"
523524
);
524525
gate_all!(more_qualified_paths, "usage of qualified paths in this context is experimental");
525-
for &span in spans.get(&sym::yield_expr).iter().copied().flatten() {
526-
if !span.at_least_rust_2024() {
527-
gate!(&visitor, coroutines, span, "yield syntax is experimental");
526+
// yield can be enabled either by `coroutines` or `gen_blocks`
527+
if let Some(spans) = spans.get(&sym::yield_expr) {
528+
for span in spans {
529+
if (!visitor.features.coroutines() && !span.allows_unstable(sym::coroutines))
530+
&& (!visitor.features.gen_blocks() && !span.allows_unstable(sym::gen_blocks))
531+
{
532+
#[allow(rustc::untranslatable_diagnostic)]
533+
// Don't know which of the two features to include in the
534+
// error message, so I am arbitrarily picking one.
535+
feature_err(&visitor.sess, sym::coroutines, *span, "yield syntax is experimental")
536+
.emit();
537+
}
528538
}
529539
}
530540
gate_all!(gen_blocks, "gen blocks are experimental");

compiler/rustc_attr/src/builtin.rs

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ use rustc_session::lint::BuiltinLintDiag;
1616
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
1717
use rustc_session::parse::feature_err;
1818
use rustc_session::{RustcVersion, Session};
19+
use rustc_span::Span;
1920
use rustc_span::hygiene::Transparency;
2021
use rustc_span::symbol::{Symbol, kw, sym};
21-
use rustc_span::{DUMMY_SP, Span};
2222

2323
use crate::fluent_generated;
2424
use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};
@@ -92,9 +92,7 @@ impl Stability {
9292
#[derive(HashStable_Generic)]
9393
pub struct ConstStability {
9494
pub level: StabilityLevel,
95-
/// This can be `None` for functions that do not have an explicit const feature.
96-
/// We still track them for recursive const stability checks.
97-
pub feature: Option<Symbol>,
95+
pub feature: Symbol,
9896
/// This is true iff the `const_stable_indirect` attribute is present.
9997
pub const_stable_indirect: bool,
10098
/// whether the function has a `#[rustc_promotable]` attribute
@@ -272,22 +270,19 @@ pub fn find_stability(
272270

273271
/// Collects stability info from `rustc_const_stable`/`rustc_const_unstable`/`rustc_promotable`
274272
/// attributes in `attrs`. Returns `None` if no stability attributes are found.
275-
///
276-
/// `is_const_fn` indicates whether this is a function marked as `const`.
277273
pub fn find_const_stability(
278274
sess: &Session,
279275
attrs: &[Attribute],
280276
item_sp: Span,
281-
is_const_fn: bool,
282277
) -> Option<(ConstStability, Span)> {
283278
let mut const_stab: Option<(ConstStability, Span)> = None;
284279
let mut promotable = false;
285-
let mut const_stable_indirect = None;
280+
let mut const_stable_indirect = false;
286281

287282
for attr in attrs {
288283
match attr.name_or_empty() {
289284
sym::rustc_promotable => promotable = true,
290-
sym::rustc_const_stable_indirect => const_stable_indirect = Some(attr.span),
285+
sym::rustc_const_stable_indirect => const_stable_indirect = true,
291286
sym::rustc_const_unstable => {
292287
if const_stab.is_some() {
293288
sess.dcx()
@@ -299,7 +294,7 @@ pub fn find_const_stability(
299294
const_stab = Some((
300295
ConstStability {
301296
level,
302-
feature: Some(feature),
297+
feature,
303298
const_stable_indirect: false,
304299
promotable: false,
305300
},
@@ -317,7 +312,7 @@ pub fn find_const_stability(
317312
const_stab = Some((
318313
ConstStability {
319314
level,
320-
feature: Some(feature),
315+
feature,
321316
const_stable_indirect: false,
322317
promotable: false,
323318
},
@@ -340,7 +335,7 @@ pub fn find_const_stability(
340335
}
341336
}
342337
}
343-
if const_stable_indirect.is_some() {
338+
if const_stable_indirect {
344339
match &mut const_stab {
345340
Some((stab, _)) => {
346341
if stab.is_const_unstable() {
@@ -351,36 +346,37 @@ pub fn find_const_stability(
351346
})
352347
}
353348
}
354-
_ => {}
349+
_ => {
350+
// This function has no const stability attribute, but has `const_stable_indirect`.
351+
// We ignore that; unmarked functions are subject to recursive const stability
352+
// checks by default so we do carry out the user's intent.
353+
}
355354
}
356355
}
357-
// Make sure if `const_stable_indirect` is present, that is recorded. Also make sure all `const
358-
// fn` get *some* marker, since we are a staged_api crate and therefore will do recursive const
359-
// stability checks for them. We need to do this because the default for whether an unmarked
360-
// function enforces recursive stability differs between staged-api crates and force-unmarked
361-
// crates: in force-unmarked crates, only functions *explicitly* marked `const_stable_indirect`
362-
// enforce recursive stability. Therefore when `lookup_const_stability` is `None`, we have to
363-
// assume the function does not have recursive stability. All functions that *do* have recursive
364-
// stability must explicitly record this, and so that's what we do for all `const fn` in a
365-
// staged_api crate.
366-
if (is_const_fn || const_stable_indirect.is_some()) && const_stab.is_none() {
367-
let c = ConstStability {
368-
feature: None,
369-
const_stable_indirect: const_stable_indirect.is_some(),
370-
promotable: false,
371-
level: StabilityLevel::Unstable {
372-
reason: UnstableReason::Default,
373-
issue: None,
374-
is_soft: false,
375-
implied_by: None,
376-
},
377-
};
378-
const_stab = Some((c, const_stable_indirect.unwrap_or(DUMMY_SP)));
379-
}
380356

381357
const_stab
382358
}
383359

360+
/// Calculates the const stability for a const function in a `-Zforce-unstable-if-unmarked` crate
361+
/// without the `staged_api` feature.
362+
pub fn unmarked_crate_const_stab(
363+
_sess: &Session,
364+
attrs: &[Attribute],
365+
regular_stab: Stability,
366+
) -> ConstStability {
367+
assert!(regular_stab.level.is_unstable());
368+
// The only attribute that matters here is `rustc_const_stable_indirect`.
369+
// We enforce recursive const stability rules for those functions.
370+
let const_stable_indirect =
371+
attrs.iter().any(|a| a.name_or_empty() == sym::rustc_const_stable_indirect);
372+
ConstStability {
373+
feature: regular_stab.feature,
374+
const_stable_indirect,
375+
promotable: false,
376+
level: regular_stab.level,
377+
}
378+
}
379+
384380
/// Collects stability info from `rustc_default_body_unstable` attributes in `attrs`.
385381
/// Returns `None` if no stability attributes are found.
386382
pub fn find_body_stability(

compiler/rustc_baked_icu_data/Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ edition = "2021"
88
icu_list = "1.2"
99
icu_locid = "1.2"
1010
icu_locid_transform = "1.3.2"
11-
icu_provider = "1.2"
11+
icu_provider = { version = "1.2", features = ["sync"] }
1212
zerovec = "0.10.0"
1313
# tidy-alphabetical-end
14-
15-
[features]
16-
# tidy-alphabetical-start
17-
rustc_use_parallel_compiler = ['icu_provider/sync']
18-
# tidy-alphabetical-end

0 commit comments

Comments
 (0)