summaryrefslogtreecommitdiffstats
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0057.stderr9
-rw-r--r--tests/ui/error-codes/E0071.rs2
-rw-r--r--tests/ui/error-codes/E0071.stderr2
-rw-r--r--tests/ui/error-codes/E0107.rs20
-rw-r--r--tests/ui/error-codes/E0107.stderr20
-rw-r--r--tests/ui/error-codes/E0116.stderr2
-rw-r--r--tests/ui/error-codes/E0118.stderr4
-rw-r--r--tests/ui/error-codes/E0208.rs2
-rw-r--r--tests/ui/error-codes/E0208.stderr2
-rw-r--r--tests/ui/error-codes/E0390.stderr8
-rw-r--r--tests/ui/error-codes/E0476.rs13
-rw-r--r--tests/ui/error-codes/E0476.stderr31
-rw-r--r--tests/ui/error-codes/E0503.stderr2
-rw-r--r--tests/ui/error-codes/E0504.stderr2
-rw-r--r--tests/ui/error-codes/E0505.stderr3
-rw-r--r--tests/ui/error-codes/E0506.stderr4
-rw-r--r--tests/ui/error-codes/E0520.stderr2
-rw-r--r--tests/ui/error-codes/E0523.rs14
-rw-r--r--tests/ui/error-codes/E0523.stderr13
-rw-r--r--tests/ui/error-codes/E0597.stderr2
-rw-r--r--tests/ui/error-codes/E0624.rs2
-rw-r--r--tests/ui/error-codes/E0624.stderr6
-rw-r--r--tests/ui/error-codes/E0789.rs12
-rw-r--r--tests/ui/error-codes/E0789.stderr15
24 files changed, 148 insertions, 44 deletions
diff --git a/tests/ui/error-codes/E0057.stderr b/tests/ui/error-codes/E0057.stderr
index 163737895..9b0cf0698 100644
--- a/tests/ui/error-codes/E0057.stderr
+++ b/tests/ui/error-codes/E0057.stderr
@@ -18,17 +18,16 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/E0057.rs:5:13
|
LL | let c = f(2, 3);
- | ^ - argument of type `{integer}` unexpected
+ | ^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
|
note: closure defined here
--> $DIR/E0057.rs:2:13
|
LL | let f = |x| x * 3;
| ^^^
-help: remove the extra argument
- |
-LL | let c = f(2);
- | ~~~
error: aborting due to 2 previous errors
diff --git a/tests/ui/error-codes/E0071.rs b/tests/ui/error-codes/E0071.rs
index bd8469de7..678502ba3 100644
--- a/tests/ui/error-codes/E0071.rs
+++ b/tests/ui/error-codes/E0071.rs
@@ -3,5 +3,5 @@ type FooAlias = Foo;
fn main() {
let u = FooAlias { value: 0 };
- //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071]
+ //~^ ERROR expected struct, variant or union type, found `Foo` [E0071]
}
diff --git a/tests/ui/error-codes/E0071.stderr b/tests/ui/error-codes/E0071.stderr
index ae312fc40..7bd4ddaf2 100644
--- a/tests/ui/error-codes/E0071.stderr
+++ b/tests/ui/error-codes/E0071.stderr
@@ -1,4 +1,4 @@
-error[E0071]: expected struct, variant or union type, found enum `Foo`
+error[E0071]: expected struct, variant or union type, found `Foo`
--> $DIR/E0071.rs:5:13
|
LL | let u = FooAlias { value: 0 };
diff --git a/tests/ui/error-codes/E0107.rs b/tests/ui/error-codes/E0107.rs
index d369fc2a5..fd23e7c00 100644
--- a/tests/ui/error-codes/E0107.rs
+++ b/tests/ui/error-codes/E0107.rs
@@ -11,39 +11,39 @@ enum Bar {
struct Baz<'a, 'b, 'c> {
buzz: Buzz<'a>,
- //~^ ERROR this struct takes 2 lifetime arguments
+ //~^ ERROR struct takes 2 lifetime arguments
//~| HELP add missing lifetime argument
bar: Bar<'a>,
- //~^ ERROR this enum takes 0 lifetime arguments
+ //~^ ERROR enum takes 0 lifetime arguments
//~| HELP remove these generics
foo2: Foo<'a, 'b, 'c>,
- //~^ ERROR this struct takes 1 lifetime argument
+ //~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
qux1: Qux<'a, 'b, i32>,
- //~^ ERROR this struct takes 1 lifetime argument
+ //~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
qux2: Qux<'a, i32, 'b>,
- //~^ ERROR this struct takes 1 lifetime argument
+ //~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
qux3: Qux<'a, 'b, 'c, i32>,
- //~^ ERROR this struct takes 1 lifetime argument
+ //~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
qux4: Qux<'a, i32, 'b, 'c>,
- //~^ ERROR this struct takes 1 lifetime argument
+ //~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
qux5: Qux<'a, 'b, i32, 'c>,
- //~^ ERROR this struct takes 1 lifetime argument
+ //~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
quux: Quux<'a, i32, 'b>,
- //~^ ERROR this struct takes 0 lifetime arguments
+ //~^ ERROR struct takes 0 lifetime arguments
//~| HELP remove this lifetime argument
}
@@ -53,7 +53,7 @@ pub trait T {
}
fn trait_bound_generic<I: T<u8, u16>>(_i: I) {
- //~^ ERROR this trait takes 0 generic arguments
+ //~^ ERROR trait takes 0 generic arguments
//~| HELP replace the generic bounds with the associated types
}
diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr
index 03430f8fa..3f540eb08 100644
--- a/tests/ui/error-codes/E0107.stderr
+++ b/tests/ui/error-codes/E0107.stderr
@@ -1,4 +1,4 @@
-error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
+error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/E0107.rs:13:11
|
LL | buzz: Buzz<'a>,
@@ -16,7 +16,7 @@ help: add missing lifetime argument
LL | buzz: Buzz<'a, 'a>,
| ++++
-error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
+error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/E0107.rs:17:10
|
LL | bar: Bar<'a>,
@@ -30,7 +30,7 @@ note: enum defined here, with 0 lifetime parameters
LL | enum Bar {
| ^^^
-error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:21:11
|
LL | foo2: Foo<'a, 'b, 'c>,
@@ -44,7 +44,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Foo<'a>(&'a str);
| ^^^ --
-error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
+error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:25:11
|
LL | qux1: Qux<'a, 'b, i32>,
@@ -58,7 +58,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
-error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
+error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:29:11
|
LL | qux2: Qux<'a, i32, 'b>,
@@ -72,7 +72,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
-error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:33:11
|
LL | qux3: Qux<'a, 'b, 'c, i32>,
@@ -86,7 +86,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
-error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:37:11
|
LL | qux4: Qux<'a, i32, 'b, 'c>,
@@ -100,7 +100,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
-error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:41:11
|
LL | qux5: Qux<'a, 'b, i32, 'c>,
@@ -114,7 +114,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
-error[E0107]: this struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
+error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:45:11
|
LL | quux: Quux<'a, i32, 'b>,
@@ -128,7 +128,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct Quux<T>(T);
| ^^^^
-error[E0107]: this trait takes 0 generic arguments but 2 generic arguments were supplied
+error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied
--> $DIR/E0107.rs:55:27
|
LL | fn trait_bound_generic<I: T<u8, u16>>(_i: I) {
diff --git a/tests/ui/error-codes/E0116.stderr b/tests/ui/error-codes/E0116.stderr
index a5ceeb4a5..8a0276867 100644
--- a/tests/ui/error-codes/E0116.stderr
+++ b/tests/ui/error-codes/E0116.stderr
@@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
--> $DIR/E0116.rs:1:1
|
LL | impl Vec<u8> {}
- | ^^^^^^^^^^^^^^^ impl for type defined outside of crate.
+ | ^^^^^^^^^^^^ impl for type defined outside of crate.
|
= note: define and implement a trait or new type instead
diff --git a/tests/ui/error-codes/E0118.stderr b/tests/ui/error-codes/E0118.stderr
index 8c6fa7947..442f8a4f8 100644
--- a/tests/ui/error-codes/E0118.stderr
+++ b/tests/ui/error-codes/E0118.stderr
@@ -1,8 +1,8 @@
error[E0118]: no nominal type found for inherent implementation
- --> $DIR/E0118.rs:1:9
+ --> $DIR/E0118.rs:1:1
|
LL | impl<T> T {
- | ^ impl requires a nominal type
+ | ^^^^^^^^^ impl requires a nominal type
|
= note: either implement a trait on it or create a newtype to wrap it instead
diff --git a/tests/ui/error-codes/E0208.rs b/tests/ui/error-codes/E0208.rs
index c67d42889..74c138af4 100644
--- a/tests/ui/error-codes/E0208.rs
+++ b/tests/ui/error-codes/E0208.rs
@@ -1,7 +1,7 @@
#![feature(rustc_attrs)]
#[rustc_variance]
-struct Foo<'a, T> { //~ ERROR [-, o]
+struct Foo<'a, T> { //~ ERROR [+, o]
t: &'a mut T,
}
diff --git a/tests/ui/error-codes/E0208.stderr b/tests/ui/error-codes/E0208.stderr
index dbbb41e79..2c7072a7e 100644
--- a/tests/ui/error-codes/E0208.stderr
+++ b/tests/ui/error-codes/E0208.stderr
@@ -1,4 +1,4 @@
-error: [-, o]
+error: [+, o]
--> $DIR/E0208.rs:4:1
|
LL | struct Foo<'a, T> {
diff --git a/tests/ui/error-codes/E0390.stderr b/tests/ui/error-codes/E0390.stderr
index 0e5a9ca76..ec4b5758c 100644
--- a/tests/ui/error-codes/E0390.stderr
+++ b/tests/ui/error-codes/E0390.stderr
@@ -1,16 +1,16 @@
error[E0390]: cannot define inherent `impl` for primitive types
- --> $DIR/E0390.rs:5:6
+ --> $DIR/E0390.rs:5:1
|
LL | impl *mut Foo {}
- | ^^^^^^^^
+ | ^^^^^^^^^^^^^
|
= help: consider using an extension trait instead
error[E0390]: cannot define inherent `impl` for primitive types
- --> $DIR/E0390.rs:7:6
+ --> $DIR/E0390.rs:7:1
|
LL | impl fn(Foo) {}
- | ^^^^^^^
+ | ^^^^^^^^^^^^
|
= help: consider using an extension trait instead
diff --git a/tests/ui/error-codes/E0476.rs b/tests/ui/error-codes/E0476.rs
new file mode 100644
index 000000000..d5e4b8d23
--- /dev/null
+++ b/tests/ui/error-codes/E0476.rs
@@ -0,0 +1,13 @@
+#![feature(coerce_unsized)]
+#![feature(unsize)]
+
+use std::marker::Unsize;
+use std::ops::CoerceUnsized;
+
+struct Wrapper<T>(T);
+
+impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
+//~^ ERROR lifetime of the source pointer does not outlive lifetime bound of the object type [E0476]
+//~^^ ERROR E0119
+
+fn main() {}
diff --git a/tests/ui/error-codes/E0476.stderr b/tests/ui/error-codes/E0476.stderr
new file mode 100644
index 000000000..a4bb26532
--- /dev/null
+++ b/tests/ui/error-codes/E0476.stderr
@@ -0,0 +1,31 @@
+error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>` for type `&Wrapper<_>`
+ --> $DIR/E0476.rs:9:1
+ |
+LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: conflicting implementation in crate `core`:
+ - impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T
+ where 'b: 'a, T: Unsize<U>, T: ?Sized, U: ?Sized;
+
+error[E0476]: lifetime of the source pointer does not outlive lifetime bound of the object type
+ --> $DIR/E0476.rs:9:1
+ |
+LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: object type is valid for the lifetime `'a` as defined here
+ --> $DIR/E0476.rs:9:6
+ |
+LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
+ | ^^
+note: source pointer is only valid for the lifetime `'b` as defined here
+ --> $DIR/E0476.rs:9:10
+ |
+LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
+ | ^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0119, E0476.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/error-codes/E0503.stderr b/tests/ui/error-codes/E0503.stderr
index fafe363eb..2f02e3b1a 100644
--- a/tests/ui/error-codes/E0503.stderr
+++ b/tests/ui/error-codes/E0503.stderr
@@ -2,7 +2,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed
--> $DIR/E0503.rs:4:16
|
LL | let _borrow = &mut value;
- | ---------- borrow of `value` occurs here
+ | ---------- `value` is borrowed here
LL | let _sum = value + 1;
| ^^^^^ use of borrowed `value`
LL | _borrow.use_mut();
diff --git a/tests/ui/error-codes/E0504.stderr b/tests/ui/error-codes/E0504.stderr
index e677e8916..20e16a538 100644
--- a/tests/ui/error-codes/E0504.stderr
+++ b/tests/ui/error-codes/E0504.stderr
@@ -1,6 +1,8 @@
error[E0505]: cannot move out of `fancy_num` because it is borrowed
--> $DIR/E0504.rs:9:13
|
+LL | let fancy_num = FancyNum { num: 5 };
+ | --------- binding `fancy_num` declared here
LL | let fancy_ref = &fancy_num;
| ---------- borrow of `fancy_num` occurs here
LL |
diff --git a/tests/ui/error-codes/E0505.stderr b/tests/ui/error-codes/E0505.stderr
index bd3f37f54..2ecb4a75c 100644
--- a/tests/ui/error-codes/E0505.stderr
+++ b/tests/ui/error-codes/E0505.stderr
@@ -1,6 +1,9 @@
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/E0505.rs:9:13
|
+LL | let x = Value{};
+ | - binding `x` declared here
+LL | {
LL | let _ref_to_val: &Value = &x;
| -- borrow of `x` occurs here
LL | eat(x);
diff --git a/tests/ui/error-codes/E0506.stderr b/tests/ui/error-codes/E0506.stderr
index d70406b75..17ad7c611 100644
--- a/tests/ui/error-codes/E0506.stderr
+++ b/tests/ui/error-codes/E0506.stderr
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed
--> $DIR/E0506.rs:8:5
|
LL | let fancy_ref = &fancy_num;
- | ---------- borrow of `fancy_num` occurs here
+ | ---------- `fancy_num` is borrowed here
LL | fancy_num = FancyNum { num: 6 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `fancy_num` is assigned to here but it was already borrowed
LL |
LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
| ------------- borrow later used here
diff --git a/tests/ui/error-codes/E0520.stderr b/tests/ui/error-codes/E0520.stderr
index 12ecead13..06658a49b 100644
--- a/tests/ui/error-codes/E0520.stderr
+++ b/tests/ui/error-codes/E0520.stderr
@@ -15,7 +15,7 @@ LL | impl<T: Clone> SpaceLlama for T {
| ------------------------------- parent `impl` is here
...
LL | default fn fly(&self) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly`
+ | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly`
|
= note: to specialize, `fly` in the parent `impl` must be marked `default`
diff --git a/tests/ui/error-codes/E0523.rs b/tests/ui/error-codes/E0523.rs
new file mode 100644
index 000000000..47717fbd5
--- /dev/null
+++ b/tests/ui/error-codes/E0523.rs
@@ -0,0 +1,14 @@
+// aux-build:crateresolve1-1.rs
+// aux-build:crateresolve1-2.rs
+// aux-build:crateresolve1-3.rs
+
+// normalize-stderr-test: "\.nll/" -> "/"
+// normalize-stderr-test: "\\\?\\" -> ""
+// normalize-stderr-test: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib"
+
+// NOTE: This test is duplicated from `tests/ui/crate-loading/crateresolve1.rs`.
+
+extern crate crateresolve1;
+//~^ ERROR multiple candidates for `rlib` dependency `crateresolve1` found
+
+fn main() {}
diff --git a/tests/ui/error-codes/E0523.stderr b/tests/ui/error-codes/E0523.stderr
new file mode 100644
index 000000000..8e3eb2159
--- /dev/null
+++ b/tests/ui/error-codes/E0523.stderr
@@ -0,0 +1,13 @@
+error[E0464]: multiple candidates for `rlib` dependency `crateresolve1` found
+ --> $DIR/E0523.rs:11:1
+ |
+LL | extern crate crateresolve1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: candidate #1: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-1.somelib
+ = note: candidate #2: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-2.somelib
+ = note: candidate #3: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-3.somelib
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0464`.
diff --git a/tests/ui/error-codes/E0597.stderr b/tests/ui/error-codes/E0597.stderr
index b4a1180ad..82e3481b6 100644
--- a/tests/ui/error-codes/E0597.stderr
+++ b/tests/ui/error-codes/E0597.stderr
@@ -1,6 +1,8 @@
error[E0597]: `y` does not live long enough
--> $DIR/E0597.rs:8:16
|
+LL | let y = 0;
+ | - binding `y` declared here
LL | x.x = Some(&y);
| ^^ borrowed value does not live long enough
LL |
diff --git a/tests/ui/error-codes/E0624.rs b/tests/ui/error-codes/E0624.rs
index 4c68b70fb..45f72a565 100644
--- a/tests/ui/error-codes/E0624.rs
+++ b/tests/ui/error-codes/E0624.rs
@@ -8,5 +8,5 @@ mod inner {
fn main() {
let foo = inner::Foo;
- foo.method(); //~ ERROR associated function `method` is private [E0624]
+ foo.method(); //~ ERROR method `method` is private [E0624]
}
diff --git a/tests/ui/error-codes/E0624.stderr b/tests/ui/error-codes/E0624.stderr
index e59b8a8ae..23a8ea8a8 100644
--- a/tests/ui/error-codes/E0624.stderr
+++ b/tests/ui/error-codes/E0624.stderr
@@ -1,11 +1,11 @@
-error[E0624]: associated function `method` is private
+error[E0624]: method `method` is private
--> $DIR/E0624.rs:11:9
|
LL | fn method(&self) {}
- | ---------------- private associated function defined here
+ | ---------------- private method defined here
...
LL | foo.method();
- | ^^^^^^ private associated function
+ | ^^^^^^ private method
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0789.rs b/tests/ui/error-codes/E0789.rs
new file mode 100644
index 000000000..c0cbbcc9d
--- /dev/null
+++ b/tests/ui/error-codes/E0789.rs
@@ -0,0 +1,12 @@
+// compile-flags: --crate-type lib
+
+#![feature(rustc_attrs)]
+#![feature(staged_api)]
+#![unstable(feature = "foo_module", reason = "...", issue = "123")]
+
+#[rustc_allowed_through_unstable_modules]
+// #[stable(feature = "foo", since = "1.0")]
+struct Foo;
+//~^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute
+//~^^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute
+// FIXME: we shouldn't have two errors here, only occurs when using `-Zdeduplicate-diagnostics=no`
diff --git a/tests/ui/error-codes/E0789.stderr b/tests/ui/error-codes/E0789.stderr
new file mode 100644
index 000000000..faab92bae
--- /dev/null
+++ b/tests/ui/error-codes/E0789.stderr
@@ -0,0 +1,15 @@
+error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute
+ --> $DIR/E0789.rs:9:1
+ |
+LL | struct Foo;
+ | ^^^^^^^^^^^
+
+error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute
+ --> $DIR/E0789.rs:9:1
+ |
+LL | struct Foo;
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0789`.