-
Notifications
You must be signed in to change notification settings - Fork 13.3k
#[link_args]
was accidentally stabilized; were other attributes as well?
#43106
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
Comments
In particular, try to check by using the attribute in places where it was not intended to be used. As an example |
(So PR #43109 is intended to address item (1.) in the description, but I want to keep this issue open until we have double-checked (2.) and potentially added corresponding unit tests.) |
Another detail that I had not digested before about this bug: We are even emitting a lint claiming that the This led me to think that this bug was not so bad, since I inferred from the emission of the However, as @retep998 states, the So the compiler is not merely failing to stop us from putting in a useless occurrence of an unstable attribue in such cases; it is in fact actively lying regarding the effect of the occurrence of the attribute. |
Slew of builtin-attribute gating tests Slew of builtin-attribute "gating" tests for issue #43106. Some stray observations: * I don't know if its a good thing that so many attributes allow inputs which are silently discarded. (I made heavy use of that in writing my tests, but that was more out of curiosity than necessity.) * The difference between crate-level and non-crate-level behavior is quite significant in some cases. Definitely worth making sure one has tests for both cases. (Not as clear whether it was worthwhile trying the various other AST forms like `fn f()` vs `struct S;`) * `#[no_builtins]` and `#[no_mangle]` occur twice on the `BUILTIN_ATTRIBUTES` list. Thats almost certainly a bug. (Filed as #43148) * We are maximally liberal in what we allow for `#[test]` and `#[bench]` when one compiles without `--test`. * We allow `#[no_mangle]` on arbitrary AST nodes, but only warn about potential misuse on `fn` * We allow `#[cold]`, `#[must_use]`, `#[windows_subsystem]`, and `#[no_builtins]` on arbitrary AST nodes. I don't know off-hand what the semantics are for e.g. a `#[cold] type T = ...;` * We allow crate-level `#![inline]`. That's probably a bug since its otherwise restricted to `fn` items
Regarding the "were other attributes as well?" part, the list of built-in attributes is currently in |
A comment in the tracking issue for
#[link_args]
points out that the attribute was accidentally stabilized (quite a long time ago).I think it will be easy to fix the particular case of
#[link_args]
; the infrastructure here is pretty nice. But it does raise the question: Were other attributes accidentally stabilized at the same time?This issue has two goals: 1. correct the
#[link_args]
feature gate, and 2. double-check whether other attributes in theBUILTIN_ATTRIBUTES
array need similar treatment.The text was updated successfully, but these errors were encountered: