Skip to content

Validate all #[inline] attributes earlier #40792

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

Closed
jseyfried opened this issue Mar 24, 2017 · 3 comments
Closed

Validate all #[inline] attributes earlier #40792

jseyfried opened this issue Mar 24, 2017 · 3 comments
Assignees
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jseyfried
Copy link
Contributor

Today, the following compiles:

struct MyStruct<T>(T);

impl<T> MyStruct<T> {
    #[inline(foo)]
    pub fn f(self) {}
}
@jseyfried jseyfried self-assigned this Mar 24, 2017
@jseyfried
Copy link
Contributor Author

cc @SergioBenitez

@bluss bluss changed the title Validate all #[include] attributes Validate all #[inline] attributes Mar 24, 2017
@Mark-Simulacrum Mark-Simulacrum added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 23, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 27, 2017
@kennytm
Copy link
Member

kennytm commented Jul 27, 2017

It does error when you actually instantiate MyStruct<T>::f.

struct MyStruct<T>(T);

impl<T> MyStruct<T> {
    #[inline(foo)]
    pub fn f(self) {}
}

fn main() {
    let f = MyStruct(4);
    f.f();  // <-- call this to raise error.
}

The problem is that the check is performed in syntax::attr::{requests_inline, find_inline_attr} which were called only during trans (and MIR inlining pass but it is disabled by default), so nothing will be checked if this is not monomorphized.

@nikomatsakis
Copy link
Contributor

Closing in favor of #45738, which has mentoring instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

No branches or pull requests

4 participants