Skip to content

ICE unwrap of None in src/librustc_hir/definitions.rs:356:9: trait-object-trait-parens.rs: with -Zsave-analysis #72267

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

reduced from ./src/test/ui/parser/trait-object-trait-parens.rs

fn main() {
    let _: Box<(?Sized)>;
}

Meta

rustc --version --verbose:

binary: rustc
commit-hash: a74d1862d4d87a56244958416fd05976c58ca1a8
commit-date: 2020-05-14
host: x86_64-unknown-linux-gnu
release: 1.45.0-nightly
LLVM version: 9.0

Error output

error: `?Trait` is not permitted in trait object types
 --> ./src/test/ui/parser/trait-object-trait-parens.rs:2:17
  |
2 |     let _: Box<(?Sized)>;
  |                 ^^^^^^

warning: trait objects without an explicit `dyn` are deprecated
 --> ./src/test/ui/parser/trait-object-trait-parens.rs:2:17
  |
2 |     let _: Box<(?Sized)>;
  |                 ^^^^^^ help: use `dyn`: `dyn ?Sized`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

error[E0224]: at least one trait is required for an object type
 --> ./src/test/ui/parser/trait-object-trait-parens.rs:2:17
  |
2 |     let _: Box<(?Sized)>;
  |                 ^^^^^^

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/librustc_hir/definitions.rs:356:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.45.0-nightly (a74d1862d 2020-05-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0224`.
Backtrace

error: `?Trait` is not permitted in trait object types
 --> ./src/test/ui/parser/trait-object-trait-parens.rs:2:17
  |
2 |     let _: Box<(?Sized)>;
  |                 ^^^^^^

warning: trait objects without an explicit `dyn` are deprecated
 --> ./src/test/ui/parser/trait-object-trait-parens.rs:2:17
  |
2 |     let _: Box<(?Sized)>;
  |                 ^^^^^^ help: use `dyn`: `dyn ?Sized`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

error[E0224]: at least one trait is required for an object type
 --> ./src/test/ui/parser/trait-object-trait-parens.rs:2:17
  |
2 |     let _: Box<(?Sized)>;
  |                 ^^^^^^

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/librustc_hir/definitions.rs:356:9
stack backtrace:
   0:     0x7f174f0912f4 - backtrace::backtrace::libunwind::trace::h98d3444f0ad70429
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7f174f0912f4 - backtrace::backtrace::trace_unsynchronized::h37f821d20053e6cd
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x7f174f0912f4 - std::sys_common::backtrace::_print_fmt::hff04dc7e915a3c85
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7f174f0912f4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61891c439a79f00d
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f174f0cf55c - core::fmt::write::hdf236390fbd68d3d
                               at src/libcore/fmt/mod.rs:1069
   5:     0x7f174f083033 - std::io::Write::write_fmt::h55f7fe3633ce766f
                               at src/libstd/io/mod.rs:1537
   6:     0x7f174f0964c5 - std::sys_common::backtrace::_print::h78339381acb79e1b
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f174f0964c5 - std::sys_common::backtrace::print::h525aa9f9405c80a1
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f174f0964c5 - std::panicking::default_hook::{{closure}}::hace90b8a218287e6
                               at src/libstd/panicking.rs:198
   9:     0x7f174f096217 - std::panicking::default_hook::h160b6beccc49b335
                               at src/libstd/panicking.rs:218
  10:     0x7f174f7a4b23 - rustc_driver::report_ice::h4f38da7fac8ebd4c
  11:     0x7f174f096b7d - std::panicking::rust_panic_with_hook::h36f6804eea3f553a
                               at src/libstd/panicking.rs:481
  12:     0x7f174f09675b - rust_begin_unwind
                               at src/libstd/panicking.rs:385
  13:     0x7f174f0cc1f1 - core::panicking::panic_fmt::hd101a87121fa411f
                               at src/libcore/panicking.rs:89
  14:     0x7f174f0cc13d - core::panicking::panic::h02171c407fa1462f
                               at src/libcore/panicking.rs:52
  15:     0x7f174f860849 - rustc_save_analysis::SaveContext::get_path_res::hf83402573bfa98d7
  16:     0x7f174f860972 - rustc_save_analysis::SaveContext::get_path_segment_data_with_id::h7d2b30ccbc41b299
  17:     0x7f174f8ad643 - rustc_save_analysis::dump_visitor::DumpVisitor::process_path::hc6b3a41819957575
  18:     0x7f174f8a52c3 - rustc_ast::visit::walk_ty::h812b0d7598d3c4b5
  19:     0x7f174f8a425d - rustc_ast::visit::walk_generic_args::he71c8a049b8097d7
  20:     0x7f174f8b80a1 - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_ty::h1bbfc4963f70f0b3
  21:     0x7f174f8a8005 - rustc_ast::visit::walk_stmt::h81cb9256713c304e
  22:     0x7f174f8b603f - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_item::h4354747b5f3d691f
  23:     0x7f174f8b0a8a - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_mod::h6c9a1e09b18401e7
  24:     0x7f174f7ab553 - rustc_ast::visit::walk_crate::h56f8cc2e3898fa92
  25:     0x7f174f77152d - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h977635684f24d988
  26:     0x7f174f771d2d - rustc_session::utils::<impl rustc_session::session::Session>::time::he49c63c8ce07be59
  27:     0x7f174f7a6d18 - rustc_middle::ty::context::tls::enter_global::hdd230e538fe73592
  28:     0x7f174f772b5f - rustc_interface::interface::run_compiler_in_existing_thread_pool::h38c97a796bc7c587
  29:     0x7f174f7b20cd - scoped_tls::ScopedKey<T>::set::h4c152c8c034324a4
  30:     0x7f174f7ab494 - rustc_ast::attr::with_globals::hff0725187a49e0cf
  31:     0x7f174f7b39be - std::sys_common::backtrace::__rust_begin_short_backtrace::h9fbc8c3bd1d70936
  32:     0x7f174f80dcbe - core::ops::function::FnOnce::call_once{{vtable.shim}}::h205b28cb8a6abd5a
  33:     0x7f174f0a6a8a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hb4fe39e1689c3de4
                               at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/liballoc/boxed.rs:1034
  34:     0x7f174f0a6a8a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hae1de892063d9208
                               at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/liballoc/boxed.rs:1034
  35:     0x7f174f0a6a8a - std::sys::unix::thread::Thread::new::thread_start::h8b0ae441dc3343d4
                               at src/libstd/sys/unix/thread.rs:87
  36:     0x7f174efba46f - start_thread
  37:     0x7f174eeda3d3 - clone
  38:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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.45.0-nightly (a74d1862d 2020-05-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0224`.

This issue has been assigned to @doctorn via this comment.

Metadata

Metadata

Assignees

Labels

A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions