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

./x.py check failed if incremental builds enabled #58633

Closed
kenta7777 opened this issue Feb 22, 2019 · 32 comments · Fixed by #89760
Closed

./x.py check failed if incremental builds enabled #58633

kenta7777 opened this issue Feb 22, 2019 · 32 comments · Fixed by #89760
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-incr-comp Area: Incremental compilation A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. P-high High priority T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kenta7777
Copy link
Contributor

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

@jonas-schievink
Copy link
Contributor

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

@kenta7777
Copy link
Contributor Author

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

@varkor
Copy link
Member

varkor commented Feb 22, 2019

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

@kenta7777
Copy link
Contributor Author

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

@timvermeulen
Copy link
Contributor

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?

@varkor
Copy link
Member

varkor commented Feb 26, 2019

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

@varkor varkor reopened this Feb 26, 2019
@estebank estebank added A-incr-comp Area: Incremental compilation T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 4, 2019
@mark-i-m
Copy link
Member

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

@pnkfelix
Copy link
Member

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

@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 22, 2019
@pnkfelix pnkfelix changed the title ./x.py check failed ./x.py check failed if incremental enabled Mar 22, 2019
@pnkfelix pnkfelix changed the title ./x.py check failed if incremental enabled ./x.py check failed if incremental builds enabled Mar 22, 2019
@benbrittain
Copy link

I am also running into this

@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Mar 27, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Mar 29, 2019

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

@pnkfelix
Copy link
Member

pnkfelix commented Mar 29, 2019

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

@pnkfelix
Copy link
Member

(assigning to self to investigate)

@pnkfelix pnkfelix self-assigned this Mar 29, 2019
@pnkfelix
Copy link
Member

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.)

@pnkfelix
Copy link
Member

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

@pnkfelix
Copy link
Member

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

@mark-i-m
Copy link
Member

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

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
@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 14, 2019

Fixed on my end as well, thank you all!

@ghost
Copy link

ghost commented Sep 29, 2019

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

@ghost ghost mentioned this issue Sep 29, 2019
@KamilaBorowska
Copy link
Contributor

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

@Mark-Simulacrum
Copy link
Member

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.

@Centril
Copy link
Contributor

Centril commented Dec 6, 2019

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. :(

Centril added a commit to Centril/rust that referenced this issue Dec 8, 2019
use `#[allow(unused_attributes)]` to paper over incr.comp problem

Paper over the problem in rust-lang#58633.

r? @Mark-Simulacrum
@pnkfelix
Copy link
Member

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

@pnkfelix pnkfelix added the P-high High priority label Dec 12, 2019
@michaelwoerister
Copy link
Member

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.

@pnkfelix
Copy link
Member

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 )

@jonas-schievink jonas-schievink added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. labels Mar 31, 2020
@eddyb
Copy link
Member

eddyb commented Apr 5, 2020

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
Copy link
Member

eddyb commented Apr 7, 2020

Opened #70881 for the "temporary workaround".

Centril added a commit to Centril/rust that referenced this issue Apr 10, 2020
…d-attrs, r=Mark-Simulacrum

bootstrap: work around "unused attribute" errors in incremental stdlib rebuilds.

This should alleviate rust-lang#58633 separately from a proper fix.

r? @Mark-Simulacrum
@eddyb
Copy link
Member

eddyb commented Apr 11, 2020

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)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 11, 2021
…ark-Simulacrum

Remove hack ignoring unused attributes for stage 0 std

This seems to no longer be giving spurious errors when incremental is
enabled.

Closes rust-lang#58633.
@bors bors closed this as completed in b9311b4 Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-incr-comp Area: Incremental compilation A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. P-high High priority T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.