about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYiming Lei <yiming.lei@futurewei.com>2022-12-15 22:25:11 -0800
committerYiming Lei <yiming.lei@futurewei.com>2022-12-19 08:38:05 -0800
commitbd12d151ee63290b317566db770465301e2dd2a9 (patch)
treec831c993781eaceeace9a04cf35c9023db0253d9 /src
parentba64ba8b0dfd57f7d6d7399d0df7ded37d2af18d (diff)
downloadrust-bd12d151ee63290b317566db770465301e2dd2a9.tar.gz
rust-bd12d151ee63290b317566db770465301e2dd2a9.zip
add function to tell if the current ambiguity error matches a previous one in ambiguity_errors
if 2 errors of the kind and ident and span of the ident, b1, b2 and misc1 misc2 are the same
then these 2 ambiguity errors matched
prevent identical ambiguity error from pushing into vector of ambiguity_errors
this will fix #105177
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/imports/local-modularized-tricky-fail-1.rs1
-rw-r--r--src/test/ui/imports/local-modularized-tricky-fail-1.stderr31
-rw-r--r--src/test/ui/imports/macros.rs1
-rw-r--r--src/test/ui/imports/macros.stderr29
4 files changed, 8 insertions, 54 deletions
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.rs b/src/test/ui/imports/local-modularized-tricky-fail-1.rs
index 37fe0eceed6..29e9b8ec841 100644
--- a/src/test/ui/imports/local-modularized-tricky-fail-1.rs
+++ b/src/test/ui/imports/local-modularized-tricky-fail-1.rs
@@ -26,7 +26,6 @@ mod inner1 {
 }
 
 exported!(); //~ ERROR `exported` is ambiguous
-             //~| ERROR `exported` is ambiguous
 
 mod inner2 {
     define_exported!();
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr
index c048d2ea204..20eadaaaa56 100644
--- a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr
+++ b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr
@@ -23,33 +23,8 @@ LL | use inner1::*;
    = help: consider adding an explicit import of `exported` to disambiguate
    = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0659]: `exported` is ambiguous
-  --> $DIR/local-modularized-tricky-fail-1.rs:28:1
-   |
-LL | exported!();
-   | ^^^^^^^^ ambiguous name
-   |
-   = note: ambiguous because of a conflict between a name from a glob import and a macro-expanded name in the same module during import or macro resolution
-note: `exported` could refer to the macro defined here
-  --> $DIR/local-modularized-tricky-fail-1.rs:5:5
-   |
-LL | /     macro_rules! exported {
-LL | |         () => ()
-LL | |     }
-   | |_____^
-...
-LL |       define_exported!();
-   |       ------------------ in this macro invocation
-note: `exported` could also refer to the macro imported here
-  --> $DIR/local-modularized-tricky-fail-1.rs:22:5
-   |
-LL | use inner1::*;
-   |     ^^^^^^^^^
-   = help: consider adding an explicit import of `exported` to disambiguate
-   = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info)
-
 error[E0659]: `panic` is ambiguous
-  --> $DIR/local-modularized-tricky-fail-1.rs:36:5
+  --> $DIR/local-modularized-tricky-fail-1.rs:35:5
    |
 LL |     panic!();
    |     ^^^^^ ambiguous name
@@ -70,7 +45,7 @@ LL |       define_panic!();
    = note: this error originates in the macro `define_panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `include` is ambiguous
-  --> $DIR/local-modularized-tricky-fail-1.rs:47:1
+  --> $DIR/local-modularized-tricky-fail-1.rs:46:1
    |
 LL | include!();
    | ^^^^^^^ ambiguous name
@@ -90,6 +65,6 @@ LL |       define_include!();
    = help: use `crate::include` to refer to this macro unambiguously
    = note: this error originates in the macro `define_include` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/imports/macros.rs b/src/test/ui/imports/macros.rs
index f39711898cd..f2a22ad620b 100644
--- a/src/test/ui/imports/macros.rs
+++ b/src/test/ui/imports/macros.rs
@@ -14,7 +14,6 @@ mod m1 {
 mod m2 {
     use two_macros::*;
     m! { //~ ERROR ambiguous
-         //~| ERROR ambiguous
         use foo::m;
     }
 }
diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr
index 110548d1d6a..e34e5359b48 100644
--- a/src/test/ui/imports/macros.stderr
+++ b/src/test/ui/imports/macros.stderr
@@ -6,7 +6,7 @@ LL |     m! {
    |
    = note: ambiguous because of a conflict between a name from a glob import and a macro-expanded name in the same module during import or macro resolution
 note: `m` could refer to the macro imported here
-  --> $DIR/macros.rs:18:13
+  --> $DIR/macros.rs:17:13
    |
 LL |         use foo::m;
    |             ^^^^^^
@@ -18,43 +18,24 @@ LL |     use two_macros::*;
    = help: consider adding an explicit import of `m` to disambiguate
 
 error[E0659]: `m` is ambiguous
-  --> $DIR/macros.rs:16:5
-   |
-LL |     m! {
-   |     ^ ambiguous name
-   |
-   = note: ambiguous because of a conflict between a name from a glob import and a macro-expanded name in the same module during import or macro resolution
-note: `m` could refer to the macro imported here
-  --> $DIR/macros.rs:18:13
-   |
-LL |         use foo::m;
-   |             ^^^^^^
-note: `m` could also refer to the macro imported here
-  --> $DIR/macros.rs:15:9
-   |
-LL |     use two_macros::*;
-   |         ^^^^^^^^^^^^^
-   = help: consider adding an explicit import of `m` to disambiguate
-
-error[E0659]: `m` is ambiguous
-  --> $DIR/macros.rs:30:9
+  --> $DIR/macros.rs:29:9
    |
 LL |         m! {
    |         ^ ambiguous name
    |
    = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
 note: `m` could refer to the macro imported here
-  --> $DIR/macros.rs:31:17
+  --> $DIR/macros.rs:30:17
    |
 LL |             use two_macros::n as m;
    |                 ^^^^^^^^^^^^^^^^^^
 note: `m` could also refer to the macro imported here
-  --> $DIR/macros.rs:23:9
+  --> $DIR/macros.rs:22:9
    |
 LL |     use two_macros::m;
    |         ^^^^^^^^^^^^^
    = help: use `self::m` to refer to this macro unambiguously
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0659`.