Skip to content

[NLL] Poor spans for mismatched types #95686

Closed
@jackh726

Description

@jackh726

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:

struct SomeStruct<'x, 'y, 'z: 'x> {
    foo: &'x Foo<'z>,
    bar: &'x Bar<'z>,
    f: &'y dyn for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Foo<'b>,
}
fn id<T>(t: T) -> T {
    t
}
static SOME_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 enough
    foo: &Foo { bools: &[false, true] },
    bar: &Bar { bools: &[true, true] },
    f: &id,
    //[base]~^ ERROR implementation of `FnOnce` is not general enough
};

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsNLL-diagnosticsWorking towards the "diagnostic parity" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions