1
Fork 0

Auto merge of #105575 - compiler-errors:impl-wf-lint, r=oli-obk

Add `IMPLIED_BOUNDS_ENTAILMENT` lint

Implements a lint (#105572) version of the hard-error introduced in #105483. Context is in that PR.

r? `@lcnr`
cc `@oli-obk` who had asked for this to be a lint first

Not sure if this needs to be an FCP, since it's a lint for now.
This commit is contained in:
bors 2022-12-20 03:52:43 +00:00
commit 7f42e58eff
9 changed files with 223 additions and 15 deletions

View file

@ -1693,7 +1693,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
&self,
generic_param_scope: LocalDefId,
outlives_env: &OutlivesEnvironment<'tcx>,
) {
) -> Option<ErrorGuaranteed> {
let errors = self.resolve_regions(outlives_env);
if let None = self.tainted_by_errors() {
@ -1704,6 +1704,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
// errors from silly ones.
self.report_region_errors(generic_param_scope, &errors);
}
(!errors.is_empty()).then(|| {
self.tcx.sess.delay_span_bug(rustc_span::DUMMY_SP, "error should have been emitted")
})
}
// [Note-Type-error-reporting]

View file

@ -68,6 +68,7 @@ use crate::infer::{
};
use crate::traits::{ObligationCause, ObligationCauseCode};
use rustc_data_structures::undo_log::UndoLogs;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::def_id::DefId;
use rustc_hir::def_id::LocalDefId;
use rustc_middle::mir::ConstraintCategory;
@ -177,7 +178,7 @@ impl<'tcx> InferCtxt<'tcx> {
&self,
generic_param_scope: LocalDefId,
outlives_env: &OutlivesEnvironment<'tcx>,
) {
) -> Option<ErrorGuaranteed> {
self.process_registered_region_obligations(
outlives_env.region_bound_pairs(),
outlives_env.param_env,