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

Does not build with extended on #50328

Closed
alexreg opened this issue Apr 30, 2018 · 17 comments · Fixed by #64250
Closed

Does not build with extended on #50328

alexreg opened this issue Apr 30, 2018 · 17 comments · Fixed by #64250
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@alexreg
Copy link
Contributor

alexreg commented Apr 30, 2018

I have extended = true set in config.toml, but this seems to be causing the build to fail (master HEAD at time of writing), where it wasn't before.

$ ./x.py -i build
Updating only changed submodules
Updating submodule src/tools/clippy
Submodule path 'src/tools/clippy': checked out 'c5b39a5917ffc0f1349b6e414fa3b874fdcf8429'
Submodules updated in 1.15 seconds
    Finished dev [unoptimized] target(s) in 0.0 secs
Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
   Compiling core v0.0.0 (file:///Users/alex/Software/rust/src/libcore)
   Compiling unwind v0.0.0 (file:///Users/alex/Software/rust/src/libunwind)
   Compiling build_helper v0.1.0 (file:///Users/alex/Software/rust/src/build_helper)
   Compiling compiler_builtins v0.0.0 (file:///Users/alex/Software/rust/src/rustc/compiler_builtins_shim)
   Compiling rustc_tsan v0.0.0 (file:///Users/alex/Software/rust/src/librustc_tsan)
   Compiling rustc_asan v0.0.0 (file:///Users/alex/Software/rust/src/librustc_asan)
   Compiling alloc_jemalloc v0.0.0 (file:///Users/alex/Software/rust/src/liballoc_jemalloc)
   Compiling std v0.0.0 (file:///Users/alex/Software/rust/src/libstd)
   Compiling libc v0.0.0 (file:///Users/alex/Software/rust/src/rustc/libc_shim)
   Compiling alloc v0.0.0 (file:///Users/alex/Software/rust/src/liballoc)
   Compiling std_unicode v0.0.0 (file:///Users/alex/Software/rust/src/libstd_unicode)
   Compiling alloc_system v0.0.0 (file:///Users/alex/Software/rust/src/liballoc_system)
   Compiling panic_abort v0.0.0 (file:///Users/alex/Software/rust/src/libpanic_abort)
   Compiling panic_unwind v0.0.0 (file:///Users/alex/Software/rust/src/libpanic_unwind)
    Finished release [optimized] target(s) in 50.30 secs
Copying stage0 std from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 test artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
   Compiling getopts v0.2.17
   Compiling term v0.0.0 (file:///Users/alex/Software/rust/src/libterm)
   Compiling test v0.0.0 (file:///Users/alex/Software/rust/src/libtest)
    Finished release [optimized] target(s) in 8.28 secs
Copying stage0 test from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 compiler artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
   Compiling libc v0.2.40
   Compiling stable_deref_trait v1.0.0
   Compiling smallvec v0.6.0
   Compiling cfg-if v0.1.2
   Compiling bitflags v1.0.1
   Compiling serialize v0.0.0 (file:///Users/alex/Software/rust/src/libserialize)
   Compiling rustc_target v0.0.0 (file:///Users/alex/Software/rust/src/librustc_target)
   Compiling unicode-width v0.1.4
   Compiling scoped-tls v0.1.1
   Compiling termcolor v0.3.6
   Compiling syntax v0.0.0 (file:///Users/alex/Software/rust/src/libsyntax)
   Compiling rustc v0.0.0 (file:///Users/alex/Software/rust/src/librustc)
   Compiling remove_dir_all v0.5.1
   Compiling rustc-demangle v0.1.7
   Compiling byteorder v1.2.2
   Compiling graphviz v0.0.0 (file:///Users/alex/Software/rust/src/libgraphviz)
   Compiling lazy_static v1.0.0
   Compiling rustc-serialize v0.3.24
   Compiling rustc_metadata v0.0.0 (file:///Users/alex/Software/rust/src/librustc_metadata)
   Compiling fmt_macros v0.0.0 (file:///Users/alex/Software/rust/src/libfmt_macros)
   Compiling lazy_static v0.2.11
   Compiling rustc_incremental v0.0.0 (file:///Users/alex/Software/rust/src/librustc_incremental)
   Compiling quick-error v1.2.1
   Compiling rustc_platform_intrinsics v0.0.0 (file:///Users/alex/Software/rust/src/librustc_platform_intrinsics)
   Compiling ar v0.3.1
   Compiling rustc_driver v0.0.0 (file:///Users/alex/Software/rust/src/librustc_driver)
   Compiling log v0.4.1
   Compiling owning_ref v0.3.3
   Compiling rand v0.4.2
   Compiling atty v0.2.8
   Compiling log_settings v0.1.1
   Compiling humantime v1.1.1
   Compiling backtrace v0.3.6
   Compiling miniz-sys v0.1.10
   Compiling ena v0.9.2
   Compiling rustc_cratesio_shim v0.0.0 (file:///Users/alex/Software/rust/src/librustc_cratesio_shim)
   Compiling jobserver v0.1.11
   Compiling env_logger v0.5.8
   Compiling rustc_apfloat v0.0.0 (file:///Users/alex/Software/rust/src/librustc_apfloat)
   Compiling parking_lot_core v0.2.14
   Compiling tempdir v0.3.7
   Compiling flate2 v1.0.1
   Compiling parking_lot v0.5.5
   Compiling rustc_data_structures v0.0.0 (file:///Users/alex/Software/rust/src/librustc_data_structures)
   Compiling rls-span v0.4.0
   Compiling rls-data v0.15.0
   Compiling syntax_pos v0.0.0 (file:///Users/alex/Software/rust/src/libsyntax_pos)
   Compiling arena v0.0.0 (file:///Users/alex/Software/rust/src/libarena)
   Compiling rustc_errors v0.0.0 (file:///Users/alex/Software/rust/src/librustc_errors)
   Compiling proc_macro v0.0.0 (file:///Users/alex/Software/rust/src/libproc_macro)
   Compiling rustc_const_math v0.0.0 (file:///Users/alex/Software/rust/src/librustc_const_math)
   Compiling syntax_ext v0.0.0 (file:///Users/alex/Software/rust/src/libsyntax_ext)
   Compiling rustc_typeck v0.0.0 (file:///Users/alex/Software/rust/src/librustc_typeck)
   Compiling rustc_mir v0.0.0 (file:///Users/alex/Software/rust/src/librustc_mir)
   Compiling rustc_allocator v0.0.0 (file:///Users/alex/Software/rust/src/librustc_allocator)
   Compiling rustc_traits v0.0.0 (file:///Users/alex/Software/rust/src/librustc_traits)
   Compiling rustc_resolve v0.0.0 (file:///Users/alex/Software/rust/src/librustc_resolve)
   Compiling rustc_plugin v0.0.0 (file:///Users/alex/Software/rust/src/librustc_plugin)
   Compiling rustc_privacy v0.0.0 (file:///Users/alex/Software/rust/src/librustc_privacy)
   Compiling rustc_save_analysis v0.0.0 (file:///Users/alex/Software/rust/src/librustc_save_analysis)
   Compiling rustc_lint v0.0.0 (file:///Users/alex/Software/rust/src/librustc_lint)
   Compiling rustc_trans_utils v0.0.0 (file:///Users/alex/Software/rust/src/librustc_trans_utils)
   Compiling rustc_borrowck v0.0.0 (file:///Users/alex/Software/rust/src/librustc_borrowck)
   Compiling rustc_passes v0.0.0 (file:///Users/alex/Software/rust/src/librustc_passes)
   Compiling rustc-main v0.0.0 (file:///Users/alex/Software/rust/src/rustc)
    Finished release [optimized] target(s) in 694.18 secs
Copying stage0 rustc from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 codegen artifacts (x86_64-apple-darwin -> x86_64-apple-darwin, llvm)
   Compiling build_helper v0.1.0 (file:///Users/alex/Software/rust/src/build_helper)
   Compiling rustc_trans v0.0.0 (file:///Users/alex/Software/rust/src/librustc_trans)
   Compiling cc v1.0.10
   Compiling num_cpus v1.8.0
   Compiling rustc_llvm v0.0.0 (file:///Users/alex/Software/rust/src/librustc_llvm)
    Finished release [optimized] target(s) in 67.70 secs
Assembling stage1 compiler (x86_64-apple-darwin)
Building stage1 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
   Compiling core v0.0.0 (file:///Users/alex/Software/rust/src/libcore)
   Compiling unwind v0.0.0 (file:///Users/alex/Software/rust/src/libunwind)
   Compiling compiler_builtins v0.0.0 (file:///Users/alex/Software/rust/src/rustc/compiler_builtins_shim)
   Compiling alloc_jemalloc v0.0.0 (file:///Users/alex/Software/rust/src/liballoc_jemalloc)
   Compiling rustc_asan v0.0.0 (file:///Users/alex/Software/rust/src/librustc_asan)
   Compiling rustc_tsan v0.0.0 (file:///Users/alex/Software/rust/src/librustc_tsan)
   Compiling std v0.0.0 (file:///Users/alex/Software/rust/src/libstd)
error: internal compiler error: librustc/ty/context.rs:275: node unknown node (id=1) with HirId::owner DefId(0/0:0 ~ core[7c27]) cannot be placed in TypeckTables with local_id_root DefId(0/0:1840 ~ core[7c27]::panicking[0]::panic_fmt[0])

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:546:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error


note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.27.0-dev running on x86_64-apple-darwin

note: compiler flags: -Z save-analysis -Z osx-rpath-install-name -Z force-unstable-if-unmarked -C opt-level=2 -C prefer-dynamic -C debug-assertions=y -C codegen-units=8 -C link-args=-Wl,-rpath,@loader_path/../lib --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `core`.

Caused by:
  process didn't exit successfully: `/Users/alex/Software/rust/build/bootstrap/debug/rustc --crate-name core libcore/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=be5db4a71f87466b -C extra-filename=-be5db4a71f87466b --out-dir /Users/alex/Software/rust/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -L dependency=/Users/alex/Software/rust/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps -L dependency=/Users/alex/Software/rust/build/x86_64-apple-darwin/stage1-std/release/deps` (exit code: 101)
command did not execute successfully: "/Users/alex/Software/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "--target" "x86_64-apple-darwin" "-j" "8" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/Users/alex/Software/rust/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to run: /Users/alex/Software/rust/build/bootstrap/debug/bootstrap -i build
Build completed unsuccessfully in 0:15:41

Is this a bug in the build process?

I'm on macOS 10.13.4, incidentally.

@Mark-Simulacrum
Copy link
Member

This shouldn't be related to extended being turned on, and somewhat feels like maybe an incremental bug? Though that would be a bit odd as we don't expect stage1 artifacts to be incrementally compiled (since we're constantly changing the compiler anyway).

@alexreg
Copy link
Contributor Author

alexreg commented Apr 30, 2018

@Mark-Simulacrum It doesn't happen with -i on for non-extended builds though, and it does happen for non-incremental extended builds.

@Mark-Simulacrum
Copy link
Member

Hm, I don't see an immediate reason of how this could be caused by bootstrap, so let's cc @eddyb and @nikomatsakis who perhaps will recognize the error. Odd that it doesn't happen with/without extended, though.

@eddyb
Copy link
Member

eddyb commented Apr 30, 2018

@alexcrichton or @nrc might know about this and a backtrace may show it's from save analysis.

@alexcrichton
Copy link
Member

I've seen this on a lot of builds with debug-assertions enabled (but they're turned off by default), otherwise I'm not sure what this is

@alexreg
Copy link
Contributor Author

alexreg commented Apr 30, 2018

@alexcrichton Yeah... I turned off debug-assertions and debuginfo and rustc builds now. The miri tool fails to build, however.

Building stage2 tool miri (x86_64-apple-darwin)
   Compiling miri v0.1.0 (file:///Users/alex/Software/rust/src/tools/miri)
   Compiling byteorder v1.2.2
error[E0432]: unresolved import `syntax::abi`
 --> tools/miri/miri/fn_call.rs:7:13
  |
7 | use syntax::abi::Abi;
  |             ^^^ Could not find `abi` in `syntax`

error[E0308]: match arms have incompatible types
   --> tools/miri/miri/fn_call.rs:178:25
    |
178 |           let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") {
    |  _________________________^
179 | |             Some(name) => name.as_str(),
180 | |             None => self.tcx.item_name(def_id),
    | |                     -------------------------- match arm with an incompatible type
181 | |         };
    | |_________^ expected struct `syntax::symbol::LocalInternedString`, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `syntax::symbol::LocalInternedString`
               found type `syntax::symbol::InternedString`

error[E0608]: cannot index into a value of type `syntax::symbol::InternedString`
  --> tools/miri/miri/intrinsic.rs:32:31
   |
32 |         let intrinsic_name = &self.tcx.item_name(instance.def_id())[..];
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0599]: no method named `to_ty` found for type `rustc::ty::layout::Primitive` in the current scope
   --> tools/miri/miri/validation.rs:461:47
    |
461 |                         return Ok(discr.value.to_ty(tcx))
    |                                               ^^^^^
    |
    = help: items from traits can only be used if the trait is in scope
    = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
            candidate #1: `use rustc::ty::layout::PrimitiveExt;`

error: aborting due to 4 previous errors

Some errors occurred: E0308, E0432, E0599, E0608.
For more information about an error, try `rustc --explain E0308`.
error: Could not compile `miri`.

@alexcrichton
Copy link
Member

Oh that's expected, the miri tool (and some others) aren't guaranteed to always build

@alexreg
Copy link
Contributor Author

alexreg commented Apr 30, 2018

Okay. Can I still use the resulting extended build as a rustup toolchain though, somehow?

@alexcrichton
Copy link
Member

I don't know, but others might

@alexreg
Copy link
Contributor Author

alexreg commented May 1, 2018

That would be good.

Anyway, this is very weird. Now the extended build of rustc is ICEing:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `8`,
 right: `4117`', librustc/ty/maps/on_disk_cache.rs:546:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Also, rls doesn't even build:

Building stage2 tool rls (x86_64-apple-darwin)
   Compiling rls v0.126.0 (file:///Users/alex/Software/rust/src/tools/rls)
error[E0432]: unresolved import `cargo::core::Profile`
  --> tools/rls/src/build/plan.rs:34:30
   |
34 | use cargo::core::{PackageId, Profile, Target, TargetKind};
   |                              ^^^^^^^ no `Profile` in `core`. Did you mean to use `profiles`?

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `rls`.

@alexreg
Copy link
Contributor Author

alexreg commented May 1, 2018

Okay, I've fixed the above in some PRs. :-)

@oli-obk
Copy link
Contributor

oli-obk commented Jul 1, 2018

Current state:

error: internal compiler error: librustc/ty/context.rs:272: 
node unknown node (id=905396)
with HirId::owner DefId(0/0:0 ~ core[38bb])
cannot be placed in TypeckTables
with local_id_root DefId(0/0:1845 ~ core[38bb]::panicking[0]::panic_fmt[0])

@oli-obk
Copy link
Contributor

oli-obk commented Jul 1, 2018

The issue seems to be having an extern lang item inside a function:

extern "Rust" {
    #[lang = "oom"]
    fn oom_impl(layout: Layout) -> !;
}

I still don't know why the "extended" build changes anything though.

@alexreg
Copy link
Contributor Author

alexreg commented Jul 1, 2018

No idea about extended... maybe we want to try again once the above issue is fixed?

@XAMPPRocky XAMPPRocky added A-build T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Oct 2, 2018
@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-build labels Apr 21, 2019
@jonas-schievink
Copy link
Contributor

I still don't know why the "extended" build changes anything though.

Could it be that extended = true will generate save-analysis data for libstd, which then runs into this?

@jonas-schievink jonas-schievink added A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Aug 25, 2019
@eddyb
Copy link
Member

eddyb commented Aug 25, 2019

Could it be that extended = true will generate save-analysis data for libstd, which then runs into this?

Yeah it will do that. In fact, it's how you test if you broke save-analysis.

@Xanewok
Copy link
Member

Xanewok commented Sep 7, 2019

The specific case of

extern "Rust" {
    #[lang = "oom"]
    fn oom_impl(layout: Layout) -> !;
}

might be the cause for the backtrace in the #43982 OP and it seems to have been fixed.

However, the extended build with debug-assertions is still failing, see #43982 (comment).

tmandry added a commit to tmandry/rust that referenced this issue Sep 10, 2019
… r=varkor

save-analysis: Nest typeck tables when processing functions/methods

Fixes an issue where we did not nest tables correctly when resolving
associated types in formal argument/return type positions.

This was the minimized reproduction case that I tested the fix on:
```rust
pub trait Trait {
    type Assoc;
}

pub struct A;

pub fn func() {
    fn _inner1<U: Trait>(_: U::Assoc) {}
    fn _inner2<U: Trait>() -> U::Assoc { unimplemented!() }

    impl A {
        fn _inner1<U: Trait>(self, _: U::Assoc) {}
        fn _inner2<U: Trait>(self) -> U::Assoc { unimplemented!() }
    }
}
```
using `debug_assertions`-enabled rustc and by additionally passing `-Zsave-analysis`.

Unfortunately the original assertion fired is a *debug* one and from what I can tell we don't run the tests with these on, so I'm not adding a test here. If I missed it and there is a way to run tests with these on, I'd love to add a test case for this.

Closes rust-lang#63663
Closes rust-lang#50328
Closes rust-lang#43982
@bors bors closed this as completed in 2e11e81 Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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.

8 participants