diff options
| author | bors <bors@rust-lang.org> | 2023-03-21 12:06:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-21 12:06:26 +0000 |
| commit | a01b4cc9f375f1b95fa8195daeea938d3d9c4c34 (patch) | |
| tree | 6253002cc0f9d198fe8747567aee1dd07636379b /compiler/rustc_middle/src | |
| parent | ef03fda339923e659d3d3ca3321de887316d2807 (diff) | |
| parent | 925fbcdf8a1646d5318e82c6d3ffeda41a10a110 (diff) | |
| download | rust-a01b4cc9f375f1b95fa8195daeea938d3d9c4c34.tar.gz rust-a01b4cc9f375f1b95fa8195daeea938d3d9c4c34.zip | |
Auto merge of #109442 - Nilstrieb:rollup-seb5xsa, r=Nilstrieb
Rollup of 10 pull requests Successful merges: - #106434 (Document `Iterator::sum/product` for Option/Result) - #108326 (Implement read_buf for a few more types) - #108842 (Enforce non-lifetime-binders in supertrait preds are not object safe) - #108896 (new solver: make all goal evaluation able to be automatically rerun ) - #109124 (Add `dist.compression-profile` option to control compression speed) - #109240 (Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions) - #109385 (fix typo) - #109386 (add myself to mailmap) - #109390 (Custom MIR: Support aggregate expressions) - #109408 (not *all* retags might be explicit in Runtime MIR) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/syntax.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/fold.rs | 15 |
3 files changed, 15 insertions, 18 deletions
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index b16b6616415..3a893cdabf6 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -78,7 +78,8 @@ pub enum MirPhase { /// MIR, this is UB. /// - Retags: If `-Zmir-emit-retag` is enabled, analysis MIR has "implicit" retags in the same way /// that Rust itself has them. Where exactly these are is generally subject to change, and so we - /// don't document this here. Runtime MIR has all retags explicit. + /// don't document this here. Runtime MIR has most retags explicit (though implicit retags + /// can still occur at `Rvalue::{Ref,AddrOf}`). /// - Generator bodies: In analysis MIR, locals may actually be behind a pointer that user code has /// access to. This occurs in generator bodies. Such locals do not behave like other locals, /// because they eg may be aliased in surprising ways. Runtime MIR has no such special locals - @@ -1165,7 +1166,7 @@ pub enum AggregateKind<'tcx> { Tuple, /// The second field is the variant index. It's equal to 0 for struct - /// and union expressions. The fourth field is + /// and union expressions. The last field is the /// active field number and is present only for union expressions /// -- e.g., for a union expression `SomeUnion { c: .. }`, the /// active field index would identity the field `c` diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index fb3e9cb1263..833402abfc4 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -897,6 +897,9 @@ pub enum ObjectSafetyViolation { /// (e.g., `trait Foo : Bar<Self>`). SupertraitSelf(SmallVec<[Span; 1]>), + // Supertrait has a non-lifetime `for<T>` binder. + SupertraitNonLifetimeBinder(SmallVec<[Span; 1]>), + /// Method has something illegal. Method(Symbol, MethodViolationCode, Span), @@ -919,6 +922,9 @@ impl ObjectSafetyViolation { .into() } } + ObjectSafetyViolation::SupertraitNonLifetimeBinder(_) => { + format!("where clause cannot reference non-lifetime `for<...>` variables").into() + } ObjectSafetyViolation::Method(name, MethodViolationCode::StaticMethod(_), _) => { format!("associated function `{}` has no `self` parameter", name).into() } @@ -969,7 +975,9 @@ impl ObjectSafetyViolation { pub fn solution(&self, err: &mut Diagnostic) { match self { - ObjectSafetyViolation::SizedSelf(_) | ObjectSafetyViolation::SupertraitSelf(_) => {} + ObjectSafetyViolation::SizedSelf(_) + | ObjectSafetyViolation::SupertraitSelf(_) + | ObjectSafetyViolation::SupertraitNonLifetimeBinder(..) => {} ObjectSafetyViolation::Method( name, MethodViolationCode::StaticMethod(Some((add_self_sugg, make_sized_sugg))), @@ -1023,7 +1031,8 @@ impl ObjectSafetyViolation { // diagnostics use a `note` instead of a `span_label`. match self { ObjectSafetyViolation::SupertraitSelf(spans) - | ObjectSafetyViolation::SizedSelf(spans) => spans.clone(), + | ObjectSafetyViolation::SizedSelf(spans) + | ObjectSafetyViolation::SupertraitNonLifetimeBinder(spans) => spans.clone(), ObjectSafetyViolation::AssocConst(_, span) | ObjectSafetyViolation::GAT(_, span) | ObjectSafetyViolation::Method(_, _, span) diff --git a/compiler/rustc_middle/src/ty/fold.rs b/compiler/rustc_middle/src/ty/fold.rs index d66f436f947..6205e2bf24d 100644 --- a/compiler/rustc_middle/src/ty/fold.rs +++ b/compiler/rustc_middle/src/ty/fold.rs @@ -51,9 +51,7 @@ where // Region folder impl<'tcx> TyCtxt<'tcx> { - /// Folds the escaping and free regions in `value` using `f`, and - /// sets `skipped_regions` to true if any late-bound region was found - /// and skipped. + /// Folds the escaping and free regions in `value` using `f`. pub fn fold_regions<T>( self, value: T, @@ -64,17 +62,6 @@ impl<'tcx> TyCtxt<'tcx> { { value.fold_with(&mut RegionFolder::new(self, &mut f)) } - - pub fn super_fold_regions<T>( - self, - value: T, - mut f: impl FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>, - ) -> T - where - T: TypeSuperFoldable<TyCtxt<'tcx>>, - { - value.super_fold_with(&mut RegionFolder::new(self, &mut f)) - } } /// Folds over the substructure of a type, visiting its component |
