fix ICE on inconsistent import resolution with macro-attributed extern crate
This commit is contained in:
parent
9f6cd6defb
commit
4d2f6a0843
3 changed files with 29 additions and 1 deletions
|
|
@ -989,7 +989,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
|||
PathResult::Module(module) => {
|
||||
// Consistency checks, analogous to `finalize_macro_resolutions`.
|
||||
if let Some(initial_module) = import.imported_module.get() {
|
||||
if module != initial_module && no_ambiguity {
|
||||
if module != initial_module && no_ambiguity && !self.issue_145575_hack_applied {
|
||||
span_bug!(import.span, "inconsistent resolution for an import");
|
||||
}
|
||||
} else if self.privacy_errors.is_empty() {
|
||||
|
|
|
|||
14
tests/ui/resolve/ice-inconsistent-resolution-151213.rs
Normal file
14
tests/ui/resolve/ice-inconsistent-resolution-151213.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//@ edition: 2024
|
||||
|
||||
#[attr]
|
||||
//~^ ERROR cannot find attribute `attr` in this scope
|
||||
extern crate core as std;
|
||||
//~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern`
|
||||
|
||||
mod inner {
|
||||
use std::str;
|
||||
|
||||
use crate::*;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
14
tests/ui/resolve/ice-inconsistent-resolution-151213.stderr
Normal file
14
tests/ui/resolve/ice-inconsistent-resolution-151213.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
|
||||
--> $DIR/ice-inconsistent-resolution-151213.rs:5:1
|
||||
|
|
||||
LL | extern crate core as std;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `attr` in this scope
|
||||
--> $DIR/ice-inconsistent-resolution-151213.rs:3:3
|
||||
|
|
||||
LL | #[attr]
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue