Rollup merge of #101433 - jackh726:better-static-placeholder-error, r=compiler-errors
Emit a note that static bounds from HRTBs are a bug This note isn't perfect, but opening this to either 1) land as is or 2) get some feedback on how to improve it Let r? `@compiler-errors` and cc. `@nikomatsakis`
This commit is contained in:
commit
430123164f
34 changed files with 543 additions and 173 deletions
|
@ -10,6 +10,7 @@ use rustc_hir::ItemKind;
|
|||
use rustc_infer::infer::outlives::env::{OutlivesEnvironment, RegionBoundPairs};
|
||||
use rustc_infer::infer::outlives::obligations::TypeOutlives;
|
||||
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
|
||||
use rustc_middle::mir::ConstraintCategory;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts, Subst};
|
||||
use rustc_middle::ty::trait_def::TraitSpecializationKind;
|
||||
|
@ -663,7 +664,7 @@ fn ty_known_to_outlive<'tcx>(
|
|||
resolve_regions_with_wf_tys(tcx, id, param_env, &wf_tys, |infcx, region_bound_pairs| {
|
||||
let origin = infer::RelateParamBound(DUMMY_SP, ty, None);
|
||||
let outlives = &mut TypeOutlives::new(infcx, tcx, region_bound_pairs, None, param_env);
|
||||
outlives.type_must_outlive(origin, ty, region);
|
||||
outlives.type_must_outlive(origin, ty, region, ConstraintCategory::BoringNoLocation);
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -681,7 +682,12 @@ fn region_known_to_outlive<'tcx>(
|
|||
use rustc_infer::infer::outlives::obligations::TypeOutlivesDelegate;
|
||||
let origin = infer::RelateRegionParamBound(DUMMY_SP);
|
||||
// `region_a: region_b` -> `region_b <= region_a`
|
||||
infcx.push_sub_region_constraint(origin, region_b, region_a);
|
||||
infcx.push_sub_region_constraint(
|
||||
origin,
|
||||
region_b,
|
||||
region_a,
|
||||
ConstraintCategory::BoringNoLocation,
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue