rust-lang/rust

`./x.py check` failed if incremental builds enabled

kenta7777 opened this issue ยท 32 comments

This error occurred when running ./x.py check.
Should I remove these unused attributes?

$ ./x.py check
Updating only changed submodules
Submodules updated in 0.04 seconds
    Finished dev [unoptimized] target(s) in 0.58s
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Checking std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking core v0.0.0 (/home/kenta/rust/src/libcore)
error: unused attribute=======================>                        ] 21/36: core                    
   --> src/libcore/num/mod.rs:50:17
    |
50  |                   #[rustc_layout_scalar_valid_range_start(1)]
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
100 | / nonzero_integers! {
101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
...   |
112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
113 | | }
    | |_- in this macro invocation
    |
    = note: `-D unused-attributes` implied by `-D warnings`

error: unused attribute
   --> src/libcore/num/mod.rs:50:17
    |
50  |                   #[rustc_layout_scalar_valid_range_start(1)]
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
100 | / nonzero_integers! {
101 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
102 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
103 | |     #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
...   |
112 | |     #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
113 | | }
    | |_- in this macro invocation

error: unused attribute
    --> src/libcore/ptr.rs:2721:1
     |
2721 | #[rustc_layout_scalar_valid_range_start(1)]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unused attribute
    --> src/libcore/ptr.rs:2879:1
     |
2879 | #[rustc_layout_scalar_valid_range_start(1)]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unused attribute
  --> src/libcore/ops/function.rs:59:1
   |
59 | / #[rustc_on_unimplemented(
60 | |     on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"),
61 | |     message="expected a `{Fn}<{Args}>` closure, found `{Self}`",
62 | |     label="expected an `Fn<{Args}>` closure, found `{Self}`",
63 | | )]
   | |__^

error: unused attribute
   --> src/libcore/ops/function.rs:138:1
    |
138 | / #[rustc_on_unimplemented(
139 | |     on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"),
140 | |     message="expected a `{FnMut}<{Args}>` closure, found `{Self}`",
141 | |     label="expected an `FnMut<{Args}>` closure, found `{Self}`",
142 | | )]
    | |__^

error: unused attribute
   --> src/libcore/ops/function.rs:217:1
    |
217 | / #[rustc_on_unimplemented(
218 | |     on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"),
219 | |     message="expected a `{FnOnce}<{Args}>` closure, found `{Self}`",
220 | |     label="expected an `FnOnce<{Args}>` closure, found `{Self}`",
221 | | )]
    | |__^

error: unused attribute
  --> src/libcore/ops/index.rs:53:1
   |
53 | / #[rustc_on_unimplemented(
54 | |     message="the type `{Self}` cannot be indexed by `{Idx}`",
55 | |     label="`{Self}` cannot be indexed by `{Idx}`",
56 | | )]
   | |__^

error: unused attribute
   --> src/libcore/ops/index.rs:143:1
    |
143 | / #[rustc_on_unimplemented(
144 | |     on(
145 | |         _Self="&str",
146 | |         note="you can use `.chars().nth()` or `.bytes().nth()`
...   |
160 | |     label="`{Self}` cannot be mutably indexed by `{Idx}`",
161 | | )]
    | |__^

error: unused attribute
  --> src/libcore/ops/try.rs:8:1
   |
8  | / #[rustc_on_unimplemented(
9  | |    on(all(
10 | |        any(from_method="from_error", from_method="from_ok"),
11 | |        from_desugaring="?"),
...  |
19 | |       label="the `?` operator cannot be applied to type `{Self}`")
20 | | )]
   | |__^

error: unused attribute
   --> src/libcore/cmp.rs:185:1
    |
185 | / #[rustc_on_unimplemented(
186 | |     message="can't compare `{Self}` with `{Rhs}`",
187 | |     label="no implementation for `{Self} == {Rhs}`",
188 | | )]
    | |__^

error: unused attribute
   --> src/libcore/cmp.rs:695:1
    |
695 | / #[rustc_on_unimplemented(
696 | |     message="can't compare `{Self}` with `{Rhs}`",
697 | |     label="no implementation for `{Self} < {Rhs}` and `{Self} > {Rhs}`",
698 | | )]
    | |__^

error: unused attribute
  --> src/libcore/iter/traits/iterator.rs:21:1
   |
21 | / #[rustc_on_unimplemented(
22 | |     on(
23 | |         _Self="[std::ops::Range<Idx>; 1]",
24 | |         label="if you meant to iterate between two values, remove the square brackets",
...  |
87 | |     message="`{Self}` is not an iterator"
88 | | )]
   | |__^

error: unused attribute
  --> src/libcore/iter/traits/collect.rs:93:1
   |
93 | / #[rustc_on_unimplemented(
94 | |     message="a collection of type `{Self}` cannot be built from an iterator \
95 | |              over elements of type `{A}`",
96 | |     label="a collection of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`",
97 | | )]
   | |__^

error: aborting due to 14 previous errors

error: Could not compile `core`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/kenta/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/home/kenta/rust/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
failed to run: /home/kenta/rust/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:00:15

What's your config.toml? These should only warn, not error.

This is a part of my config.toml which is not commented out.

# Indicates whether the LLVM assertions are enabled or not
assertions = true

# Number of codegen units to use for each compiler invocation. A value of 0
# means "the number of cores on this machine", and 1+ is passed through to the
# compiler.
codegen-units = 0

# Sets the number of codegen units to build the standard library with,
# regardless of what the codegen-unit setting for the rest of the compiler is.
#codegen-units-std = 1

# Whether or not debug assertions are enabled for the compiler and standard
# library. Also enables compilation of debug! and trace! logging macros.
debug-assertions = true

# Whether or not debuginfo is emitted
debuginfo = true

# Whether or not line number debug information is emitted
debuginfo-lines = true

# Whether to always use incremental compilation when building rustc
incremental = true

If you run x.py clean and check again, these warnings should go away. It would be nice if this wasn't necessary, though.

@varkor Thank you for your advice! ./x.py clean and then build completed successfully!

This happens to me every time I try to do an incremental build after making a change. Is there any other way to resolve this than x.py clean?

Let's keep this issue open, because we'd rather not have to clean even single time.

I'm running into the same problem with incremental builds, which makes incremental kind of useless...

I think I am also running into this. I'm going to tag this T-compiler to try to increase visibility

I am also running into this

This is super painful, can this gets prioritized, or could we disable incremental builds until its fixed?

FYI, the following command seems like a pretty reliable way to reproduce this problem:

python x.py clean && \
  configure --set rust.incremental=true && \
  python x.py build --stage 1 src/libstd && \
  touch src/libcore/num/mod.rs && \
  python x.py build --stage 1 src/libstd

(assigning to self to investigate)

Strange; part of the problem I have had in investigating this is that it seemed like my manual attempts to run the "same" commands that were being issued by bootstrap would all complete successfully.

I think part of the issue there is that the verbose mode for bootstrap is sometimes hiding information about the commands it runs. To get something that actually reproduced the problem, I had to drop into the "more verbose" mode by passing --verbose twice to x.py, like so:

% python ../x.py build --verbose --verbose --stage 1 src/libstd

and an interesting part about that output is that I saw these two lines right next to each other in the output:

...

     Running `/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/bootstrap/debug/rustc --crate-name core src/libcore/lib.rs --color never --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=79e1b20a65904af1 -C extra-filename=-79e1b20a65904af1 --out-dir /home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C incremental=/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/incremental -L dependency=/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/release/deps`
rustc command: "LD_LIBRARY_PATH"="/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0/lib:/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/release/deps:/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0/lib" "/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "--crate-name" "core" "src/libcore/lib.rs" "--color" "never" "--crate-type" "lib" "--emit=dep-info,link" "-C" "opt-level=2" "-C" "metadata=79e1b20a65904af1-rustc" "-C" "extra-filename=-79e1b20a65904af1" "--out-dir" "/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "--target" "x86_64-unknown-linux-gnu" "-C" "incremental=/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/incremental" "-L" "dependency=/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-std/release/deps" "--cfg" "stage0" "--sysroot" "/home/pnkfelix/Dev/Mozilla/rust.git/objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage0-sysroot" "-Zexternal-macro-backtrace" "-Cprefer-dynamic" "-C" "debug-assertions=n" "-C" "link-args=-Wl,-rpath,$ORIGIN/../lib" "-Z" "force-unstable-if-unmarked" "-Dwarnings" "-Dbare_trait_objects"
...

The first command listed won't reproduce the problem. The second will. (I suspect its because the first is lacking that -Dwarning that is present in the second.)

Also, setting this to false may provide an easier workaround for this speciifc bug than a full clean:

rust/config.toml.example

Lines 402 to 403 in 003382e

# Whether to deny warnings in crates
#deny-warnings = true

(The aforementioned setting was moved into rustbuild in #49715)

I am getting an increasing feeling that we need to document and simplify the bootstrapping process better...

This is super painful, can this gets prioritized, or could we disable incremental builds until its fixed?

My hope is that once PR #59525 gets into the beta-channel, then we should not see this particular problem arise.

I would like to know if anyone is seeing other warnings that are not covered by the cases I handled in PR #59525.

This is fixed now, right?

I haven't encountered it since #5952.

Same here. Seems to be working. Thanks @pnkfelix

closing as fixed.

Fixed on my end as well, thank you all!

I would like to know if anyone is seeing other warnings that are not covered by the cases I handled in PR #59525.

Seeing this one here: #64764 (comment)
ie.

error: unused attribute
  --> src/libcore/slice/mod.rs:66:5
   |
66 |     #[allow_internal_unstable(const_fn_union)]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unused-attributes` implied by `-D warnings`

I attempted some kind of whitelisting just as you did in PR #59525, but I'm thinking it will only work if I attempt recompilation with a rustc that has that whitelisted already?(which would explain why it keeps failing as if whitelisting it had no effect, ok definitely placing garbage instead of the below patch(which should compile fail) does have no effect which says that it doesn't get compiled before the above fail)

Either way, I'm not sure where to Whitelist it, since it appears as gated! too:

diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs
index d14afc6deaa..2d92c4df399 100644
--- a/src/libsyntax/feature_gate/builtin_attrs.rs
+++ b/src/libsyntax/feature_gate/builtin_attrs.rs
@@ -331,7 +331,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
         "the `#[rustc_const_unstable]` attribute is an internal feature",
     ),
     gated!(
-        allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."),
+        allow_internal_unstable, Whitelisted, template!(Word, List: "feat1, feat2, ..."),
         EXPLAIN_ALLOW_INTERNAL_UNSTABLE,
     ),
     gated!(allow_internal_unsafe, Normal, template!(Word), EXPLAIN_ALLOW_INTERNAL_UNSAFE),
@@ -438,6 +438,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     // Internal attributes, Layout related:
     // ==========================================================================
 
+//    rustc_attr!(
+//        allow_internal_unstable, Whitelisted, template!(Word, List: "feat1, feat2, ..."),
+//        EXPLAIN_ALLOW_INTERNAL_UNSTABLE,
+//    ),
+
     rustc_attr!(
         rustc_layout_scalar_valid_range_start, Whitelisted, template!(List: "value"),
         "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \

(notice how the filename moved: src/libsyntax/feature_gate.rs is now src/libsyntax/feature_gate/builtin_attrs.rs)

Something extra:
If I put rustc = "/home/user/.cargo/bin/rustc" in config.toml (which overrides the stage0 rust date: 2019-09-25 / rustc: beta / cargo: beta) then it compiles ok the first time(as expected) then if I interrupt it and touch src/libcore/slice/mod.rs then attempt (re)compile, I get now:

       Fresh cmake v0.1.38
     Running `/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/bootstrap/debug/rustc --edition=2018 --crate-name core src/libcore/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C codegen-units=1 -C debuginfo=2 -C metadata=72dd04d070b09a5d -C extra-filename=-72dd04d070b09a5d --out-dir /home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C incremental=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/incremental -L dependency=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/release/deps -Zexternal-macro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings -Cprefer-dynamic -Zbinary-dep-depinfo`
rustc command: "LD_LIBRARY_PATH"="/home/user/.cargo/lib:/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/release/deps:/home/user/build/2nonpkgs/rust.stuff/rust/rust.installed.dir/lib" "/home/user/.cargo/bin/rustc" "--edition=2018" "--crate-name" "core" "src/libcore/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=2" "-C" "codegen-units=1" "-C" "debuginfo=2" "-C" "metadata=72dd04d070b09a5d" "-C" "extra-filename=-72dd04d070b09a5d" "--out-dir" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "--target" "x86_64-unknown-linux-gnu" "-C" "incremental=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/incremental" "-L" "dependency=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/release/deps" "-Zexternal-macro-backtrace" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "-Cprefer-dynamic" "-Zbinary-dep-depinfo" "--sysroot" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot" "-C" "debug-assertions=n" "-Z" "force-unstable-if-unmarked"
sysroot: "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot"
libdir: "/home/user/.cargo/lib"
error: unused attribute
   --> src/libcore/convert.rs:564:1
    |
564 | / #[rustc_reservation_impl="permitting this impl would forbid us from adding \
565 | | `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details"]
    | |_____________________________________________________________________^
    |
    = note: `-D unused-attributes` implied by `-D warnings`

error: unused attribute
  --> src/libcore/slice/mod.rs:66:5
   |
66 |     #[allow_internal_unstable(const_fn_union)]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unused attribute
    --> src/libcore/str/mod.rs:2170:5
     |
2170 |     #[allow_internal_unstable(const_fn_union)]
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors

[RUSTC-TIMING] core test:false 16.681
error: could not compile `core`.

Caused by:
  process didn't exit successfully: `/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/bootstrap/debug/rustc --edition=2018 --crate-name core src/libcore/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C codegen-units=1 -C debuginfo=2 -C metadata=72dd04d070b09a5d -C extra-filename=-72dd04d070b09a5d --out-dir /home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C incremental=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/incremental -L dependency=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0-std/release/deps -Zexternal-macro-backtrace '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings -Cprefer-dynamic -Zbinary-dep-depinfo` (exit code: 1)
command did not execute successfully: "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-Zconfig-profile" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libtest/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
Traceback (most recent call last):
  File "./x.py", line 11, in <module>
    bootstrap.main()
  File "/home/user/build/2nonpkgs/rust.stuff/rust/rust/src/bootstrap/bootstrap.py", line 900, in main
    bootstrap(help_triggered)
  File "/home/user/build/2nonpkgs/rust.stuff/rust/rust/src/bootstrap/bootstrap.py", line 886, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "/home/user/build/2nonpkgs/rust.stuff/rust/rust/src/bootstrap/bootstrap.py", line 141, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/user/build/2nonpkgs/rust.stuff/rust/rust/build/bootstrap/debug/bootstrap build -vv -j 4

real	0m22.882s
user	0m22.963s
sys	0m2.961s

$ /home/user/.cargo/bin/rustc -vV
rustc 1.40.0-dev (f3c8eba64 2019-09-28)
binary: rustc
commit-hash: f3c8eba643a815d720e7f20699b3dca144c845c4
commit-date: 2019-09-28
host: x86_64-unknown-linux-gnu
release: 1.40.0-dev
LLVM version: 9.0

This keeps happening to me with this:

error: unused attribute
   --> src/libcore/convert.rs:565:1
    |
565 | / #[rustc_reservation_impl = "permitting this impl would forbid us from adding \
566 | |                             `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details"]
    | |_________________________________________________________________________________________________^
    |
    = note: `-D unused-attributes` implied by `-D warnings`

error: aborting due to previous error

I'm reopening and nominating for compiler team since it seems like it may be worth discussing to see if there's some principled solution for bugs like this. I think we've seen the last 2-3 releases all introduce at least one case of unused attribute errors in libcore/libstd during incremental, which is not great. Maybe there's some way we can stop tracking the rustc-perma-unstable attributes as 'green' in incremental? That may be too big a hammer though (or maybe too small). At least, it seems worth bringing this up at pre-triage.

This keeps happening to me when switching from ./x.py check to ./x.py -i test src/test/ui --stage 1 --bless --pass check. Very annoying to have to ./x.py clean. :(

triage: P-high, leaving nominated in hopes of discussion in a near term meeting.

There is a way of dealing with side-effects in the incremental system. We use such a solution for diagnostics. It could probably be expanded to unused-attributes if there is no cleaner approach.

removing nomination label; I'll follow-up with @michaelwoerister directly on ways to resolve this. (And/or discuss removing unused_attributes lint with @rust-lang/lang )

eddyb commented

Should we just demote unused_attributes to warn-only at stage0?

It's getting pretty boring to nuke stage0-std every time I rebase and something has changed in libstd (looks even more frequent nowadays), and I've heard people say they don't set incremental = true in cargo.toml because of these "unused attribute" errors, which is a shame.

IMO incremental = true should be the default for dev builds, although there's also the wasteful duplication between build artifacts and incremental dirs (for which I've just opened #70823).

eddyb commented

Opened #70881 for the "temporary workaround".

eddyb commented

Just FYI, #70881 landed, please leave a comment here if you still hit this issue.
(it might move from libcore to other crates, not sure)