Skip to content

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

Closed

Description

@pnkfelix

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.

Activity

  1. added
    A-incr-comp
    A-lints
    T-compiler
    on Mar 29, 2019
  2. added 2 commits that reference this issue on Mar 29, 2019
    4ce217b
    11e1b3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compA-lintsT-compiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions