Skip to content

Spans for view items are fairly inaccurate #650

Closed
@brson

Description

@brson

In this test case:

// xfail-stage0                                                                                                                                                               
// error-pattern:'swap' is glob-imported from multiple different modules                                                                                                      
// issue #482                                                                                                                                                                 

use std;
// expecting swap to be defined in vec                                                                                                                                        
import std::vec::*;
import alternate_supplier::*;

mod alternate_supplier {
  fn swap() {}
}

fn main() { swap() }

I get this error:

../src/test/compile-fail/cross-crate-glob-collision.rs:7:10:8:6: note: 'swap' is imported here
../src/test/compile-fail/cross-crate-glob-collision.rs:8:25:10:3: note: 'swap' is imported here
../src/test/compile-fail/cross-crate-glob-collision.rs:14:12:14:17: error: 'swap' is glob-imported from multiple different modules.

The spans for the two imports, while in the general ballpark, are not very exact. I suspect that all types of view items have similar problems with their spans.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions