1
Fork 0

Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errors

Tweaks to -Zdrop-tracking-mir

Split from https://github.com/rust-lang/rust/pull/107421

3 commits: 1 diagnostic improvement and 2 ICEs.
This commit is contained in:
Matthias Krüger 2023-03-05 20:57:21 +01:00 committed by GitHub
commit 1c2f641e15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View file

@ -1510,6 +1510,14 @@ fn opaque_type_cycle_error(
{ {
label_match(interior_ty.ty, interior_ty.span); label_match(interior_ty.ty, interior_ty.span);
} }
if tcx.sess.opts.unstable_opts.drop_tracking_mir
&& let DefKind::Generator = tcx.def_kind(closure_def_id)
{
let generator_layout = tcx.mir_generator_witnesses(closure_def_id);
for interior_ty in &generator_layout.field_tys {
label_match(interior_ty.ty, interior_ty.source_info.span);
}
}
} }
} }
} }

View file

@ -1872,12 +1872,14 @@ fn check_must_not_suspend_def(
data: SuspendCheckData<'_>, data: SuspendCheckData<'_>,
) -> bool { ) -> bool {
if let Some(attr) = tcx.get_attr(def_id, sym::must_not_suspend) { if let Some(attr) = tcx.get_attr(def_id, sym::must_not_suspend) {
let msg = format!( let msg = rustc_errors::DelayDm(|| {
"{}`{}`{} held across a suspend point, but should not be", format!(
data.descr_pre, "{}`{}`{} held across a suspend point, but should not be",
tcx.def_path_str(def_id), data.descr_pre,
data.descr_post, tcx.def_path_str(def_id),
); data.descr_post,
)
});
tcx.struct_span_lint_hir( tcx.struct_span_lint_hir(
rustc_session::lint::builtin::MUST_NOT_SUSPEND, rustc_session::lint::builtin::MUST_NOT_SUSPEND,
hir_id, hir_id,

View file

@ -149,6 +149,6 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
&mut self, &mut self,
_: &InferCtxt<'tcx>, _: &InferCtxt<'tcx>,
) -> Vec<PredicateObligation<'tcx>> { ) -> Vec<PredicateObligation<'tcx>> {
unimplemented!() std::mem::take(&mut self.obligations)
} }
} }

View file

@ -114,6 +114,9 @@ error[E0720]: cannot resolve opaque type
| |
LL | fn generator_hold() -> impl Sized { LL | fn generator_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type | ^^^^^^^^^^ recursive opaque type
...
LL | let x = generator_hold();
| - generator captures itself here
error[E0720]: cannot resolve opaque type error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:90:26 --> $DIR/recursive-impl-trait-type-indirect.rs:90:26