-
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.
wf: check foreign fn decls for well-formedness
This commit extends current well-formedness checking to apply to foreign function declarations, re-using the existing machinery for regular functions. In doing this, later parts of the compiler (such as the `improper_ctypes` lint) can rely on being operations not failing as a result of invalid code which would normally be caught earlier. Signed-off-by: David Wood <david@davidtw.co>
- Loading branch information
Showing
5 changed files
with
97 additions
and
52 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
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,18 @@ | ||
pub trait Unsatisfied {} | ||
|
||
#[repr(transparent)] | ||
pub struct Bar<T: Unsatisfied>(T); | ||
|
||
pub trait Foo { | ||
type Assoc; | ||
} | ||
|
||
extern "C" { | ||
pub fn lint_me() -> <() as Foo>::Assoc; | ||
//~^ ERROR: the trait bound `(): Foo` is not satisfied [E0277] | ||
|
||
pub fn lint_me_aswell() -> Bar<u32>; | ||
//~^ ERROR: the trait bound `u32: Unsatisfied` is not satisfied [E0277] | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.