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

ICE: instantiated twice #63279

Closed
hellow554 opened this issue Aug 5, 2019 · 2 comments · Fixed by #66331
Closed

ICE: instantiated twice #63279

hellow554 opened this issue Aug 5, 2019 · 2 comments · Fixed by #66331
Labels
A-closures Area: Closures (`|…| { … }`) A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hellow554
Copy link
Contributor

While minimizing #63263 I stumbled upon another ICE

#![feature(type_alias_impl_trait)]

type Closure = impl FnOnce();

fn c() -> Closure {
    || -> Closure { || () }
}

fn main() {}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at 'instantiated twice: DefId(0:12 ~ playground[1d12]::Closure[0])/OpaqueTypeDecl { substs: [], definition_span: src/main.rs:6:11: 6:18, concrete_ty: _, has_required_region_bounds: false, origin: TypeAlias }', src/librustc_typeck/check/mod.rs:2506:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   9: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:339
  10: rustc_typeck::check::FnCtxt::instantiate_opaque_types_from_value
  11: rustc_typeck::check::check_fn
  12: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
  13: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  14: rustc_typeck::check::FnCtxt::check_block_with_expected
  15: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  16: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  17: rustc_typeck::check::check_fn
  18: rustc::ty::context::GlobalCtxt::enter_local
  19: rustc_typeck::check::typeck_tables_of
  20: rustc::ty::query::__query_compute::typeck_tables_of
  21: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  22: rustc::dep_graph::graph::DepGraph::with_task_impl
  23: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  24: rustc_typeck::collect::find_opaque_ty_constraints::ConstraintLocator::check
  25: rustc::hir::intravisit::Visitor::visit_nested_item
  26: rustc_typeck::collect::find_opaque_ty_constraints
  27: rustc_typeck::collect::checked_type_of
  28: rustc_typeck::collect::type_of
  29: rustc::ty::query::__query_compute::type_of
  30: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  31: rustc::dep_graph::graph::DepGraph::with_task_impl
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  33: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item
  34: rustc::hir::map::Map::visit_item_likes_in_module
  35: rustc_typeck::collect::collect_mod_item_types
  36: rustc::ty::query::__query_compute::collect_mod_item_types
  37: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
  38: rustc::dep_graph::graph::DepGraph::with_task_impl
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  40: rustc_typeck::check_crate::{{closure}}::{{closure}}
  41: rustc::util::common::time
  42: rustc_typeck::check_crate
  43: rustc_interface::passes::analysis
  44: rustc::ty::query::__query_compute::analysis
  45: rustc::dep_graph::graph::DepGraph::with_task_impl
  46: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  47: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  48: rustc_interface::passes::create_global_ctxt::{{closure}}
  49: rustc_interface::interface::run_compiler_in_existing_thread_pool
  50: std::thread::local::LocalKey<T>::with
  51: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [typeck_tables_of] processing `c`
#1 [type_of] processing `Closure`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack

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.38.0-nightly (d3f8a0b5d 2019-08-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
@hellow554

This comment has been minimized.

@rustbot rustbot added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-closures Area: Closures (`|…| { … }`) F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` labels Aug 5, 2019
@jonas-schievink jonas-schievink added the requires-nightly This issue requires a nightly compiler in some way. label Aug 5, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
@JohnTitor
Copy link
Member

The ICE doesn't appear on the latest nightly

@jonas-schievink jonas-schievink added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 26, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this issue Nov 13, 2019
Add some tests for fixed ICEs

Closes rust-lang#30904 (fixed between nightly-2019-07-14 and nightly-2019-07-31)
Closes rust-lang#40231 (example 1 is fixed in 1.32.0, example 2 is fixed in 1.38.0)
Closes rust-lang#52432 (fixed in rustc 1.40.0-beta.1 (76b4053 2019-11-05))
Closes rust-lang#63279 (fixed in rustc 1.40.0-nightly (246be7e 2019-10-25))

r? @Centril
JohnTitor added a commit to JohnTitor/rust that referenced this issue Nov 13, 2019
Add some tests for fixed ICEs

Closes rust-lang#30904 (fixed between nightly-2019-07-14 and nightly-2019-07-31)
Closes rust-lang#40231 (example 1 is fixed in 1.32.0, example 2 is fixed in 1.38.0)
Closes rust-lang#52432 (fixed in rustc 1.40.0-beta.1 (76b4053 2019-11-05))
Closes rust-lang#63279 (fixed in rustc 1.40.0-nightly (246be7e 2019-10-25))

r? @Centril
@bors bors closed this as completed in 5683fe5 Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

Successfully merging a pull request may close this issue.

5 participants