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

rustc 1.33.0-nightly (b2b7a063a 2019-01-01) compiler unexpectedly panics #57264

Closed
jonimake opened this issue Jan 2, 2019 · 7 comments
Closed
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jonimake
Copy link

jonimake commented Jan 2, 2019

2019-01-01 nightly toolchain fails to compile the following: https://github.com/jonimake/rust-settings-test
The problem is the let _ = config::File::with_name("Settings"); line in main.rs. Below is the command line output.

RUST_BACKTRACE=1 cargo build --verbose
       Fresh version_check v0.1.5
       Fresh cfg-if v0.1.6
       Fresh ucd-util v0.1.3
       Fresh lazy_static v1.2.0
       Fresh serde v0.8.23
       Fresh utf8-ranges v1.0.2
       Fresh lazy_static v0.2.11
       Fresh linked-hash-map v0.5.1
       Fresh itoa v0.4.3
       Fresh rust-ini v0.12.2
       Fresh regex-syntax v0.6.4
       Fresh thread_local v0.3.6
       Fresh serde_test v0.8.23
       Fresh yaml-rust v0.4.2
       Fresh libc v0.2.45
       Fresh num-traits v0.2.6
       Fresh serde v1.0.84
       Fresh ryu v0.2.7
       Fresh linked-hash-map v0.3.0
       Fresh memchr v2.1.2
       Fresh num-traits v0.1.43
       Fresh toml v0.4.10
       Fresh serde_json v1.0.34
       Fresh aho-corasick v0.6.9
       Fresh nom v4.1.1
       Fresh regex v1.1.0
       Fresh serde-hjson v0.8.2
       Fresh config v0.9.1
   Compiling rust-setting-test v0.1.0 (/home/joni/repos/personal/rust-settings-test)
     Running `rustc --edition=2018 --crate-name rust_setting_test src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7a08d1f1dbdfe01a -C extra-filename=-7a08d1f1dbdfe01a --out-dir /home/joni/repos/personal/rust-settings-test/target/debug/deps -C incremental=/home/joni/repos/personal/rust-settings-test/target/debug/incremental -L dependency=/home/joni/repos/personal/rust-settings-test/target/debug/deps --extern config=/home/joni/repos/personal/rust-settings-test/target/debug/deps/libconfig-566e0d7013e1820e.rlib`
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:747: Cannot create local mono-item for DefId(11/0:303 ~ config[bb47]::file[0]::{{impl}}[1]::with_name[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:590:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:482
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc_mir::monomorphize::collector::should_monomorphize_locally
  15: rustc_mir::monomorphize::collector::visit_instance_use
  16: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind
  17: rustc_mir::monomorphize::collector::collect_items_rec
  18: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
  19: rustc::util::common::time
  20: rustc_mir::monomorphize::collector::collect_crate_mono_items
  21: rustc::util::common::time
  22: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  23: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  24: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::collect_and_partition_mono_items<'tcx>>::compute
  25: rustc::dep_graph::graph::DepGraph::with_task_impl
  26: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
  29: rustc_codegen_ssa::base::codegen_crate
  30: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  31: rustc_driver::driver::phase_4_codegen
  32: rustc_driver::driver::compile_input::{{closure}}
  33: <std::thread::local::LocalKey<T>>::with
  34: rustc::ty::context::TyCtxt::create_and_enter
  35: rustc_driver::driver::compile_input
  36: rustc_driver::run_compiler_with_pool
  37: <scoped_tls::ScopedKey<T>>::set
  38: rustc_driver::run_compiler
  39: <scoped_tls::ScopedKey<T>>::set
  40: syntax::with_globals
  41: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:92
  42: <F as alloc::boxed::FnBox<A>>::call_box
  43: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/b2b7a063af39455d7362524da3123c34c3f4842e/src/liballoc/boxed.rs:734
             at src/libstd/sys_common/thread.rs:14
             at src/libstd/sys/unix/thread.rs:81
  44: start_thread
  45: __clone
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
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.33.0-nightly (b2b7a063a 2019-01-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `rust-setting-test`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name rust_setting_test src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7a08d1f1dbdfe01a -C extra-filename=-7a08d1f1dbdfe01a --out-dir /home/joni/repos/personal/rust-settings-test/target/debug/deps -C incremental=/home/joni/repos/personal/rust-settings-test/target/debug/incremental -L dependency=/home/joni/repos/personal/rust-settings-test/target/debug/deps --extern config=/home/joni/repos/personal/rust-settings-test/target/debug/deps/libconfig-566e0d7013e1820e.rlib` (exit code: 101)

@estebank estebank added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 2, 2019
@cramertj
Copy link
Member

cramertj commented Jan 2, 2019

I think this was caused by #56878, which seems to be causing some actually-reachable public functions to be identified as private (cc @petrochenkov). Specifically, the following code results in a warning "method is never used: new", but new is actually available to external crates, albeit causing an ICE when used:

pub mod pub_mod {
    use crate:;priv_mod::PubButUndexposedType;
    use std::marker::PhantomData;

    pub struct PubStruct<T>(PhantomData<T>);

    impl PubStruct<PubButUnexposedType> {
        pub fn new() -> Self { PubStruct(PhantomData) }
    }
}
mod priv_mod {
    pub struct PubButUnexposedType;
}

In a separate crate, it's possible to call PubStruct::new without naming PubButUnexposedType, making it visible. However, this results in an ICE, and the compiler thinks that new is unreachable and warns on its definition.

Adding a visible top-level re-export of PubButUnexposedType causes the warning and the ICE to go away.

@nagisa nagisa added the P-high High priority label Jan 3, 2019
@nagisa
Copy link
Member

nagisa commented Jan 3, 2019

Discussed at the T-compiler meeting. Proactively assigning @petrochenkov although bisecting would make sense to be sure as to what exact cause really is.

@petrochenkov
Copy link
Contributor

I'll look what happens.

@nikomatsakis
Copy link
Contributor

Bisecting just because it's easy to do. Will post the results.

@nikomatsakis
Copy link
Contributor

regression in nightly-2019-01-02

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jan 3, 2019

regression in fe6a54d, which is #56878, as @cramertj predicted

@petrochenkov
Copy link
Contributor

Fixed in #57344

bors added a commit that referenced this issue Jan 6, 2019
privacy: Fix regression in impl reachability

Rollback to pre-#56878 logic of determining reachability.
`reachability(impl Trait<Substs> for Type<Substs>) = reachability(Trait & Type)`, substs are ignored.

Fixes #57264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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

6 participants