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
{{ message }}
Repository navigation
incremental compilation flags #[rustc_on_unimplemented] as an unused attribute #59523
A-incr-compArea: Incremental compilationA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
The following code will compile successfully the first time you build it with -C incremental=dir, then will fail the second time (again with -C incremental=dir).
Code:
// This is a case where we should not see the lint, but we are seeing// it if incremental compilation is enabled.#![feature(on_unimplemented)]#![deny(unused_attributes)]#[rustc_on_unimplemented = "invalid"]traitIndex<Idx: ?Sized>{typeOutput: ?Sized;fnindex(&self,index:Idx) -> &Self::Output;}#[rustc_on_unimplemented = "a usize is required to index into a slice"]implIndex<usize>for[i32]{typeOutput = i32;fnindex(&self,index:usize) -> &i32{&self[index]}}fnmain(){Index::<usize>::index(&[1,2,3]as&[i32],2);}
Demonstration:
% rustc +nightly -C incremental=dir on-impl-works.rs
% rustc +nightly -C incremental=dir on-impl-works.rs
error: unused attribute
--> on-impl-works.rs:7:1
|
7 | #[rustc_on_unimplemented = "invalid"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> on-impl-works.rs:5:9
|
5 | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: unused attribute
--> on-impl-works.rs:13:1
|
13 | #[rustc_on_unimplemented = "a usize is required to index into a slice"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
This may seem like a low priority item since it is using #![feature(on_unimplemented)]; but we use that feature in libcore itself, so this problem is causing issues for people who want to use incremental compilation when making their locally bootstrapped build, which defaults to -D warnings.
For the long term, I am vaguely worried that this may be an instance of a class of bugs with the interaction between lints and incremental compilation that we should be tracking.
A-incr-compArea: Incremental compilationA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
Activity
pnkfelix commentedon Mar 29, 2019
Probably the easiest short-term answer is just do something analogous to 81a6437 but for
on_unimplemented.pnkfelix commentedon Mar 29, 2019
For the long term, I am vaguely worried that this may be an instance of a class of bugs with the interaction between lints and incremental compilation that we should be tracking.
For example, see also #52387
Rollup merge of rust-lang#59525 - pnkfelix:whitelist-some-rustc-attrs…
Rollup merge of rust-lang#59525 - pnkfelix:whitelist-some-rustc-attrs…