Skip to content

Commit 7095a86

Browse files
authored
Merge pull request #4604 from rust-lang/rustup-2025-09-26
Automatic Rustup
2 parents 0c73cb8 + 4aacd30 commit 7095a86

File tree

336 files changed

+4473
-1650
lines changed

Some content is hidden

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

336 files changed

+4473
-1650
lines changed

Cargo.lock

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ dependencies = [
128128

129129
[[package]]
130130
name = "anstyle-svg"
131-
version = "0.1.10"
131+
version = "0.1.11"
132132
source = "registry+https://github.com/rust-lang/crates.io-index"
133-
checksum = "dc03a770ef506fe1396c0e476120ac0e6523cf14b74218dd5f18cd6833326fa9"
133+
checksum = "26b9ec8c976eada1b0f9747a3d7cc4eae3bef10613e443746e7487f26c872fde"
134134
dependencies = [
135135
"anstyle",
136136
"anstyle-lossy",
@@ -1332,6 +1332,12 @@ dependencies = [
13321332
"windows-sys 0.59.0",
13331333
]
13341334

1335+
[[package]]
1336+
name = "find-msvc-tools"
1337+
version = "0.1.2"
1338+
source = "registry+https://github.com/rust-lang/crates.io-index"
1339+
checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959"
1340+
13351341
[[package]]
13361342
name = "flate2"
13371343
version = "1.1.2"
@@ -3556,7 +3562,7 @@ dependencies = [
35563562
"ar_archive_writer",
35573563
"bitflags",
35583564
"bstr",
3559-
"cc",
3565+
"find-msvc-tools",
35603566
"itertools",
35613567
"libc",
35623568
"object 0.37.3",
@@ -4760,7 +4766,7 @@ dependencies = [
47604766
name = "rustc_windows_rc"
47614767
version = "0.0.0"
47624768
dependencies = [
4763-
"cc",
4769+
"find-msvc-tools",
47644770
]
47654771

47664772
[[package]]

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,4 @@
1-
use std::num::IntErrorKind;
2-
3-
use rustc_hir::limit::Limit;
4-
51
use super::prelude::*;
6-
use crate::session_diagnostics::LimitInvalid;
7-
8-
impl<S: Stage> AcceptContext<'_, '_, S> {
9-
fn parse_limit_int(&self, nv: &NameValueParser) -> Option<Limit> {
10-
let Some(limit) = nv.value_as_str() else {
11-
self.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
12-
return None;
13-
};
14-
15-
let error_str = match limit.as_str().parse() {
16-
Ok(i) => return Some(Limit::new(i)),
17-
Err(e) => match e.kind() {
18-
IntErrorKind::PosOverflow => "`limit` is too large",
19-
IntErrorKind::Empty => "`limit` must be a non-negative integer",
20-
IntErrorKind::InvalidDigit => "not a valid integer",
21-
IntErrorKind::NegOverflow => {
22-
panic!(
23-
"`limit` should never negatively overflow since we're parsing into a usize and we'd get Empty instead"
24-
)
25-
}
26-
IntErrorKind::Zero => {
27-
panic!("zero is a valid `limit` so should have returned Ok() when parsing")
28-
}
29-
kind => panic!("unimplemented IntErrorKind variant: {:?}", kind),
30-
},
31-
};
32-
33-
self.emit_err(LimitInvalid { span: self.attr_span, value_span: nv.value_span, error_str });
34-
35-
None
36-
}
37-
}
382

393
pub(crate) struct CrateNameParser;
404

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,21 @@ impl<S: Stage> SingleAttributeParser<S> for RustcObjectLifetimeDefaultParser {
4949
Some(AttributeKind::RustcObjectLifetimeDefault)
5050
}
5151
}
52+
53+
pub(crate) struct RustcSimdMonomorphizeLaneLimitParser;
54+
55+
impl<S: Stage> SingleAttributeParser<S> for RustcSimdMonomorphizeLaneLimitParser {
56+
const PATH: &[Symbol] = &[sym::rustc_simd_monomorphize_lane_limit];
57+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
58+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
59+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct)]);
60+
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "N");
61+
62+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
63+
let ArgParser::NameValue(nv) = args else {
64+
cx.expected_name_value(cx.attr_span, None);
65+
return None;
66+
};
67+
Some(AttributeKind::RustcSimdMonomorphizeLaneLimit(cx.parse_limit_int(nv)?))
68+
}
69+
}

compiler/rustc_attr_parsing/src/attributes/util.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
use std::num::IntErrorKind;
2+
13
use rustc_ast::LitKind;
24
use rustc_ast::attr::AttributeExt;
35
use rustc_feature::is_builtin_attr_name;
46
use rustc_hir::RustcVersion;
7+
use rustc_hir::limit::Limit;
58
use rustc_span::{Symbol, sym};
69

710
use crate::context::{AcceptContext, Stage};
8-
use crate::parser::ArgParser;
11+
use crate::parser::{ArgParser, NameValueParser};
12+
use crate::session_diagnostics::LimitInvalid;
913

1014
/// Parse a rustc version number written inside string literal in an attribute,
1115
/// like appears in `since = "1.0.0"`. Suffixes like "-dev" and "-nightly" are
@@ -85,3 +89,34 @@ pub(crate) fn parse_single_integer<S: Stage>(
8589
};
8690
Some(num.0)
8791
}
92+
93+
impl<S: Stage> AcceptContext<'_, '_, S> {
94+
pub(crate) fn parse_limit_int(&self, nv: &NameValueParser) -> Option<Limit> {
95+
let Some(limit) = nv.value_as_str() else {
96+
self.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
97+
return None;
98+
};
99+
100+
let error_str = match limit.as_str().parse() {
101+
Ok(i) => return Some(Limit::new(i)),
102+
Err(e) => match e.kind() {
103+
IntErrorKind::PosOverflow => "`limit` is too large",
104+
IntErrorKind::Empty => "`limit` must be a non-negative integer",
105+
IntErrorKind::InvalidDigit => "not a valid integer",
106+
IntErrorKind::NegOverflow => {
107+
panic!(
108+
"`limit` should never negatively overflow since we're parsing into a usize and we'd get Empty instead"
109+
)
110+
}
111+
IntErrorKind::Zero => {
112+
panic!("zero is a valid `limit` so should have returned Ok() when parsing")
113+
}
114+
kind => panic!("unimplemented IntErrorKind variant: {:?}", kind),
115+
},
116+
};
117+
118+
self.emit_err(LimitInvalid { span: self.attr_span, value_span: nv.value_span, error_str });
119+
120+
None
121+
}
122+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::attributes::prototype::CustomMirParser;
5353
use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser};
5454
use crate::attributes::rustc_internal::{
5555
RustcLayoutScalarValidRangeEnd, RustcLayoutScalarValidRangeStart,
56-
RustcObjectLifetimeDefaultParser,
56+
RustcObjectLifetimeDefaultParser, RustcSimdMonomorphizeLaneLimitParser,
5757
};
5858
use crate::attributes::semantics::MayDangleParser;
5959
use crate::attributes::stability::{
@@ -198,6 +198,7 @@ attribute_parsers!(
198198
Single<RustcLayoutScalarValidRangeEnd>,
199199
Single<RustcLayoutScalarValidRangeStart>,
200200
Single<RustcObjectLifetimeDefaultParser>,
201+
Single<RustcSimdMonomorphizeLaneLimitParser>,
201202
Single<SanitizeParser>,
202203
Single<ShouldPanicParser>,
203204
Single<SkipDuringMethodDispatchParser>,

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,9 +1736,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17361736
// `BoringNoLocation` constraints can point to user-written code, but are less
17371737
// specific, and are not used for relations that would make sense to blame.
17381738
ConstraintCategory::BoringNoLocation => 6,
1739-
// Do not blame internal constraints.
1740-
ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 7,
1741-
ConstraintCategory::Internal => 8,
1739+
// Do not blame internal constraints if we can avoid it. Never blame
1740+
// the `'region: 'static` constraints introduced by placeholder outlives.
1741+
ConstraintCategory::Internal => 7,
1742+
ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 8,
17421743
};
17431744

17441745
debug!("constraint {constraint:?} category: {category:?}, interest: {interest:?}");

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
505505
let mut constraints = Default::default();
506506
let mut liveness_constraints =
507507
LivenessValues::without_specific_points(Rc::new(DenseLocationMap::new(promoted_body)));
508+
let mut deferred_closure_requirements = Default::default();
508509

509510
// Don't try to add borrow_region facts for the promoted MIR as they refer
510511
// to the wrong locations.
511512
let mut swap_constraints = |this: &mut Self| {
512513
mem::swap(this.polonius_facts, polonius_facts);
513514
mem::swap(&mut this.constraints.outlives_constraints, &mut constraints);
514515
mem::swap(&mut this.constraints.liveness_constraints, &mut liveness_constraints);
516+
mem::swap(this.deferred_closure_requirements, &mut deferred_closure_requirements);
515517
};
516518

517519
swap_constraints(self);
@@ -536,6 +538,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
536538
}
537539
self.constraints.outlives_constraints.push(constraint)
538540
}
541+
542+
// If there are nested bodies in promoteds, we also need to update their
543+
// location to something in the actual body, not the promoted.
544+
//
545+
// We don't update the constraint categories of the resulting constraints
546+
// as returns in nested bodies are a proper return, even if that nested body
547+
// is in a promoted.
548+
for (closure_def_id, args, _locations) in deferred_closure_requirements {
549+
self.deferred_closure_requirements.push((closure_def_id, args, locations));
550+
}
551+
539552
// If the region is live at least one location in the promoted MIR,
540553
// then add a liveness constraint to the main MIR for this region
541554
// at the location provided as an argument to this method

compiler/rustc_builtin_macros/src/global_allocator.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl AllocFnFactory<'_, '_> {
8585
body,
8686
define_opaque: None,
8787
}));
88-
let item = self.cx.item(self.span, self.attrs(), kind);
88+
let item = self.cx.item(self.span, self.attrs(method), kind);
8989
self.cx.stmt_item(self.ty_span, item)
9090
}
9191

@@ -100,8 +100,18 @@ impl AllocFnFactory<'_, '_> {
100100
self.cx.expr_call(self.ty_span, method, args)
101101
}
102102

103-
fn attrs(&self) -> AttrVec {
104-
thin_vec![self.cx.attr_word(sym::rustc_std_internal_symbol, self.span)]
103+
fn attrs(&self, method: &AllocatorMethod) -> AttrVec {
104+
let alloc_attr = match method.name {
105+
sym::alloc => sym::rustc_allocator,
106+
sym::dealloc => sym::rustc_deallocator,
107+
sym::realloc => sym::rustc_reallocator,
108+
sym::alloc_zeroed => sym::rustc_allocator_zeroed,
109+
_ => unreachable!("Unknown allocator method!"),
110+
};
111+
thin_vec![
112+
self.cx.attr_word(sym::rustc_std_internal_symbol, self.span),
113+
self.cx.attr_word(alloc_attr, self.span)
114+
]
105115
}
106116

107117
fn arg_ty(&self, input: &AllocatorMethodInput, args: &mut ThinVec<Param>) -> Box<Expr> {

compiler/rustc_builtin_macros/src/test_harness.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ pub fn inject(
6363

6464
if sess.is_test_crate() {
6565
let panic_strategy = match (panic_strategy, sess.opts.unstable_opts.panic_abort_tests) {
66-
(PanicStrategy::Abort, true) => PanicStrategy::Abort,
67-
(PanicStrategy::Abort, false) => {
66+
(PanicStrategy::Abort | PanicStrategy::ImmediateAbort, true) => panic_strategy,
67+
(PanicStrategy::Abort | PanicStrategy::ImmediateAbort, false) => {
6868
if panic_strategy == platform_panic_strategy {
6969
// Silently allow compiling with panic=abort on these platforms,
7070
// but with old behavior (abort if a test fails).
@@ -287,10 +287,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> Box<ast::Item> {
287287
let ecx = &cx.ext_cx;
288288
let test_ident = Ident::new(sym::test, sp);
289289

290-
let runner_name = match cx.panic_strategy {
291-
PanicStrategy::Unwind => "test_main_static",
292-
PanicStrategy::Abort => "test_main_static_abort",
293-
};
290+
let runner_name =
291+
if cx.panic_strategy.unwinds() { "test_main_static" } else { "test_main_static_abort" };
294292

295293
// test::test_main_static(...)
296294
let mut test_runner = cx.test_runner.clone().unwrap_or_else(|| {

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ pub(crate) struct FullyMonomorphizedLayoutCx<'tcx>(pub(crate) TyCtxt<'tcx>);
439439
impl<'tcx> LayoutOfHelpers<'tcx> for FullyMonomorphizedLayoutCx<'tcx> {
440440
#[inline]
441441
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
442-
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
442+
if let LayoutError::SizeOverflow(_)
443+
| LayoutError::InvalidSimd { .. }
444+
| LayoutError::ReferencesError(_) = err
445+
{
443446
self.0.sess.dcx().span_fatal(span, err.to_string())
444447
} else {
445448
self.0
@@ -458,7 +461,9 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for FullyMonomorphizedLayoutCx<'tcx> {
458461
span: Span,
459462
fn_abi_request: FnAbiRequest<'tcx>,
460463
) -> ! {
461-
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
464+
if let FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. }) =
465+
err
466+
{
462467
self.0.sess.dcx().emit_fatal(Spanned { span, node: err })
463468
} else {
464469
match fn_abi_request {

0 commit comments

Comments
 (0)