Skip to content

Interaction with uniform_paths canaries can hide import errors and lead to strange ICEs. #54253

Closed
@eddyb

Description

@eddyb

Reduced from RLS' source (on the Rust 2018 edition):

// Dummy import to introduce `uniform_paths` canaries.
use std;

// fn version() -> &'static str {""}

mod foo {
    // Error *not* reported, despite `version` being commented out above!
    use crate::version; 
    
    fn bar() {
        version();
    }
}

fn main() {}

The use std; import is the one introducing the canaries - if it's changed to use ::std;, the error for version is emitted. With no import errors, various parts of the compiler can ICE.
(currently attempted .def_id() on invalid def: Err, triggered by lints trying to run on foo::bar)

I'll try to fix it during #54116, as it was discovered during my attempt to fix RLS for that PR.

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions