Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Well formedness of types in extern functions is not checked #73253

Closed
lcnr opened this issue Jun 11, 2020 · 0 comments · Fixed by #73323
Closed

Well formedness of types in extern functions is not checked #73253

lcnr opened this issue Jun 11, 2020 · 0 comments · Fixed by #73323
Labels
A-type-system Area: Type system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Jun 11, 2020

This does only error once we actually use foo.

pub trait Unsatisfied {}

#[repr(transparent)]
pub struct Foo<T: Unsatisfied>(T);

extern "C" {
    pub fn foo() -> Foo<u32>;
}

The following errors when we declare foo

pub trait Unsatisfied {}

#[repr(transparent)]
pub struct Foo<T: Unsatisfied>(T);

trait A {
    fn test() -> Foo<u32>;
    //~^ the trait bound `u32: Unsatisfied` is not satisfied
}

Extern statics are also checked:

pub trait Unsatisfied {}

#[repr(transparent)]
pub struct Foo<T: Unsatisfied>(T);

extern "C" {
    static FOO: Foo<u32>;
    //~^ the trait bound `u32: Unsatisfied` is not satisfied
}

I expected that we also check the well formedness of function declarations in extern blocks

@lcnr lcnr added the C-bug Category: This is a bug. label Jun 11, 2020
@jonas-schievink jonas-schievink added A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 11, 2020
@lcnr lcnr changed the title Well formedness of extern types is not checked Well formedness of types in extern functions are not checked Jun 14, 2020
@lcnr lcnr changed the title Well formedness of types in extern functions are not checked Well formedness of types in extern functions is not checked Jun 14, 2020
@bors bors closed this as completed in 0897bc2 Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants