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

incremental compilation flags #[rustc_layout_scalar_valid_range_*] as an unused attribute #59524

Closed
pnkfelix opened this issue Mar 29, 2019 · 0 comments
Labels
A-incr-comp Area: Incremental compilation A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Mar 29, 2019

Spawned off of #58633

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:

#![feature(rustc_attrs)]
#![deny(unused_attributes)]

#[rustc_layout_scalar_valid_range_start(10)]
#[rustc_layout_scalar_valid_range_end(30)]
struct RestrictedRange(u32);
const OKAY_RANGE: RestrictedRange = unsafe { RestrictedRange(20) };

fn main() {
    OKAY_RANGE.0;
}

Demonstration:

% rustc -C incremental=dir ub-nonnull-works.rs
% rustc -C incremental=dir ub-nonnull-works.rs
error: unused attribute
 --> ub-nonnull-works.rs:4:1
  |
4 | #[rustc_layout_scalar_valid_range_start(10)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> ub-nonnull-works.rs:2:9
  |
2 | #![deny(unused_attributes)]
  |         ^^^^^^^^^^^^^^^^^

error: unused attribute
 --> ub-nonnull-works.rs:5:1
  |
5 | #[rustc_layout_scalar_valid_range_end(30)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

This may seem like a low priority item since it is using an unstable feature; 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.

@pnkfelix pnkfelix added A-incr-comp Area: Incremental compilation A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 29, 2019
Centril added a commit to Centril/rust that referenced this issue Mar 29, 2019
…, r=petrochenkov

Whitelist some rustc attrs

These rustc attrs are used within libcore, and were causing failures when one mixed incremental compilation with bootstrapping (due to a default of `-D warnings` when bootstrapping).

Fix rust-lang#59523
Fix rust-lang#59524

Cc rust-lang#58633
Centril added a commit to Centril/rust that referenced this issue Mar 30, 2019
…, r=petrochenkov

Whitelist some rustc attrs

These rustc attrs are used within libcore, and were causing failures when one mixed incremental compilation with bootstrapping (due to a default of `-D warnings` when bootstrapping).

Fix rust-lang#59523
Fix rust-lang#59524

Cc rust-lang#58633
@ghost ghost mentioned this issue Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. 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

1 participant