You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case it turns out that many people rely on this, we could give reasonable (and arguably desirable) interpretation to #![inline] and #![repr(C)]: apply these recursively in the module to e.g. structs and fns (unless there is conflict, in which case the most-local attribute is chosen).
Given that occurrences of #![repr(C)] currently do nothing, and it's easy to search for in a codebase (and thus remove or audit), I don't see a strong reason not to start emitting errors, rather than just linting, on these, as long as we can determine this won't break downstream code if there's a crate making this mistake.
I don't think attributes that affect codegen are checked for validity at all. The same thing happens for #[cold], #[inline], etc.
We should fix this too, in the same manner as @rkruppepointed out. (Either as part of this issue, or in a new issue.) Lack of validity checking can cause concrete problems, as in #64768.
Activity
gnzlbg commentedon Sep 24, 2019
cc @Centril ^^^ I don't know who is familiar with libsyntax or the library that handles this.
jonas-schievink commentedon Sep 24, 2019
I don't think attributes that affect codegen are checked for validity at all. The same thing happens for
#[cold]
,#[inline]
, etc.hanna-kruppe commentedon Sep 24, 2019
Some attributes including
#[repr]
and#[inline]
are checked, it appears it's just not visiting the root module. Nested modules do get checked.Centril commentedon Sep 24, 2019
In case it turns out that many people rely on this, we could give reasonable (and arguably desirable) interpretation to
#![inline]
and#![repr(C)]
: apply these recursively in the module to e.g.struct
s andfn
s (unless there is conflict, in which case the most-local attribute is chosen).gnzlbg commentedon Sep 24, 2019
If people rely on this compiling, but doing nothing, changing the repr of all types silently feels like a footgun.
carbotaniuman commentedon Sep 25, 2019
I feel the standard warn by default, deny by default, hard error approach is the easiest way to handle this.
Maybe even skip to deny by default.
varkor commentedon Sep 26, 2019
Given that occurrences of
#![repr(C)]
currently do nothing, and it's easy to search for in a codebase (and thus remove or audit), I don't see a strong reason not to start emitting errors, rather than just linting, on these, as long as we can determine this won't break downstream code if there's a crate making this mistake.varkor commentedon Sep 26, 2019
We should fix this too, in the same manner as @rkruppe pointed out. (Either as part of this issue, or in a new issue.) Lack of validity checking can cause concrete problems, as in #64768.
Rollup merge of rust-lang#76329 - GuillaumeGomez:doc-alias-crate-leve…
ehuss commentedon May 14, 2021
Closing, as this is now a hard error via #76329.