diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-26 01:21:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-26 01:21:24 +0200 |
| commit | f0b2dccc2161a6d17effb63232b1dce885f5305e (patch) | |
| tree | 06097dbd41c123e3fdf0a25e31482a5fad68d4fa /src | |
| parent | 8038a9ece34a24b5722ea11f6918e4329276cdac (diff) | |
| parent | 5594db097540d831cb7d98a662c7f3df7011411b (diff) | |
| download | rust-f0b2dccc2161a6d17effb63232b1dce885f5305e.tar.gz rust-f0b2dccc2161a6d17effb63232b1dce885f5305e.zip | |
Rollup merge of #96384 - lcnr:extern-types-similar, r=compiler-errors
do not consider two extern types to be similar
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/extern/extern-type-diag-not-similar.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/extern/extern-type-diag-not-similar.stderr | 16 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/test/ui/extern/extern-type-diag-not-similar.rs b/src/test/ui/extern/extern-type-diag-not-similar.rs new file mode 100644 index 00000000000..39d00a6c1bc --- /dev/null +++ b/src/test/ui/extern/extern-type-diag-not-similar.rs @@ -0,0 +1,22 @@ +// We previously mentioned other extern types in the error message here. +// +// Two extern types shouldn't really be considered similar just +// because they are both extern types. + +#![feature(extern_types)] +extern { + type ShouldNotBeMentioned; +} + +extern { + type Foo; +} + +unsafe impl Send for ShouldNotBeMentioned {} + +fn assert_send<T: Send + ?Sized>() {} + +fn main() { + assert_send::<Foo>() + //~^ ERROR `Foo` cannot be sent between threads safely +} diff --git a/src/test/ui/extern/extern-type-diag-not-similar.stderr b/src/test/ui/extern/extern-type-diag-not-similar.stderr new file mode 100644 index 00000000000..75836f7eca1 --- /dev/null +++ b/src/test/ui/extern/extern-type-diag-not-similar.stderr @@ -0,0 +1,16 @@ +error[E0277]: `Foo` cannot be sent between threads safely + --> $DIR/extern-type-diag-not-similar.rs:20:19 + | +LL | assert_send::<Foo>() + | ^^^ `Foo` cannot be sent between threads safely + | + = help: the trait `Send` is not implemented for `Foo` +note: required by a bound in `assert_send` + --> $DIR/extern-type-diag-not-similar.rs:17:19 + | +LL | fn assert_send<T: Send + ?Sized>() {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
