about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorrhysd <lin90162@yahoo.co.jp>2022-07-10 02:48:53 +0900
committerrhysd <lin90162@yahoo.co.jp>2022-07-10 16:39:12 +0900
commitd5aed20f4712010585532b4de51918bd66ac4797 (patch)
treed3746cf8f8bb731c6f4d1bcbd4f5270770efcd3b /src/test
parent6c20ab744b0f82646d90ce9d25894823abc9c669 (diff)
downloadrust-d5aed20f4712010585532b4de51918bd66ac4797.tar.gz
rust-d5aed20f4712010585532b4de51918bd66ac4797.zip
Remove duplicate notes from error on inter-crate ambiguous impl of traits (fix #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`.