You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The src/test/ui/rfc1623.rs test currently gives objectively worse output spans under NLL. Specifically, without NLL, we point to the specific field that isn't general enough. With NLL, we point at the outer struct creation.
Relevant excerpt with error labels:
structSomeStruct<'x,'y,'z:'x>{foo:&'xFoo<'z>,bar:&'xBar<'z>,f:&'ydynfor<'a,'b> Fn(&'aFoo<'b>) -> &'aFoo<'b>,}fnid<T>(t:T) -> T{
t
}staticSOME_STRUCT:&SomeStruct = &SomeStruct{//[nll]~^ ERROR mismatched types//[nll]~| ERROR mismatched types//[nll]~| ERROR implementation of `FnOnce` is not general enough//[nll]~| ERROR implementation of `FnOnce` is not general enoughfoo:&Foo{bools:&[false,true]},bar:&Bar{bools:&[true,true]},f:&id,//[base]~^ ERROR implementation of `FnOnce` is not general enough};
This is caused by the way that we handle region constraints for promoteds. We change the location of all constraints to point to the location of the promoted:
However, the location is used for both borrow-checking and diagnostics. As a result, any errors that get 'blamed' on a promoted will have the span of the entire promoted. We should track the span separately from the location, so that we can adjust the (semantic) location and diagnostic span separately.
Activity
Aaron1011 commentedon Apr 20, 2022
This is caused by the way that we handle region constraints for promoteds. We change the location of all constraints to point to the location of the promoted:
rust/compiler/rustc_borrowck/src/type_check/mod.rs
Lines 641 to 644 in 4ca19e0
However, the location is used for both borrow-checking and diagnostics. As a result, any errors that get 'blamed' on a promoted will have the span of the entire promoted. We should track the span separately from the location, so that we can adjust the (semantic) location and diagnostic span separately.
jackh726 commentedon May 21, 2022
Span here is better thanks to #96236. Now just a nearly duplicate error, which we can track in #96211.