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: asked to assemble builtin bounds of unexpected type: T non_lifetime_binders #108742

Closed
matthiaskrgr opened this issue Mar 4, 2023 · 1 comment · Fixed by #108744
Closed
Assignees
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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

matthiaskrgr commented Mar 4, 2023

Code

#![feature(non_lifetime_binders)]
trait X<'a, T>
where
    for<T> (T,): X<'b, str>,
    for<T> T: Clone,
{
    type U: ?Sized;
     final 
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (276b75a84 2023-03-04)
binary: rustc
commit-hash: 276b75a843af8822ffe4e395266d9445679a57a4
commit-date: 2023-03-04
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

error: non-item in item list
 --> 9850c90962de060208b975f23e6328a9228e80a9.rs:8:6
  |
6 | {
  | - item list starts here
7 |     type U: ?Sized;
8 |      final
  |      ^^^^^ non-item starts here
9 | }
  | - item list ends here

error[E0261]: use of undeclared lifetime name `'b`
 --> 9850c90962de060208b975f23e6328a9228e80a9.rs:4:20
  |
4 |     for<T> (T,): X<'b, str>,
  |                    ^^ undeclared lifetime
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'b` lifetime
  |
4 |     for<T> (T,): for<'b> X<'b, str>,
  |                  +++++++
help: consider making the bound lifetime-generic with a new `'b` lifetime
  |
4 |     for<'b, T> (T,): X<'b, str>,
  |         +++
help: consider introducing lifetime `'b` here
  |
2 | trait X<'b, 'a, T>
  |         +++

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> 9850c90962de060208b975f23e6328a9228e80a9.rs:1:12
  |
1 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default
Backtrace


error: internal compiler error: compiler/rustc_trait_selection/src/traits/select/mod.rs:2275:17: asked to assemble builtin bounds of unexpected type: T

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/276b75a843af8822ffe4e395266d9445679a57a4/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7fdf0e96731a - std::backtrace_rs::backtrace::libunwind::trace::ha0b5b2ec62b5f7eb
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fdf0e96731a - std::backtrace_rs::backtrace::trace_unsynchronized::hfe092e735c972e7d
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fdf0e96731a - std::sys_common::backtrace::_print_fmt::h63b3d4522a0717d3
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fdf0e96731a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8181b48b7caaac69
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fdf0e9cab6e - core::fmt::write::h26d08fb661ce6712
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fdf0e95a2c5 - std::io::Write::write_fmt::hb9eb4062a2267a70
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/io/mod.rs:1684:15
   6:     0x7fdf0e9670e5 - std::sys_common::backtrace::_print::hcd4093e79b5f3c88
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fdf0e9670e5 - std::sys_common::backtrace::print::h3741bf27e30883c8
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fdf0e969e5f - std::panicking::default_hook::{{closure}}::h313aeead3fa63dc9
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/panicking.rs:271:22
   9:     0x7fdf0e969b9b - std::panicking::default_hook::h741e5add290d4582
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/panicking.rs:290:9
  10:     0x7fdf11bcc745 - <rustc_driver_impl[8dfe1fc355efc7d7]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[546e85f3c7d3dc7d]::ops::function::FnOnce<(&core[546e85f3c7d3dc7d]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fdf0e96a69d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8a71253e78811240
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/alloc/src/boxed.rs:2001:9
  12:     0x7fdf0e96a69d - std::panicking::rust_panic_with_hook::ha625c2834fbe1381
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/panicking.rs:696:13
  13:     0x7fdf12128ee1 - std[c918092902fea026]::panicking::begin_panic::<rustc_errors[1bd8d0818954bdfa]::ExplicitBug>::{closure#0}
  14:     0x7fdf12121816 - std[c918092902fea026]::sys_common::backtrace::__rust_end_short_backtrace::<std[c918092902fea026]::panicking::begin_panic<rustc_errors[1bd8d0818954bdfa]::ExplicitBug>::{closure#0}, !>
  15:     0x7fdf12197a76 - std[c918092902fea026]::panicking::begin_panic::<rustc_errors[1bd8d0818954bdfa]::ExplicitBug>
  16:     0x7fdf121750c6 - std[c918092902fea026]::panic::panic_any::<rustc_errors[1bd8d0818954bdfa]::ExplicitBug>
  17:     0x7fdf12170b26 - <rustc_errors[1bd8d0818954bdfa]::HandlerInner>::bug::<&alloc[be2f7de4eeee214f]::string::String>
  18:     0x7fdf121707f0 - <rustc_errors[1bd8d0818954bdfa]::Handler>::bug::<&alloc[be2f7de4eeee214f]::string::String>
  19:     0x7fdf1216799b - rustc_middle[26362df4813740c2]::util::bug::opt_span_bug_fmt::<rustc_span[9747052e8b44f4f1]::span_encoding::Span>::{closure#0}
  20:     0x7fdf121662ea - rustc_middle[26362df4813740c2]::ty::context::tls::with_opt::<rustc_middle[26362df4813740c2]::util::bug::opt_span_bug_fmt<rustc_span[9747052e8b44f4f1]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fdf121662b6 - rustc_middle[26362df4813740c2]::ty::context::tls::with_context_opt::<rustc_middle[26362df4813740c2]::ty::context::tls::with_opt<rustc_middle[26362df4813740c2]::util::bug::opt_span_bug_fmt<rustc_span[9747052e8b44f4f1]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fdf121678e6 - rustc_middle[26362df4813740c2]::util::bug::opt_span_bug_fmt::<rustc_span[9747052e8b44f4f1]::span_encoding::Span>
  23:     0x7fdf102c8683 - rustc_middle[26362df4813740c2]::util::bug::bug_fmt
  24:     0x7fdf102db643 - <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::copy_clone_conditions
  25:     0x7fdf102df9ad - <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::assemble_candidates
  26:     0x7fdf106ef44e - <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  27:     0x7fdf106ee82f - <rustc_query_system[880cf4cc5243faaf]::dep_graph::graph::DepGraph<rustc_middle[26362df4813740c2]::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle[26362df4813740c2]::ty::context::TyCtxt, <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<core[546e85f3c7d3dc7d]::option::Option<rustc_middle[26362df4813740c2]::traits::select::SelectionCandidate>, rustc_middle[26362df4813740c2]::traits::SelectionError>>::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<core[546e85f3c7d3dc7d]::option::Option<rustc_middle[26362df4813740c2]::traits::select::SelectionCandidate>, rustc_middle[26362df4813740c2]::traits::SelectionError>>
  28:     0x7fdf106e9b81 - <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::evaluate_stack
  29:     0x7fdf106e7f4f - <rustc_query_system[880cf4cc5243faaf]::dep_graph::graph::DepGraph<rustc_middle[26362df4813740c2]::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle[26362df4813740c2]::ty::context::TyCtxt, <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#2}, core[546e85f3c7d3dc7d]::result::Result<rustc_middle[26362df4813740c2]::traits::select::EvaluationResult, rustc_middle[26362df4813740c2]::traits::select::OverflowError>>::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<rustc_middle[26362df4813740c2]::traits::select::EvaluationResult, rustc_middle[26362df4813740c2]::traits::select::OverflowError>>
  30:     0x7fdf107fa001 - <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::evaluate_predicate_recursively
  31:     0x7fdf107f7b23 - <rustc_infer[69b66cd70457bffb]::infer::InferCtxt>::probe::<core[546e85f3c7d3dc7d]::result::Result<rustc_middle[26362df4813740c2]::traits::select::EvaluationResult, rustc_middle[26362df4813740c2]::traits::select::OverflowError>, <rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection[fb7b454a414b0aef]::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>::{closure#0}>
  32:     0x7fdf101d833e - rustc_traits[aa201a8a808e32a4]::evaluate_obligation::evaluate_obligation
  33:     0x7fdf101d4977 - rustc_query_system[880cf4cc5243faaf]::query::plumbing::try_execute_query::<rustc_query_impl[3d069ec1855645b3]::queries::evaluate_obligation, rustc_query_impl[3d069ec1855645b3]::plumbing::QueryCtxt>
  34:     0x7fdf102f9ff3 - <rustc_infer[69b66cd70457bffb]::infer::InferCtxt as rustc_trait_selection[fb7b454a414b0aef]::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_considering_regions
  35:     0x7fdf10285826 - <rustc_trait_selection[fb7b454a414b0aef]::traits::fulfill::FulfillProcessor as rustc_data_structures[4afc62e9276c9f3a]::obligation_forest::ObligationProcessor>::process_obligation
  36:     0x7fdf1027d194 - <rustc_data_structures[4afc62e9276c9f3a]::obligation_forest::ObligationForest<rustc_trait_selection[fb7b454a414b0aef]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[fb7b454a414b0aef]::traits::fulfill::FulfillProcessor>
  37:     0x7fdf10806e70 - <rustc_trait_selection[fb7b454a414b0aef]::traits::engine::ObligationCtxt>::select_all_or_error
  38:     0x7fdf109d4dd0 - rustc_hir_analysis[e3526768c08ece23]::check::wfcheck::check_trait
  39:     0x7fdf109af880 - rustc_hir_analysis[e3526768c08ece23]::check::wfcheck::check_well_formed
  40:     0x7fdf1021bffc - rustc_query_system[880cf4cc5243faaf]::query::plumbing::try_execute_query::<rustc_query_impl[3d069ec1855645b3]::queries::check_well_formed, rustc_query_impl[3d069ec1855645b3]::plumbing::QueryCtxt>
  41:     0x7fdf11053b4f - rustc_data_structures[4afc62e9276c9f3a]::sync::par_for_each_in::<&[rustc_hir[edb09612bbfbfb3b]::hir::ImplItemId], <rustc_middle[26362df4813740c2]::hir::ModuleItems>::par_impl_items<rustc_hir_analysis[e3526768c08ece23]::check::wfcheck::check_mod_type_wf::{closure#1}>::{closure#0}>
  42:     0x7fdf11053720 - rustc_hir_analysis[e3526768c08ece23]::check::wfcheck::check_mod_type_wf
  43:     0x7fdf11251be1 - rustc_query_system[880cf4cc5243faaf]::query::plumbing::try_execute_query::<rustc_query_impl[3d069ec1855645b3]::queries::check_mod_type_wf, rustc_query_impl[3d069ec1855645b3]::plumbing::QueryCtxt>
  44:     0x7fdf1125178a - <rustc_query_impl[3d069ec1855645b3]::Queries as rustc_middle[26362df4813740c2]::ty::query::QueryEngine>::check_mod_type_wf
  45:     0x7fdf1001f818 - rustc_data_structures[4afc62e9276c9f3a]::sync::par_for_each_in::<&[rustc_hir[edb09612bbfbfb3b]::hir_id::OwnerId], <rustc_middle[26362df4813740c2]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[e3526768c08ece23]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  46:     0x7fdf1001f6a0 - <rustc_session[225f4463efaf2720]::session::Session>::track_errors::<rustc_hir_analysis[e3526768c08ece23]::check_crate::{closure#5}, ()>
  47:     0x7fdf1001c430 - rustc_hir_analysis[e3526768c08ece23]::check_crate
  48:     0x7fdf100121c2 - rustc_interface[d9b7636f56c3f156]::passes::analysis
  49:     0x7fdf1142bd9d - rustc_query_system[880cf4cc5243faaf]::query::plumbing::try_execute_query::<rustc_query_impl[3d069ec1855645b3]::queries::analysis, rustc_query_impl[3d069ec1855645b3]::plumbing::QueryCtxt>
  50:     0x7fdf1142ba9f - <rustc_query_impl[3d069ec1855645b3]::Queries as rustc_middle[26362df4813740c2]::ty::query::QueryEngine>::analysis
  51:     0x7fdf11256166 - <rustc_middle[26362df4813740c2]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[8dfe1fc355efc7d7]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>>
  52:     0x7fdf10e3baa8 - rustc_span[9747052e8b44f4f1]::with_source_map::<core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>, rustc_interface[d9b7636f56c3f156]::interface::run_compiler<core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>, rustc_driver_impl[8dfe1fc355efc7d7]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  53:     0x7fdf10e3312c - std[c918092902fea026]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d9b7636f56c3f156]::util::run_in_thread_pool_with_globals<rustc_interface[d9b7636f56c3f156]::interface::run_compiler<core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>, rustc_driver_impl[8dfe1fc355efc7d7]::run_compiler::{closure#1}>::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>>
  54:     0x7fdf10e32b5a - <<std[c918092902fea026]::thread::Builder>::spawn_unchecked_<rustc_interface[d9b7636f56c3f156]::util::run_in_thread_pool_with_globals<rustc_interface[d9b7636f56c3f156]::interface::run_compiler<core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>, rustc_driver_impl[8dfe1fc355efc7d7]::run_compiler::{closure#1}>::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[546e85f3c7d3dc7d]::result::Result<(), rustc_span[9747052e8b44f4f1]::ErrorGuaranteed>>::{closure#1} as core[546e85f3c7d3dc7d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  55:     0x7fdf0e974593 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h60b30d695443d159
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/alloc/src/boxed.rs:1987:9
  56:     0x7fdf0e974593 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8728245852e6989e
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/alloc/src/boxed.rs:1987:9
  57:     0x7fdf0e974593 - std::sys::unix::thread::Thread::new::thread_start::h960d7bf108545d46
                               at /rustc/276b75a843af8822ffe4e395266d9445679a57a4/library/std/src/sys/unix/thread.rs:108:17
  58:     0x7fdf0e706bb5 - <unknown>
  59:     0x7fdf0e788d90 - <unknown>
  60:                0x0 - <unknown>

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.69.0-nightly (276b75a84 2023-03-04) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `T: core::clone::Clone`
#1 [check_well_formed] checking that `X` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

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

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` labels Mar 4, 2023
@compiler-errors
Copy link
Member

Minimal:

#![feature(non_lifetime_binders)]

fn foo() where for<T> T: Copy {}

fn main() {
    foo();
}

@rustbot claim

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-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants