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: impl-with-unconstrained-param.rs -Zsave-analysis --emit=mir : Err value: UnresolvedTy(_#0t) #87340

Closed
matthiaskrgr opened this issue Jul 21, 2021 · 1 comment · Fixed by #94081
Labels
C-bug Category: This is a bug. 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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

code from src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs (may no longer exist)

#![feature(type_alias_impl_trait)]

trait X {
    type I;
    fn f() -> Self::I;
}

impl<T> X for () {
    type I = impl Sized;
    //~^ ERROR could not find defining uses
    fn f() -> Self::I {}
    //~^ ERROR type annotations needed
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.55.0-nightly (014026d1a 2021-07-19)
binary: rustc
commit-hash: 014026d1a7ca991f82f12efa95ef4dffb29dc8af
commit-date: 2021-07-19
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1

Error output

error[E0658]: `impl Trait` in type aliases is unstable
  --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:12:14
   |
12 |     type I = impl Sized;
   |              ^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:4:12
  |
4 | #![feature(type_alias_impl_trait)]
  |            ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information

error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
  --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:11:6
   |
11 | impl<T> X for () {
   |      ^ unconstrained type parameter

error[E0282]: type annotations needed
  --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:14:23
   |
14 |     fn f() -> Self::I {}
   |                       ^^ cannot infer type for type parameter `T`

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: UnresolvedTy(_#0t)', compiler/rustc_typeck/src/check/writeback.rs:499:75
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.55.0-nightly (014026d1a 2021-07-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [typeck] type-checking `<impl at ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:11:1: 16:2>::f`
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
Backtrace

error[E0658]: `impl Trait` in type aliases is unstable
  --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:12:14
   |
12 |     type I = impl Sized;
   |              ^^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:4:12
  |
4 | #![feature(type_alias_impl_trait)]
  |            ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information

error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
  --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:11:6
   |
11 | impl<T> X for () {
   |      ^ unconstrained type parameter

error[E0282]: type annotations needed
  --> ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:14:23
   |
14 |     fn f() -> Self::I {}
   |                       ^^ cannot infer type for type parameter `T`

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: UnresolvedTy(_#0t)', compiler/rustc_typeck/src/check/writeback.rs:499:75
stack backtrace:
   0:     0x7f0497f07b90 - std::backtrace_rs::backtrace::libunwind::trace::h0f5cd2ee8b0d7274
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f0497f07b90 - std::backtrace_rs::backtrace::trace_unsynchronized::h06905b5aeda069a1
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0497f07b90 - std::sys_common::backtrace::_print_fmt::h4fe4c7c875072f30
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f0497f07b90 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcc0746f004a9b7ef
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f0497f756cc - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/core/src/fmt/mod.rs:1115:17
   5:     0x7f0497ef9315 - std::io::Write::write_fmt::h23dab4cc9ce72ee2
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/io/mod.rs:1665:15
   6:     0x7f0497f0b8ab - std::sys_common::backtrace::_print::h173dc702502d65d2
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f0497f0b8ab - std::sys_common::backtrace::print::h61bd27c4742ba817
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f0497f0b8ab - std::panicking::default_hook::{{closure}}::hcaae87f0495ae613
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/panicking.rs:208:50
   9:     0x7f0497f0b381 - std::panicking::default_hook::h0538e728ee080db0
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/panicking.rs:225:9
  10:     0x7f04986e4e91 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h9137b7ac1a66352b
  11:     0x7f0497f0c0d9 - std::panicking::rust_panic_with_hook::h3039e236b6ca482c
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/panicking.rs:626:17
  12:     0x7f0497f0bb97 - std::panicking::begin_panic_handler::{{closure}}::h884fbab544ffd91c
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/panicking.rs:519:13
  13:     0x7f0497f0808c - std::sys_common::backtrace::__rust_end_short_backtrace::hdaf2e18ba3d91210
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f0497f0baf9 - rust_begin_unwind
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/panicking.rs:515:5
  15:     0x7f0497ed6b71 - core::panicking::panic_fmt::hcf5f6d96e1dd7099
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/core/src/panicking.rs:92:14
  16:     0x7f0497ed6c63 - core::result::unwrap_failed::he898b02f57993c42
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/core/src/result.rs:1599:5
  17:     0x7f0499988b79 - rustc_typeck::check::writeback::WritebackCx::visit_opaque_types::h232a08fae1c90ee2
  18:     0x7f04998e6fcf - rustc_typeck::check::writeback::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::resolve_type_vars_in_body::h8b54c18e0f3a4b79
  19:     0x7f0499963887 - rustc_infer::infer::InferCtxtBuilder::enter::h5b0049019ece2d91
  20:     0x7f04999c25f0 - rustc_typeck::check::typeck::h45b639d5069c89f7
  21:     0x7f0499d73a8c - rustc_query_system::query::plumbing::get_query_impl::h475bb642f2deb506
  22:     0x7f0499de5c3b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck::h34bb83bc2eb7a080
  23:     0x7f0498735d79 - rustc_save_analysis::dump_visitor::DumpVisitor::process_method::hc8aa5dbea4311631
  24:     0x7f0498738766 - rustc_save_analysis::dump_visitor::DumpVisitor::process_impl_item::h59b684c892943cde
  25:     0x7f0498734253 - rustc_save_analysis::dump_visitor::DumpVisitor::nest_typeck_results::h253be14039dac37b
  26:     0x7f049873b40c - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_item::h9b52cebc0df4f7b9
  27:     0x7f0498733216 - rustc_hir::intravisit::Visitor::visit_nested_item::h9e975cc0f2a00c21
  28:     0x7f0498720bb1 - rustc_hir::intravisit::walk_crate::he7f189f23867b6fd
  29:     0x7f0498738b70 - rustc_save_analysis::dump_visitor::DumpVisitor::process_crate::h8b9b619ce8c21fa3
  30:     0x7f0498713f5b - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h411459e0c11e6a97
  31:     0x7f0498716487 - std::thread::local::LocalKey<T>::with::h12d2413a7a54a096
  32:     0x7f04986e6d87 - rustc_save_analysis::process_crate::hbe9c7d8fa9d24483
  33:     0x7f04986f14b7 - rustc_session::utils::<impl rustc_session::session::Session>::time::ha6483c63bbc8b307
  34:     0x7f049a1e56d8 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hc31f40c1543d1436
  35:     0x7f049a1d3dcc - rustc_span::with_source_map::h0260ea075482ae79
  36:     0x7f049a1e61ba - rustc_interface::interface::create_compiler_and_run::he7ef8517199cf024
  37:     0x7f049a1d9099 - scoped_tls::ScopedKey<T>::set::h603cbfb5f6e2dd76
  38:     0x7f049a1d5eda - std::sys_common::backtrace::__rust_begin_short_backtrace::h23393d8936f34bfc
  39:     0x7f049a1d4765 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h513135f67ecd4e6b
  40:     0x7f0497f18667 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd5b860c6542b008a
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/alloc/src/boxed.rs:1572:9
  41:     0x7f0497f18667 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc87b98c8a3a585ed
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/alloc/src/boxed.rs:1572:9
  42:     0x7f0497f18667 - std::sys::unix::thread::Thread::new::thread_start::ha990175c8f3779cc
                               at /rustc/014026d1a7ca991f82f12efa95ef4dffb29dc8af/library/std/src/sys/unix/thread.rs:74:17
  43:     0x7f0497e24259 - start_thread
  44:     0x7f0497d395e3 - __GI___clone
  45:                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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.55.0-nightly (014026d1a 2021-07-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [typeck] type-checking `<impl at ./src/test/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs:11:1: 16:2>::f`
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

Some errors have detailed explanations: E0207, E0282, E0658.
For more information about an error, try `rustc --explain E0207`.

@matthiaskrgr matthiaskrgr added 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. labels Jul 21, 2021
@jackh726 jackh726 added the F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` label Jul 21, 2021
@chengniansun
Copy link

Code

type PartiallyDefined<T> = impl 'static;
fn partially_defined() -> PartiallyDefined<_> {}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (9c25eb7aa 2021-07-25)
binary: rustc
commit-hash: 9c25eb7aa3a71fb951564b0ddf131be59c2c951d
commit-date: 2021-07-25
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

Error output

error: at least one trait must be specified
 --> mutant.rs:1:28
  |
1 | type PartiallyDefined<T> = impl 'static;
  |                            ^^^^^^^^^^^^

error[E0658]: `impl Trait` in type aliases is unstable
 --> mutant.rs:1:28
  |
1 | type PartiallyDefined<T> = impl 'static;
  |                            ^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: UnresolvedTy(_#0t)', compiler/rustc_typeck/src/check/writeback.rs:499:75
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.56.0-nightly (9c25eb7aa 2021-07-25) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
#0 [typeck] type-checking `partially_defined`
#1 [fn_sig] computing function signature of `partially_defined`
end of query stack
error: aborting due to 2 previous errors

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

error: at least one trait must be specified
 --> mutant.rs:1:28
  |
1 | type PartiallyDefined<T> = impl 'static;
  |                            ^^^^^^^^^^^^

error[E0658]: `impl Trait` in type aliases is unstable
 --> mutant.rs:1:28
  |
1 | type PartiallyDefined<T> = impl 'static;
  |                            ^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: UnresolvedTy(_#0t)', compiler/rustc_typeck/src/check/writeback.rs:499:75
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9c25eb7aa3a71fb951564b0ddf131be59c2c951d/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/9c25eb7aa3a71fb951564b0ddf131be59c2c951d/library/core/src/panicking.rs:92:14
   2: core::result::unwrap_failed
             at /rustc/9c25eb7aa3a71fb951564b0ddf131be59c2c951d/library/core/src/result.rs:1599:5
   3: rustc_typeck::check::writeback::WritebackCx::visit_opaque_types
   4: rustc_typeck::check::writeback::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
   5: rustc_infer::infer::InferCtxtBuilder::enter
   6: rustc_typeck::check::typeck
   7: rustc_query_system::query::plumbing::get_query_impl
   8: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
   9: rustc_typeck::collect::fn_sig
  10: rustc_query_system::query::plumbing::get_query_impl
  11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::fn_sig
  12: rustc_typeck::collect::convert_item
  13: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  14: rustc_middle::hir::map::Map::visit_item_likes_in_module
  15: rustc_typeck::collect::collect_mod_item_types
  16: rustc_query_system::query::plumbing::get_query_impl
  17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  18: rustc_session::session::Session::track_errors
  19: rustc_typeck::check_crate
  20: rustc_interface::passes::analysis
  21: rustc_query_system::query::plumbing::get_query_impl
  22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  23: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  24: rustc_span::with_source_map
  25: rustc_interface::interface::create_compiler_and_run
  26: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.56.0-nightly (9c25eb7aa 2021-07-25) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
#0 [typeck] type-checking `partially_defined`
#1 [fn_sig] computing function signature of `partially_defined`
#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: aborting due to 2 previous errors

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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) ❄️ 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.

4 participants