Skip to content

"Could not find <module> in <module>" uses wrong span when {...} are involved #43040

Closed
@RalfJung

Description

@RalfJung

The following program: (Playpen)

use std::bar::{foo1, foo2};

fn main() {
    println!("Hello, world!");
}

Produces these errors:

error[E0432]: unresolved import `std::bar::foo1`
 --> <anon>:1:16
  |
1 | use std::bar::{foo1, foo2};
  |                ^^^^ Could not find `bar` in `std`

error[E0432]: unresolved import `std::bar::foo2`
 --> <anon>:1:22
  |
1 | use std::bar::{foo1, foo2};
  |                      ^^^^ Could not find `bar` in `std`

Notice how the ^ put the blame on the part inside the curly brace, where really, they should point at the bar (or at the entire std::..., which is what happens when no curly braces are involved).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions