-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
1 deletion.
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
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,17 @@ | ||
// Regression test for #80468. | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub trait Trait {} | ||
|
||
#[repr(transparent)] | ||
pub struct Wrapper<T: Trait>(T); | ||
|
||
#[repr(transparent)] | ||
pub struct Ref<'a>(&'a u8); | ||
|
||
impl Trait for Ref {} //~ ERROR: implicit elided lifetime not allowed here | ||
|
||
extern "C" { | ||
pub fn repro(_: Wrapper<Ref>); //~ ERROR: mismatched types | ||
} |
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,24 @@ | ||
error[E0726]: implicit elided lifetime not allowed here | ||
--> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:13:16 | ||
| | ||
LL | impl Trait for Ref {} | ||
| ^^^- help: indicate the anonymous lifetime: `<'_>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:21 | ||
| | ||
LL | pub fn repro(_: Wrapper<Ref>); | ||
| ^^^^^^^^^^^^ lifetime mismatch | ||
| | ||
= note: expected trait `Trait` | ||
found trait `Trait` | ||
note: the anonymous lifetime #1 defined on the method body at 16:5... | ||
--> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:5 | ||
| | ||
LL | pub fn repro(_: Wrapper<Ref>); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...does not necessarily outlive the static lifetime | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |