Normalize assumed_wf_types after wfchecking is complete, for better spans

This commit is contained in:
Michael Goulet 2023-01-08 03:14:27 +00:00
parent ca554efaf7
commit 0bddce5090
7 changed files with 18 additions and 17 deletions

View file

@ -97,21 +97,22 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
let infcx = &tcx.infer_ctxt().build();
let ocx = ObligationCtxt::new(infcx);
let assumed_wf_types = ocx.assumed_wf_types(param_env, span, body_def_id);
let mut wfcx = WfCheckingCtxt { ocx, span, body_id, param_env };
if !tcx.features().trivial_bounds {
wfcx.check_false_global_bounds()
}
f(&mut wfcx);
let assumed_wf_types = wfcx.ocx.assumed_wf_types(param_env, span, body_def_id);
let implied_bounds = infcx.implied_bounds_tys(param_env, body_id, assumed_wf_types);
let errors = wfcx.select_all_or_error();
if !errors.is_empty() {
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
return;
}
let implied_bounds = infcx.implied_bounds_tys(param_env, body_id, assumed_wf_types);
let outlives_environment =
OutlivesEnvironment::with_bounds(param_env, Some(infcx), implied_bounds);

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
--> $DIR/issue-35570.rs:8:16
--> $DIR/issue-35570.rs:8:40
|
LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
error: aborting due to previous error

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:25
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:49
|
LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
|
help: consider restricting type parameter `T`
|

View file

@ -17,8 +17,8 @@ impl ToString for Cow<'_, str> {
impl<B: ?Sized> Display for Cow<'_, B> {
//~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
//~| ERROR: the trait bound `B: Clone` is not satisfied [E0277]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
write!(f, "foo")
}
}

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `B: Clone` is not satisfied
--> $DIR/issue-79224.rs:18:29
--> $DIR/issue-79224.rs:18:17
|
LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
| ^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound
@ -11,10 +11,10 @@ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
error[E0277]: the trait bound `B: Clone` is not satisfied
--> $DIR/issue-79224.rs:18:29
--> $DIR/issue-79224.rs:20:12
|
LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `Foo: HasComponent<()>` is not satisfied
--> $DIR/issue-91594.rs:10:1
--> $DIR/issue-91594.rs:10:6
|
LL | impl HasComponent<<Foo as Component<Foo>>::Interface> for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo`
|
= help: the trait `HasComponent<<Foo as Component<Foo>>::Interface>` is implemented for `Foo`
note: required for `Foo` to implement `Component<Foo>`

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA` is not satisfied
--> $DIR/issue-103573.rs:18:17
--> $DIR/issue-103573.rs:18:18
|
LL | fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB`
|
help: consider further restricting the associated type
|