1
Fork 0

resolve: More precise spans for ambiguous resolution errors

Add labels to ambiguous resolution errors
This commit is contained in:
Vadim Petrochenkov 2018-09-08 02:51:20 +03:00
parent 9beb5c3ef3
commit 2dce3779bb
18 changed files with 69 additions and 95 deletions

View file

@ -1164,8 +1164,7 @@ struct UseError<'a> {
} }
struct AmbiguityError<'a> { struct AmbiguityError<'a> {
span: Span, ident: Ident,
name: Name,
b1: &'a NameBinding<'a>, b1: &'a NameBinding<'a>,
b2: &'a NameBinding<'a>, b2: &'a NameBinding<'a>,
} }
@ -1818,7 +1817,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.arenas.alloc_module(module) self.arenas.alloc_module(module)
} }
fn record_use(&mut self, ident: Ident, ns: Namespace, binding: &'a NameBinding<'a>, span: Span) fn record_use(&mut self, ident: Ident, ns: Namespace, binding: &'a NameBinding<'a>)
-> bool /* true if an error was reported */ { -> bool /* true if an error was reported */ {
match binding.kind { match binding.kind {
NameBindingKind::Import { directive, binding, ref used } NameBindingKind::Import { directive, binding, ref used }
@ -1827,13 +1826,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
directive.used.set(true); directive.used.set(true);
self.used_imports.insert((directive.id, ns)); self.used_imports.insert((directive.id, ns));
self.add_to_glob_map(directive.id, ident); self.add_to_glob_map(directive.id, ident);
self.record_use(ident, ns, binding, span) self.record_use(ident, ns, binding)
} }
NameBindingKind::Import { .. } => false, NameBindingKind::Import { .. } => false,
NameBindingKind::Ambiguity { b1, b2 } => { NameBindingKind::Ambiguity { b1, b2 } => {
self.ambiguity_errors.push(AmbiguityError { self.ambiguity_errors.push(AmbiguityError { ident, b1, b2 });
span, name: ident.name, b1, b2,
});
true true
} }
_ => false _ => false
@ -2853,7 +2850,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
Def::Const(..) if is_syntactic_ambiguity => { Def::Const(..) if is_syntactic_ambiguity => {
// Disambiguate in favor of a unit struct/variant // Disambiguate in favor of a unit struct/variant
// or constant pattern. // or constant pattern.
self.record_use(ident, ValueNS, binding.unwrap(), ident.span); self.record_use(ident, ValueNS, binding.unwrap());
Some(PathResolution::new(def)) Some(PathResolution::new(def))
} }
Def::StructCtor(..) | Def::VariantCtor(..) | Def::StructCtor(..) | Def::VariantCtor(..) |
@ -4532,12 +4529,12 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
vis.is_accessible_from(module.normal_ancestor_id, self) vis.is_accessible_from(module.normal_ancestor_id, self)
} }
fn report_ambiguity_error(&self, name: Name, span: Span, b1: &NameBinding, b2: &NameBinding) { fn report_ambiguity_error(&self, ident: Ident, b1: &NameBinding, b2: &NameBinding) {
let participle = |is_import: bool| if is_import { "imported" } else { "defined" }; let participle = |is_import: bool| if is_import { "imported" } else { "defined" };
let msg1 = let msg1 =
format!("`{}` could refer to the name {} here", name, participle(b1.is_import())); format!("`{}` could refer to the name {} here", ident, participle(b1.is_import()));
let msg2 = let msg2 =
format!("`{}` could also refer to the name {} here", name, participle(b2.is_import())); format!("`{}` could also refer to the name {} here", ident, participle(b2.is_import()));
let note = if b1.expansion != Mark::root() { let note = if b1.expansion != Mark::root() {
Some(if let Def::Macro(..) = b1.def() { Some(if let Def::Macro(..) = b1.def() {
format!("macro-expanded {} do not shadow", format!("macro-expanded {} do not shadow",
@ -4547,16 +4544,17 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
if b1.is_import() { "imports" } else { "items" }) if b1.is_import() { "imports" } else { "items" })
}) })
} else if b1.is_glob_import() { } else if b1.is_glob_import() {
Some(format!("consider adding an explicit import of `{}` to disambiguate", name)) Some(format!("consider adding an explicit import of `{}` to disambiguate", ident))
} else { } else {
None None
}; };
let mut err = struct_span_err!(self.session, span, E0659, "`{}` is ambiguous", name); let mut err = struct_span_err!(self.session, ident.span, E0659, "`{}` is ambiguous", ident);
err.span_label(ident.span, "ambiguous name");
err.span_note(b1.span, &msg1); err.span_note(b1.span, &msg1);
match b2.def() { match b2.def() {
Def::Macro(..) if b2.span.is_dummy() => Def::Macro(..) if b2.span.is_dummy() =>
err.note(&format!("`{}` is also a builtin macro", name)), err.note(&format!("`{}` is also a builtin macro", ident)),
_ => err.span_note(b2.span, &msg2), _ => err.span_note(b2.span, &msg2),
}; };
if let Some(note) = note { if let Some(note) = note {
@ -4581,9 +4579,9 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
); );
} }
for &AmbiguityError { span, name, b1, b2 } in &self.ambiguity_errors { for &AmbiguityError { ident, b1, b2 } in &self.ambiguity_errors {
if reported_spans.insert(span) { if reported_spans.insert(ident.span) {
self.report_ambiguity_error(name, span, b1, b2); self.report_ambiguity_error(ident, b1, b2);
} }
} }

View file

@ -757,8 +757,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
(innermost_result.0.is_glob_import() || (innermost_result.0.is_glob_import() ||
innermost_result.0.may_appear_after(invoc_id, result.0)) { innermost_result.0.may_appear_after(invoc_id, result.0)) {
self.ambiguity_errors.push(AmbiguityError { self.ambiguity_errors.push(AmbiguityError {
span: path_span, ident,
name: ident.name,
b1: innermost_result.0, b1: innermost_result.0,
b2: result.0, b2: result.0,
}); });
@ -850,8 +849,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
if result.def() != innermost_result.def() && if result.def() != innermost_result.def() &&
innermost_result.may_appear_after(invoc_id, result) { innermost_result.may_appear_after(invoc_id, result) {
self.ambiguity_errors.push(AmbiguityError { self.ambiguity_errors.push(AmbiguityError {
span: ident.span, ident,
name: ident.name,
b1: innermost_result, b1: innermost_result,
b2: result, b2: result,
}); });
@ -929,7 +927,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
(Some(legacy_binding), Ok((binding, FromPrelude(from_prelude)))) (Some(legacy_binding), Ok((binding, FromPrelude(from_prelude))))
if !from_prelude || legacy_binding.may_appear_after(invoc_id, binding) => { if !from_prelude || legacy_binding.may_appear_after(invoc_id, binding) => {
if legacy_binding.def_ignoring_ambiguity() != binding.def_ignoring_ambiguity() { if legacy_binding.def_ignoring_ambiguity() != binding.def_ignoring_ambiguity() {
self.report_ambiguity_error(ident.name, span, legacy_binding, binding); self.report_ambiguity_error(ident, legacy_binding, binding);
} }
}, },
// OK, non-macro-expanded legacy wins over prelude even if defs are different // OK, non-macro-expanded legacy wins over prelude even if defs are different
@ -942,7 +940,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
(None, Ok((binding, FromPrelude(from_prelude)))) => { (None, Ok((binding, FromPrelude(from_prelude)))) => {
check_consistency(self, binding.def_ignoring_ambiguity()); check_consistency(self, binding.def_ignoring_ambiguity());
if from_prelude { if from_prelude {
self.record_use(ident, MacroNS, binding, span); self.record_use(ident, MacroNS, binding);
self.err_if_macro_use_proc_macro(ident.name, span, binding); self.err_if_macro_use_proc_macro(ident.name, span, binding);
} }
} }

View file

@ -242,21 +242,19 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
if record_used { if record_used {
if let Some(binding) = resolution.binding { if let Some(binding) = resolution.binding {
if let Some(shadowed_glob) = resolution.shadowed_glob { if let Some(shadowed_glob) = resolution.shadowed_glob {
let name = ident.name;
// Forbid expanded shadowing to avoid time travel. // Forbid expanded shadowing to avoid time travel.
if restricted_shadowing && if restricted_shadowing &&
binding.expansion != Mark::root() && binding.expansion != Mark::root() &&
ns != MacroNS && // In MacroNS, `try_define` always forbids this shadowing ns != MacroNS && // In MacroNS, `try_define` always forbids this shadowing
binding.def() != shadowed_glob.def() { binding.def() != shadowed_glob.def() {
self.ambiguity_errors.push(AmbiguityError { self.ambiguity_errors.push(AmbiguityError {
span: path_span, ident,
name,
b1: binding, b1: binding,
b2: shadowed_glob, b2: shadowed_glob,
}); });
} }
} }
if self.record_use(ident, ns, binding, path_span) { if self.record_use(ident, ns, binding) {
return Ok(self.dummy_binding); return Ok(self.dummy_binding);
} }
if !self.is_accessible(binding.vis) { if !self.is_accessible(binding.vis) {
@ -936,7 +934,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS { self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS {
if let Ok(binding) = result[ns].get() { if let Ok(binding) = result[ns].get() {
all_ns_err = false; all_ns_err = false;
if this.record_use(ident, ns, binding, directive.span) { if this.record_use(ident, ns, binding) {
if let ModuleOrUniformRoot::Module(module) = module { if let ModuleOrUniformRoot::Module(module) = module {
this.resolution(module, ident, ns).borrow_mut().binding = this.resolution(module, ident, ns).borrow_mut().binding =
Some(this.dummy_binding); Some(this.dummy_binding);

View file

@ -1,8 +1,8 @@
error[E0659]: `foo` is ambiguous error[E0659]: `foo` is ambiguous
--> $DIR/E0659.rs:25:5 --> $DIR/E0659.rs:25:15
| |
LL | collider::foo(); //~ ERROR E0659 LL | collider::foo(); //~ ERROR E0659
| ^^^^^^^^^^^^^ | ^^^ ambiguous name
| |
note: `foo` could refer to the name imported here note: `foo` could refer to the name imported here
--> $DIR/E0659.rs:20:13 --> $DIR/E0659.rs:20:13

View file

@ -13,10 +13,10 @@ LL | use a::foo as other_foo; //~ ERROR the name `foo` is defined multiple t
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error[E0659]: `foo` is ambiguous error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:56:9 --> $DIR/duplicate.rs:56:15
| |
LL | use self::foo::bar; //~ ERROR `foo` is ambiguous LL | use self::foo::bar; //~ ERROR `foo` is ambiguous
| ^^^^^^^^^^^^^^ | ^^^ ambiguous name
| |
note: `foo` could refer to the name imported here note: `foo` could refer to the name imported here
--> $DIR/duplicate.rs:53:9 --> $DIR/duplicate.rs:53:9
@ -31,10 +31,10 @@ LL | use self::m2::*;
= note: consider adding an explicit import of `foo` to disambiguate = note: consider adding an explicit import of `foo` to disambiguate
error[E0659]: `foo` is ambiguous error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:45:5 --> $DIR/duplicate.rs:45:8
| |
LL | f::foo(); //~ ERROR `foo` is ambiguous LL | f::foo(); //~ ERROR `foo` is ambiguous
| ^^^^^^ | ^^^ ambiguous name
| |
note: `foo` could refer to the name imported here note: `foo` could refer to the name imported here
--> $DIR/duplicate.rs:34:13 --> $DIR/duplicate.rs:34:13
@ -49,10 +49,10 @@ LL | pub use b::*;
= note: consider adding an explicit import of `foo` to disambiguate = note: consider adding an explicit import of `foo` to disambiguate
error[E0659]: `foo` is ambiguous error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:46:5 --> $DIR/duplicate.rs:46:8
| |
LL | g::foo(); //~ ERROR `foo` is ambiguous LL | g::foo(); //~ ERROR `foo` is ambiguous
| ^^^^^^ | ^^^ ambiguous name
| |
note: `foo` could refer to the name imported here note: `foo` could refer to the name imported here
--> $DIR/duplicate.rs:39:13 --> $DIR/duplicate.rs:39:13
@ -70,7 +70,7 @@ error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:59:9 --> $DIR/duplicate.rs:59:9
| |
LL | foo::bar(); //~ ERROR `foo` is ambiguous LL | foo::bar(); //~ ERROR `foo` is ambiguous
| ^^^^^^^^ | ^^^ ambiguous name
| |
note: `foo` could refer to the name imported here note: `foo` could refer to the name imported here
--> $DIR/duplicate.rs:53:9 --> $DIR/duplicate.rs:53:9

View file

@ -2,7 +2,7 @@ error[E0659]: `env` is ambiguous
--> $DIR/glob-shadowing.rs:21:17 --> $DIR/glob-shadowing.rs:21:17
| |
LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous
| ^^^ | ^^^ ambiguous name
| |
note: `env` could refer to the name imported here note: `env` could refer to the name imported here
--> $DIR/glob-shadowing.rs:19:9 --> $DIR/glob-shadowing.rs:19:9
@ -16,7 +16,7 @@ error[E0659]: `env` is ambiguous
--> $DIR/glob-shadowing.rs:29:21 --> $DIR/glob-shadowing.rs:29:21
| |
LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous
| ^^^ | ^^^ ambiguous name
| |
note: `env` could refer to the name imported here note: `env` could refer to the name imported here
--> $DIR/glob-shadowing.rs:27:13 --> $DIR/glob-shadowing.rs:27:13
@ -30,7 +30,7 @@ error[E0659]: `fenv` is ambiguous
--> $DIR/glob-shadowing.rs:39:21 --> $DIR/glob-shadowing.rs:39:21
| |
LL | let x = fenv!(); //~ ERROR `fenv` is ambiguous LL | let x = fenv!(); //~ ERROR `fenv` is ambiguous
| ^^^^ | ^^^^ ambiguous name
| |
note: `fenv` could refer to the name imported here note: `fenv` could refer to the name imported here
--> $DIR/glob-shadowing.rs:37:13 --> $DIR/glob-shadowing.rs:37:13

View file

@ -8,7 +8,7 @@ error[E0659]: `mac` is ambiguous
--> $DIR/issue-53269.rs:18:5 --> $DIR/issue-53269.rs:18:5
| |
LL | mac!(); //~ ERROR `mac` is ambiguous LL | mac!(); //~ ERROR `mac` is ambiguous
| ^^^ | ^^^ ambiguous name
| |
note: `mac` could refer to the name defined here note: `mac` could refer to the name defined here
--> $DIR/issue-53269.rs:13:1 --> $DIR/issue-53269.rs:13:1

View file

@ -43,7 +43,6 @@ mod inner2 {
fn main() { fn main() {
panic!(); //~ ERROR `panic` is ambiguous panic!(); //~ ERROR `panic` is ambiguous
//~^ ERROR `panic` is ambiguous
} }
mod inner3 { mod inner3 {

View file

@ -2,7 +2,7 @@ error[E0659]: `exported` is ambiguous
--> $DIR/local-modularized-tricky-fail-1.rs:38:1 --> $DIR/local-modularized-tricky-fail-1.rs:38:1
| |
LL | exported!(); //~ ERROR `exported` is ambiguous LL | exported!(); //~ ERROR `exported` is ambiguous
| ^^^^^^^^ | ^^^^^^^^ ambiguous name
| |
note: `exported` could refer to the name defined here note: `exported` could refer to the name defined here
--> $DIR/local-modularized-tricky-fail-1.rs:15:5 --> $DIR/local-modularized-tricky-fail-1.rs:15:5
@ -22,10 +22,10 @@ LL | use inner1::*;
= note: macro-expanded macros do not shadow = note: macro-expanded macros do not shadow
error[E0659]: `include` is ambiguous error[E0659]: `include` is ambiguous
--> $DIR/local-modularized-tricky-fail-1.rs:57:1 --> $DIR/local-modularized-tricky-fail-1.rs:56:1
| |
LL | include!(); //~ ERROR `include` is ambiguous LL | include!(); //~ ERROR `include` is ambiguous
| ^^^^^^^ | ^^^^^^^ ambiguous name
| |
note: `include` could refer to the name defined here note: `include` could refer to the name defined here
--> $DIR/local-modularized-tricky-fail-1.rs:27:5 --> $DIR/local-modularized-tricky-fail-1.rs:27:5
@ -44,7 +44,7 @@ error[E0659]: `panic` is ambiguous
--> $DIR/local-modularized-tricky-fail-1.rs:45:5 --> $DIR/local-modularized-tricky-fail-1.rs:45:5
| |
LL | panic!(); //~ ERROR `panic` is ambiguous LL | panic!(); //~ ERROR `panic` is ambiguous
| ^^^^^ | ^^^^^ ambiguous name
| |
note: `panic` could refer to the name defined here note: `panic` could refer to the name defined here
--> $DIR/local-modularized-tricky-fail-1.rs:21:5 --> $DIR/local-modularized-tricky-fail-1.rs:21:5
@ -60,10 +60,10 @@ LL | define_panic!();
= note: macro-expanded macros do not shadow = note: macro-expanded macros do not shadow
error[E0659]: `panic` is ambiguous error[E0659]: `panic` is ambiguous
--> $DIR/local-modularized-tricky-fail-1.rs:45:5 --> <panic macros>:1:13
| |
LL | panic!(); //~ ERROR `panic` is ambiguous LL | ( ) => ( { panic ! ( "explicit panic" ) } ) ; ( $ msg : expr ) => (
| ^^^^^^^^^ | ^^^^^ ambiguous name
| |
note: `panic` could refer to the name defined here note: `panic` could refer to the name defined here
--> $DIR/local-modularized-tricky-fail-1.rs:21:5 --> $DIR/local-modularized-tricky-fail-1.rs:21:5
@ -77,7 +77,6 @@ LL | define_panic!();
| ---------------- in this macro invocation | ---------------- in this macro invocation
= note: `panic` is also a builtin macro = note: `panic` is also a builtin macro
= note: macro-expanded macros do not shadow = note: macro-expanded macros do not shadow
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -2,7 +2,7 @@ error[E0659]: `bar` is ambiguous
--> $DIR/macro-paths.rs:23:5 --> $DIR/macro-paths.rs:23:5
| |
LL | bar::m! { //~ ERROR ambiguous LL | bar::m! { //~ ERROR ambiguous
| ^^^^^^ | ^^^ ambiguous name
| |
note: `bar` could refer to the name defined here note: `bar` could refer to the name defined here
--> $DIR/macro-paths.rs:24:9 --> $DIR/macro-paths.rs:24:9
@ -20,7 +20,7 @@ error[E0659]: `baz` is ambiguous
--> $DIR/macro-paths.rs:33:5 --> $DIR/macro-paths.rs:33:5
| |
LL | baz::m! { //~ ERROR ambiguous LL | baz::m! { //~ ERROR ambiguous
| ^^^^^^ | ^^^ ambiguous name
| |
note: `baz` could refer to the name defined here note: `baz` could refer to the name defined here
--> $DIR/macro-paths.rs:34:9 --> $DIR/macro-paths.rs:34:9

View file

@ -2,7 +2,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/macros.rs:48:5 --> $DIR/macros.rs:48:5
| |
LL | m!(); //~ ERROR ambiguous LL | m!(); //~ ERROR ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/macros.rs:46:5 --> $DIR/macros.rs:46:5
@ -19,7 +19,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/macros.rs:26:5 --> $DIR/macros.rs:26:5
| |
LL | m! { //~ ERROR ambiguous LL | m! { //~ ERROR ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name imported here note: `m` could refer to the name imported here
--> $DIR/macros.rs:27:13 --> $DIR/macros.rs:27:13
@ -37,7 +37,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/macros.rs:39:9 --> $DIR/macros.rs:39:9
| |
LL | m! { //~ ERROR ambiguous LL | m! { //~ ERROR ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name imported here note: `m` could refer to the name imported here
--> $DIR/macros.rs:40:17 --> $DIR/macros.rs:40:17

View file

@ -2,7 +2,7 @@ error[E0659]: `Foo` is ambiguous
--> $DIR/rfc-1560-warning-cycle.rs:19:17 --> $DIR/rfc-1560-warning-cycle.rs:19:17
| |
LL | fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous LL | fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous
| ^^^ | ^^^ ambiguous name
| |
note: `Foo` could refer to the name imported here note: `Foo` could refer to the name imported here
--> $DIR/rfc-1560-warning-cycle.rs:17:13 --> $DIR/rfc-1560-warning-cycle.rs:17:13

View file

@ -2,7 +2,7 @@ error[E0659]: `panic` is ambiguous
--> $DIR/shadow_builtin_macros.rs:43:5 --> $DIR/shadow_builtin_macros.rs:43:5
| |
LL | panic!(); //~ ERROR `panic` is ambiguous LL | panic!(); //~ ERROR `panic` is ambiguous
| ^^^^^ | ^^^^^ ambiguous name
| |
note: `panic` could refer to the name defined here note: `panic` could refer to the name defined here
--> $DIR/shadow_builtin_macros.rs:40:9 --> $DIR/shadow_builtin_macros.rs:40:9
@ -19,7 +19,7 @@ error[E0659]: `panic` is ambiguous
--> $DIR/shadow_builtin_macros.rs:25:14 --> $DIR/shadow_builtin_macros.rs:25:14
| |
LL | fn f() { panic!(); } //~ ERROR ambiguous LL | fn f() { panic!(); } //~ ERROR ambiguous
| ^^^^^ | ^^^^^ ambiguous name
| |
note: `panic` could refer to the name imported here note: `panic` could refer to the name imported here
--> $DIR/shadow_builtin_macros.rs:24:9 --> $DIR/shadow_builtin_macros.rs:24:9
@ -33,7 +33,7 @@ error[E0659]: `panic` is ambiguous
--> $DIR/shadow_builtin_macros.rs:30:14 --> $DIR/shadow_builtin_macros.rs:30:14
| |
LL | fn f() { panic!(); } //~ ERROR ambiguous LL | fn f() { panic!(); } //~ ERROR ambiguous
| ^^^^^ | ^^^^^ ambiguous name
| |
note: `panic` could refer to the name imported here note: `panic` could refer to the name imported here
--> $DIR/shadow_builtin_macros.rs:29:26 --> $DIR/shadow_builtin_macros.rs:29:26
@ -47,7 +47,7 @@ error[E0659]: `n` is ambiguous
--> $DIR/shadow_builtin_macros.rs:59:5 --> $DIR/shadow_builtin_macros.rs:59:5
| |
LL | n!(); //~ ERROR ambiguous LL | n!(); //~ ERROR ambiguous
| ^ | ^ ambiguous name
| |
note: `n` could refer to the name imported here note: `n` could refer to the name imported here
--> $DIR/shadow_builtin_macros.rs:58:9 --> $DIR/shadow_builtin_macros.rs:58:9

View file

@ -2,7 +2,7 @@ error[E0659]: `std` is ambiguous
--> $DIR/macro-path-prelude-shadowing.rs:39:9 --> $DIR/macro-path-prelude-shadowing.rs:39:9
| |
LL | std::panic!(); //~ ERROR `std` is ambiguous LL | std::panic!(); //~ ERROR `std` is ambiguous
| ^^^^^^^^^^ | ^^^ ambiguous name
| |
note: `std` could refer to the name imported here note: `std` could refer to the name imported here
--> $DIR/macro-path-prelude-shadowing.rs:37:9 --> $DIR/macro-path-prelude-shadowing.rs:37:9

View file

@ -13,7 +13,7 @@ error[E0659]: `foo` is ambiguous
--> $DIR/macro-shadowing.rs:27:1 --> $DIR/macro-shadowing.rs:27:1
| |
LL | foo!(); //~ ERROR `foo` is ambiguous LL | foo!(); //~ ERROR `foo` is ambiguous
| ^^^ | ^^^ ambiguous name
| |
note: `foo` could refer to the name defined here note: `foo` could refer to the name defined here
--> $DIR/macro-shadowing.rs:20:5 --> $DIR/macro-shadowing.rs:20:5

View file

@ -2,7 +2,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:101:13 --> $DIR/restricted-shadowing-legacy.rs:101:13
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -26,7 +26,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:139:42 --> $DIR/restricted-shadowing-legacy.rs:139:42
| |
LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -50,7 +50,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:148:9 --> $DIR/restricted-shadowing-legacy.rs:148:9
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -74,7 +74,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:164:9 --> $DIR/restricted-shadowing-legacy.rs:164:9
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -98,7 +98,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:180:13 --> $DIR/restricted-shadowing-legacy.rs:180:13
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -122,7 +122,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:218:42 --> $DIR/restricted-shadowing-legacy.rs:218:42
| |
LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -146,7 +146,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:232:9 --> $DIR/restricted-shadowing-legacy.rs:232:9
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9
@ -170,7 +170,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-legacy.rs:262:42 --> $DIR/restricted-shadowing-legacy.rs:262:42
| |
LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-legacy.rs:88:9 --> $DIR/restricted-shadowing-legacy.rs:88:9

View file

@ -2,10 +2,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-modern.rs:106:17 --> $DIR/restricted-shadowing-modern.rs:106:17
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
...
LL | include!();
| ----------- in this macro invocation
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-modern.rs:91:9 --> $DIR/restricted-shadowing-modern.rs:91:9
@ -29,10 +26,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-modern.rs:149:33 --> $DIR/restricted-shadowing-modern.rs:149:33
| |
LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
...
LL | include!();
| ----------- in this macro invocation
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-modern.rs:91:9 --> $DIR/restricted-shadowing-modern.rs:91:9
@ -56,10 +50,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-modern.rs:158:13 --> $DIR/restricted-shadowing-modern.rs:158:13
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
...
LL | include!();
| ----------- in this macro invocation
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-modern.rs:91:9 --> $DIR/restricted-shadowing-modern.rs:91:9
@ -83,10 +74,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-modern.rs:174:13 --> $DIR/restricted-shadowing-modern.rs:174:13
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
...
LL | include!();
| ----------- in this macro invocation
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-modern.rs:91:9 --> $DIR/restricted-shadowing-modern.rs:91:9
@ -110,10 +98,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-modern.rs:192:17 --> $DIR/restricted-shadowing-modern.rs:192:17
| |
LL | m!(); //~ ERROR `m` is ambiguous LL | m!(); //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
...
LL | include!();
| ----------- in this macro invocation
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-modern.rs:91:9 --> $DIR/restricted-shadowing-modern.rs:91:9
@ -137,10 +122,7 @@ error[E0659]: `m` is ambiguous
--> $DIR/restricted-shadowing-modern.rs:235:33 --> $DIR/restricted-shadowing-modern.rs:235:33
| |
LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous
| ^ | ^ ambiguous name
...
LL | include!();
| ----------- in this macro invocation
| |
note: `m` could refer to the name defined here note: `m` could refer to the name defined here
--> $DIR/restricted-shadowing-modern.rs:91:9 --> $DIR/restricted-shadowing-modern.rs:91:9

View file

@ -2,7 +2,7 @@ error[E0659]: `bar` is ambiguous
--> $DIR/out-of-order-shadowing.rs:15:1 --> $DIR/out-of-order-shadowing.rs:15:1
| |
LL | bar!(); //~ ERROR `bar` is ambiguous LL | bar!(); //~ ERROR `bar` is ambiguous
| ^^^ | ^^^ ambiguous name
| |
note: `bar` could refer to the name defined here note: `bar` could refer to the name defined here
--> $DIR/out-of-order-shadowing.rs:14:1 --> $DIR/out-of-order-shadowing.rs:14:1