}
let outlives_environment = OutlivesEnvironment::new(param_env);
- infcx
- .resolve_regions_and_report_errors(impl_c.def_id.expect_local(), &outlives_environment);
+ infcx.check_region_obligations_and_report_errors(
+ impl_c.def_id.expect_local(),
+ &outlives_environment,
+ );
});
}
// Finally, resolve all regions.
let outlives_env = OutlivesEnvironment::new(param_env);
- infcx.resolve_regions_and_report_errors(impl_did, &outlives_env);
+ infcx.check_region_obligations_and_report_errors(impl_did, &outlives_env);
}
}
_ => {
// Finally, resolve all regions.
let outlives_env = OutlivesEnvironment::new(param_env);
- infcx.resolve_regions_and_report_errors(impl_did, &outlives_env);
+ infcx.check_region_obligations_and_report_errors(impl_did, &outlives_env);
CoerceUnsizedInfo { custom_kind: kind }
})
implied_bounds,
tcx.hir().local_def_id_to_hir_id(impl1_def_id),
);
- infcx.process_registered_region_obligations(outlives_env.region_bound_pairs(), param_env);
- infcx.resolve_regions_and_report_errors(impl1_def_id, &outlives_env);
+ infcx.check_region_obligations_and_report_errors(impl1_def_id, &outlives_env);
let Ok(impl2_substs) = infcx.fully_resolve(impl2_substs) else {
let span = tcx.def_span(impl1_def_id);
tcx.sess.emit_err(SubstsOnOverriddenImpl { span });
--- /dev/null
+#![feature(coerce_unsized)]
+
+use std::any::Any;
+use std::ops::CoerceUnsized;
+
+struct Foo<T> {
+ data: Box<T>,
+}
+
+impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
+//~^ ERROR the parameter type `T` may not live long enough
+
+fn main() {}
--- /dev/null
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/issue-53475.rs:10:1
+ |
+LL | impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound...
+ |
+LL | impl<T: 'static> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
+ | +++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.