about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-07-11 00:33:49 +0200
committerGitHub <noreply@github.com>2022-07-11 00:33:49 +0200
commit16d0d0b7f177e2df55684c1a810ea25d4b6dcd50 (patch)
tree695bc1b152e91dd935c2ab9fe6c249b29ee5b25b /src/test
parent342b666d59cea95ce21930aa8e1254dbd76eae10 (diff)
parentd5aed20f4712010585532b4de51918bd66ac4797 (diff)
downloadrust-16d0d0b7f177e2df55684c1a810ea25d4b6dcd50.tar.gz
rust-16d0d0b7f177e2df55684c1a810ea25d4b6dcd50.zip
Rollup merge of #99095 - rhysd:issue-99092, r=compiler-errors
Remove duplicate notes from error on inter-crate ambiguous impl of traits

Fixes #99092
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/coherence/coherence-projection-conflict-orphan.stderr1
-rw-r--r--src/test/ui/coherence/inter-crate-ambiguity-causes-notes.rs19
-rw-r--r--src/test/ui/coherence/inter-crate-ambiguity-causes-notes.stderr14
3 files changed, 33 insertions, 1 deletions
diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr
index 8e7d4589e61..b1ee0795b2e 100644
--- a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr
+++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr
@@ -8,7 +8,6 @@ LL | impl<A:Iterator> Foo<A::Item> for A { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
    |
    = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `i32` in future versions
-   = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `i32` in future versions
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/coherence/inter-crate-ambiguity-causes-notes.rs b/src/test/ui/coherence/inter-crate-ambiguity-causes-notes.rs
new file mode 100644
index 00000000000..5b11c78ab26
--- /dev/null
+++ b/src/test/ui/coherence/inter-crate-ambiguity-causes-notes.rs
@@ -0,0 +1,19 @@
+struct S;
+
+impl From<()> for S {
+    fn from(x: ()) -> Self {
+        S
+    }
+}
+
+impl<I> From<I> for S
+//~^ ERROR conflicting implementations of trait
+where
+    I: Iterator<Item = ()>,
+{
+    fn from(x: I) -> Self {
+        S
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/inter-crate-ambiguity-causes-notes.stderr b/src/test/ui/coherence/inter-crate-ambiguity-causes-notes.stderr
new file mode 100644
index 00000000000..038a0199a8f
--- /dev/null
+++ b/src/test/ui/coherence/inter-crate-ambiguity-causes-notes.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `std::convert::From<()>` for type `S`
+  --> $DIR/inter-crate-ambiguity-causes-notes.rs:9:1
+   |
+LL | impl From<()> for S {
+   | ------------------- first implementation here
+...
+LL | impl<I> From<I> for S
+   | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+   |
+   = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.