Skip to content

Commit 179da5d

Browse files
authored
Merge pull request rust-lang#4615 from rust-lang/rustup-2025-10-03
Automatic Rustup
2 parents d3bb22f + 6beb612 commit 179da5d

File tree

503 files changed

+9958
-4880
lines changed

Some content is hidden

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

503 files changed

+9958
-4880
lines changed

bootstrap.example.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@
476476
# when the stage 0 compiler is actually built from in-tree sources.
477477
#build.compiletest-allow-stage0 = false
478478

479-
# Whether to use the precompiled stage0 libtest with compiletest.
480-
#build.compiletest-use-stage0-libtest = true
481-
482479
# Default value for the `--extra-checks` flag of tidy.
483480
#
484481
# See `./x test tidy --help` for details.

compiler/rustc_attr_parsing/src/attributes/inline.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ impl<S: Stage> SingleAttributeParser<S> for RustcForceInlineParser {
7272
const PATH: &'static [Symbol] = &[sym::rustc_force_inline];
7373
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
7474
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
75-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
75+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
76+
Allow(Target::Fn),
77+
Allow(Target::Method(MethodKind::Inherent)),
78+
]);
79+
7680
const TEMPLATE: AttributeTemplate = template!(Word, List: &["reason"], NameValueStr: "reason");
7781

7882
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {

compiler/rustc_attr_parsing/src/validate_attr.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,9 @@ pub fn check_attribute_safety(
207207
}
208208
}
209209

210-
// - Normal builtin attribute, or any non-builtin attribute
211-
// - All non-builtin attributes are currently considered safe; writing `#[unsafe(..)]` is
212-
// not permitted on non-builtin attributes or normal builtin attributes
213-
(Some(AttributeSafety::Normal) | None, Safety::Unsafe(unsafe_span)) => {
210+
// - Normal builtin attribute
211+
// - Writing `#[unsafe(..)]` is not permitted on normal builtin attributes
212+
(Some(AttributeSafety::Normal), Safety::Unsafe(unsafe_span)) => {
214213
psess.dcx().emit_err(errors::InvalidAttrUnsafe {
215214
span: unsafe_span,
216215
name: attr_item.path.clone(),
@@ -224,9 +223,8 @@ pub fn check_attribute_safety(
224223
}
225224

226225
// - Non-builtin attribute
227-
// - No explicit `#[unsafe(..)]` written.
228-
(None, Safety::Default) => {
229-
// OK
226+
(None, Safety::Unsafe(_) | Safety::Default) => {
227+
// OK (not checked here)
230228
}
231229

232230
(

compiler/rustc_borrowck/src/borrowck_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, 'infcx, 'tcx> {
426426
}
427427

428428
pub(crate) fn path_does_not_live_long_enough(&self, span: Span, path: &str) -> Diag<'infcx> {
429-
struct_span_code_err!(self.dcx(), span, E0597, "{} does not live long enough", path,)
429+
struct_span_code_err!(self.dcx(), span, E0597, "{} does not live long enough", path)
430430
}
431431

432432
pub(crate) fn cannot_return_reference_to_local(
@@ -480,7 +480,7 @@ impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, 'infcx, 'tcx> {
480480
}
481481

482482
pub(crate) fn temporary_value_borrowed_for_too_long(&self, span: Span) -> Diag<'infcx> {
483-
struct_span_code_err!(self.dcx(), span, E0716, "temporary value dropped while borrowed",)
483+
struct_span_code_err!(self.dcx(), span, E0716, "temporary value dropped while borrowed")
484484
}
485485
}
486486

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
29922992
self.buffer_error(err);
29932993
}
29942994

2995+
#[tracing::instrument(level = "debug", skip(self, explanation))]
29952996
fn report_local_value_does_not_live_long_enough(
29962997
&self,
29972998
location: Location,
@@ -3001,13 +3002,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
30013002
borrow_spans: UseSpans<'tcx>,
30023003
explanation: BorrowExplanation<'tcx>,
30033004
) -> Diag<'infcx> {
3004-
debug!(
3005-
"report_local_value_does_not_live_long_enough(\
3006-
{:?}, {:?}, {:?}, {:?}, {:?}\
3007-
)",
3008-
location, name, borrow, drop_span, borrow_spans
3009-
);
3010-
30113005
let borrow_span = borrow_spans.var_or_use_path_span();
30123006
if let BorrowExplanation::MustBeValidFor {
30133007
category,
@@ -3974,7 +3968,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
39743968
}
39753969
ProjectionElem::ConstantIndex { .. }
39763970
| ProjectionElem::Subslice { .. }
3977-
| ProjectionElem::Subtype(_)
39783971
| ProjectionElem::Index(_)
39793972
| ProjectionElem::UnwrapUnsafeBinder(_) => kind,
39803973
},

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,26 @@ impl<'tcx> BorrowExplanation<'tcx> {
416416
{
417417
self.add_object_lifetime_default_note(tcx, err, unsize_ty);
418418
}
419+
420+
let mut preds = path
421+
.iter()
422+
.filter_map(|constraint| match constraint.category {
423+
ConstraintCategory::Predicate(pred) if !pred.is_dummy() => Some(pred),
424+
_ => None,
425+
})
426+
.collect::<Vec<Span>>();
427+
preds.sort();
428+
preds.dedup();
429+
if !preds.is_empty() {
430+
let s = if preds.len() == 1 { "" } else { "s" };
431+
err.span_note(
432+
preds,
433+
format!(
434+
"requirement{s} that the value outlives `{region_name}` introduced here"
435+
),
436+
);
437+
}
438+
419439
self.add_lifetime_bound_suggestion_to_diagnostic(err, &category, span, region_name);
420440
}
421441
_ => {}

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
402402
ProjectionElem::Downcast(..) if opt.including_downcast => return None,
403403
ProjectionElem::Downcast(..) => (),
404404
ProjectionElem::OpaqueCast(..) => (),
405-
ProjectionElem::Subtype(..) => (),
406405
ProjectionElem::UnwrapUnsafeBinder(_) => (),
407406
ProjectionElem::Field(field, _ty) => {
408407
// FIXME(project-rfc_2229#36): print capture precisely here.
@@ -484,9 +483,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
484483
PlaceRef { local, projection: proj_base }.ty(self.body, self.infcx.tcx)
485484
}
486485
ProjectionElem::Downcast(..) => place.ty(self.body, self.infcx.tcx),
487-
ProjectionElem::Subtype(ty)
488-
| ProjectionElem::OpaqueCast(ty)
489-
| ProjectionElem::UnwrapUnsafeBinder(ty) => PlaceTy::from_ty(*ty),
486+
ProjectionElem::OpaqueCast(ty) | ProjectionElem::UnwrapUnsafeBinder(ty) => {
487+
PlaceTy::from_ty(*ty)
488+
}
490489
ProjectionElem::Field(_, field_type) => PlaceTy::from_ty(*field_type),
491490
},
492491
};

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
192192
[
193193
..,
194194
ProjectionElem::Index(_)
195-
| ProjectionElem::Subtype(_)
196195
| ProjectionElem::ConstantIndex { .. }
197196
| ProjectionElem::OpaqueCast { .. }
198197
| ProjectionElem::Subslice { .. }

compiler/rustc_borrowck/src/lib.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn provide(providers: &mut Providers) {
119119
fn mir_borrowck(
120120
tcx: TyCtxt<'_>,
121121
def: LocalDefId,
122-
) -> Result<&ConcreteOpaqueTypes<'_>, ErrorGuaranteed> {
122+
) -> Result<&DefinitionSiteHiddenTypes<'_>, ErrorGuaranteed> {
123123
assert!(!tcx.is_typeck_child(def.to_def_id()));
124124
let (input_body, _) = tcx.mir_promoted(def);
125125
debug!("run query mir_borrowck: {}", tcx.def_path_str(def));
@@ -130,7 +130,7 @@ fn mir_borrowck(
130130
Err(guar)
131131
} else if input_body.should_skip() {
132132
debug!("Skipping borrowck because of injected body");
133-
let opaque_types = ConcreteOpaqueTypes(Default::default());
133+
let opaque_types = DefinitionSiteHiddenTypes(Default::default());
134134
Ok(tcx.arena.alloc(opaque_types))
135135
} else {
136136
let mut root_cx = BorrowCheckRootCtxt::new(tcx, def, None);
@@ -278,7 +278,7 @@ impl<'tcx> ClosureOutlivesSubjectTy<'tcx> {
278278
mut map: impl FnMut(ty::RegionVid) -> ty::Region<'tcx>,
279279
) -> Ty<'tcx> {
280280
fold_regions(tcx, self.inner, |r, depth| match r.kind() {
281-
ty::ReBound(debruijn, br) => {
281+
ty::ReBound(ty::BoundVarIndexKind::Bound(debruijn), br) => {
282282
debug_assert_eq!(debruijn, depth);
283283
map(ty::RegionVid::from_usize(br.var.index()))
284284
}
@@ -1989,10 +1989,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
19891989
},
19901990
// `OpaqueCast`: only transmutes the type, so no moves there.
19911991
// `Downcast` : only changes information about a `Place` without moving.
1992-
// `Subtype` : only transmutes the type, so no moves.
19931992
// So it's safe to skip these.
19941993
ProjectionElem::OpaqueCast(_)
1995-
| ProjectionElem::Subtype(_)
19961994
| ProjectionElem::Downcast(_, _)
19971995
| ProjectionElem::UnwrapUnsafeBinder(_) => (),
19981996
}
@@ -2218,7 +2216,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
22182216
for (place_base, elem) in place.iter_projections().rev() {
22192217
match elem {
22202218
ProjectionElem::Index(_/*operand*/) |
2221-
ProjectionElem::Subtype(_) |
22222219
ProjectionElem::OpaqueCast(_) |
22232220
ProjectionElem::ConstantIndex { .. } |
22242221
// assigning to P[i] requires P to be valid.
@@ -2610,7 +2607,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
26102607
| ProjectionElem::Index(..)
26112608
| ProjectionElem::ConstantIndex { .. }
26122609
| ProjectionElem::Subslice { .. }
2613-
| ProjectionElem::Subtype(..)
26142610
| ProjectionElem::OpaqueCast { .. }
26152611
| ProjectionElem::Downcast(..)
26162612
| ProjectionElem::UnwrapUnsafeBinder(_) => {

compiler/rustc_borrowck/src/places_conflict.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ fn place_components_conflict<'tcx>(
249249
| (ProjectionElem::ConstantIndex { .. }, _, _)
250250
| (ProjectionElem::Subslice { .. }, _, _)
251251
| (ProjectionElem::OpaqueCast { .. }, _, _)
252-
| (ProjectionElem::Subtype(_), _, _)
253252
| (ProjectionElem::Downcast { .. }, _, _)
254253
| (ProjectionElem::UnwrapUnsafeBinder(_), _, _) => {
255254
// Recursive case. This can still be disjoint on a
@@ -510,7 +509,6 @@ fn place_projection_conflict<'tcx>(
510509
| ProjectionElem::Field(..)
511510
| ProjectionElem::Index(..)
512511
| ProjectionElem::ConstantIndex { .. }
513-
| ProjectionElem::Subtype(_)
514512
| ProjectionElem::OpaqueCast { .. }
515513
| ProjectionElem::Subslice { .. }
516514
| ProjectionElem::Downcast(..),

0 commit comments

Comments
 (0)