forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#96384 - lcnr:extern-types-similar, r=compil…
…er-errors do not consider two extern types to be similar
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |