Skip to content

Commit 4ed3257

Browse files
committed
Add a test that emitting diagnostics does not require the crate to use
the corresponding feature.
1 parent 3350e5b commit 4ed3257

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(diagnostic_namespace)]
2+
3+
#[diagnostic::on_unimplemented(
4+
message = "Message",
5+
note = "Note",
6+
label = "label"
7+
)]
8+
pub trait Foo {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// aux-build:other.rs
2+
3+
extern crate other;
4+
5+
use other::Foo;
6+
7+
fn take_foo(_: impl Foo) {}
8+
9+
fn main() {
10+
take_foo(());
11+
//~^ERROR Message
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0277]: Message
2+
--> $DIR/error_is_shown_in_downstream_crates.rs:10:14
3+
|
4+
LL | take_foo(());
5+
| -------- ^^ label
6+
| |
7+
| required by a bound introduced by this call
8+
|
9+
= help: the trait `Foo` is not implemented for `()`
10+
= note: Note
11+
note: required by a bound in `take_foo`
12+
--> $DIR/error_is_shown_in_downstream_crates.rs:7:21
13+
|
14+
LL | fn take_foo(_: impl Foo) {}
15+
| ^^^ required by this bound in `take_foo`
16+
17+
error: aborting due to 1 previous error
18+
19+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)