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

Compilation succeeds even if there is #[inline] in the structure field. #80564

Closed
Danue1 opened this issue Dec 31, 2020 · 3 comments
Closed

Compilation succeeds even if there is #[inline] in the structure field. #80564

Danue1 opened this issue Dec 31, 2020 · 3 comments
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Danue1
Copy link
Contributor

Danue1 commented Dec 31, 2020

I tried this code:

struct Foo {
    #[inline]
    bar: String,
}

I expected to see this happen: Failing complilation.

Instead, this happened: Compilation success.

Meta

rustc --version --verbose:

rustc 1.49.0-beta.4 (877c7cbe1 2020-12-10)
binary: rustc
commit-hash: 877c7cbe142a373f93d38a23741dcc3a0a17a2af
commit-date: 2020-12-10
host: x86_64-apple-darwin
release: 1.49.0-beta.4
@Danue1 Danue1 added the C-bug Category: This is a bug. label Dec 31, 2020
@ehuss
Copy link
Contributor

ehuss commented Dec 31, 2020

Some validation was added in #73461, but it looks like there are a few places that are missing. The ones I can see are struct fields, match arms, and macro definitions:

struct Foo {
    #[inline]
    bar: String,
}

match foo {
    #[inline]
    _ => {}
}

#[inline]
macro_rules! foo {
    () => {};
}

I believe that CheckAttrVisitor needs to include visitor methods for visit_arm and visit_struct_field and visit_macro_def.

@camelid camelid added A-attributes Area: Attributes (`#[…]`, `#![…]`) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 1, 2021
@Danue1
Copy link
Contributor Author

Danue1 commented Jan 2, 2021

Hmm, I think I can do it, so I'll try it.

bors added a commit to rust-lang-ci/rust that referenced this issue Feb 1, 2021
@Danue1
Copy link
Contributor Author

Danue1 commented Feb 2, 2021

solved!

@Danue1 Danue1 closed this as completed Feb 2, 2021
github-actions bot pushed a commit to rust-lang/glacier that referenced this issue May 10, 2022
=== stdout ===
=== stderr ===
warning: `#[track_caller]` is ignored on struct fields, match arms and macro defs
 --> /home/runner/work/glacier/glacier/ices/95151.rs:1:1
  |
1 | #[track_caller]
  | ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_attributes)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: see issue #80564 <rust-lang/rust#80564> for more information

warning: 1 warning emitted

==============
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) 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

3 participants