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: unexpected builtin trait with associated type: <{closure@./... } as Fn> #127746

Closed
Naserume opened this issue Jul 15, 2024 · 3 comments · Fixed by #128160
Closed

ICE: unexpected builtin trait with associated type: <{closure@./... } as Fn> #127746

Naserume opened this issue Jul 15, 2024 · 3 comments · Fixed by #128160
Labels
A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) C-bug Category: This is a bug. F-auto_traits `#![feature(auto_traits)]` 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

@Naserume
Copy link

Code

#![feature(auto_traits)]
#![feature(unboxed_closures)]

trait T {}

fn f() -> impl Fn(T) {
    let p = ();
    |_| p
}

auto trait Fn {
    type Output;
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (fcaa6fdfb 2024-07-13)
binary: rustc
commit-hash: fcaa6fdfbee1316184e7ad98c53241d52cd30a5f
commit-date: 2024-07-13
host: x86_64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7

Error output

error[E0380]: auto traits cannot have associated items
  --> ./6A4A7.rs:12:10
   |
11 | auto trait Fn {
   |            -- auto traits cannot have associated items
12 |     type Output; //~ ERROR E0380
   |     -----^^^^^^- help: remove these associated items

error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
  --> ./6A4A7.rs:6:16
   |
6  | fn f() -> impl Fn(T) {
   |                ^^--- help: remove these parenthetical generics
   |                |
   |                expected 0 generic arguments
   |
note: trait defined here, with 0 generic parameters
  --> ./6A4A7.rs:11:12
   |
11 | auto trait Fn {
   |            ^^

Backtrace

error: internal compiler error: compiler/rustc_trait_selection/src/traits/project.rs:1206:21: unexpected builtin trait with associated type: <{closure@./6A4A7.rs:8:5: 8:8} as Fn>

thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/project.rs:1206:21:
Box<dyn Any>
stack backtrace:
   0:        0x10f6f6373 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h605d51fc858e32d3
   1:        0x10f7412fb - core::fmt::write::he70b1f5b242a09e4
   2:        0x10f6ec0be - std::io::Write::write_fmt::hbfde528b9dfff91a
   3:        0x10f6f8c1a - std::panicking::default_hook::{{closure}}::hfdc91bfcaaf40c09
   4:        0x10f6f88ca - std::panicking::default_hook::h8673ceadddb8316e
   5:        0x118a7d8dc - std[8bfe66706d3bd117]::panicking::update_hook::<alloc[ea04c33bd6f71985]::boxed::Box<rustc_driver_impl[d8a49a9463f03e6]::install_ice_hook::{closure#0}>>::{closure#0}
   6:        0x10f6f9a09 - std::panicking::rust_panic_with_hook::h206b639ed4704bb1
   7:        0x118af0bb7 - std[8bfe66706d3bd117]::panicking::begin_panic::<rustc_errors[7f155011d809a3bf]::ExplicitBug>::{closure#0}
   8:        0x118adc9f9 - std[8bfe66706d3bd117]::sys::backtrace::__rust_end_short_backtrace::<std[8bfe66706d3bd117]::panicking::begin_panic<rustc_errors[7f155011d809a3bf]::ExplicitBug>::{closure#0}, !>
   9:        0x11d557469 - std[8bfe66706d3bd117]::panicking::begin_panic::<rustc_errors[7f155011d809a3bf]::ExplicitBug>
  10:        0x118b02c06 - <rustc_errors[7f155011d809a3bf]::diagnostic::BugAbort as rustc_errors[7f155011d809a3bf]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:        0x1197c8b45 - rustc_middle[66eaac359ba8a608]::util::bug::opt_span_bug_fmt::<rustc_span[9df13b32b3ae4eb2]::span_encoding::Span>::{closure#0}
  12:        0x11977f0b7 - rustc_middle[66eaac359ba8a608]::ty::context::tls::with_opt::<rustc_middle[66eaac359ba8a608]::util::bug::opt_span_bug_fmt<rustc_span[9df13b32b3ae4eb2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:        0x11977ebf5 - rustc_middle[66eaac359ba8a608]::ty::context::tls::with_context_opt::<rustc_middle[66eaac359ba8a608]::ty::context::tls::with_opt<rustc_middle[66eaac359ba8a608]::util::bug::opt_span_bug_fmt<rustc_span[9df13b32b3ae4eb2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:        0x11d61ff9b - rustc_middle[66eaac359ba8a608]::util::bug::bug_fmt
  15:        0x11a7ce9a0 - rustc_trait_selection[bf739c384407ce51]::traits::project::opt_normalize_projection_term
  16:        0x11a5db9be - <rustc_infer[3da7f7f7e3fca22e]::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection[bf739c384407ce51]::traits::project::ProjectAndUnifyResult, rustc_infer[3da7f7f7e3fca22e]::traits::project::MismatchedProjectionTypes, rustc_trait_selection[bf739c384407ce51]::traits::project::poly_project_and_unify_term::{closure#0}>
  17:        0x11a72a112 - <rustc_trait_selection[bf739c384407ce51]::traits::fulfill::FulfillProcessor>::process_projection_obligation
  18:        0x11a7c016f - <rustc_trait_selection[bf739c384407ce51]::traits::fulfill::FulfillProcessor as rustc_data_structures[1d3e240332809550]::obligation_forest::ObligationProcessor>::process_obligation
  19:        0x118ed2759 - <rustc_data_structures[1d3e240332809550]::obligation_forest::ObligationForest<rustc_trait_selection[bf739c384407ce51]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[bf739c384407ce51]::traits::fulfill::FulfillProcessor>
  20:        0x118fcb9b2 - <rustc_trait_selection[bf739c384407ce51]::traits::fulfill::FulfillmentContext<rustc_trait_selection[bf739c384407ce51]::traits::FulfillmentError> as rustc_infer[3da7f7f7e3fca22e]::traits::engine::TraitEngine<rustc_trait_selection[bf739c384407ce51]::traits::FulfillmentError>>::select_where_possible
  21:        0x11912a8c2 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::resolve_vars_with_obligations
  22:        0x119133aa2 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::try_structurally_resolve_type
  23:        0x119022626 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::coerce
  24:        0x11910c014 - <rustc_hir_typeck[a7633e0d641b9efc]::coercion::CoerceMany<&rustc_hir[d0540023df9f77a9]::hir::Expr>>::coerce_inner::<<rustc_hir_typeck[a7633e0d641b9efc]::coercion::CoerceMany<&rustc_hir[d0540023df9f77a9]::hir::Expr>>::coerce::{closure#0}>
  25:        0x119040d9a - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_return_expr
  26:        0x119101e36 - rustc_hir_typeck[a7633e0d641b9efc]::check::check_fn
  27:        0x1190fd551 - rustc_hir_typeck[a7633e0d641b9efc]::typeck
  28:        0x11a16666c - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>
  29:        0x119fe3fae - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::VecCache<rustc_span[9df13b32b3ae4eb2]::def_id::LocalDefId, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  30:        0x11a189dab - rustc_query_impl[ab99e8e391ad42b2]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  31:        0x118cb1923 - rustc_middle[66eaac359ba8a608]::query::plumbing::query_get_at::<rustc_query_system[55587a8be6cb95b6]::query::caches::VecCache<rustc_span[9df13b32b3ae4eb2]::def_id::LocalDefId, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>>
  32:        0x118e25646 - rustc_hir_analysis[c06ca58d4f3a4935]::collect::type_of::type_of_opaque
  33:        0x11a160c1c - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>
  34:        0x119f3390f - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::DefIdCache<rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  35:        0x11a16fad9 - rustc_query_impl[ab99e8e391ad42b2]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  36:        0x118cb0cde - rustc_middle[66eaac359ba8a608]::query::plumbing::query_get_at::<rustc_query_system[55587a8be6cb95b6]::query::caches::DefIdCache<rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>>
  37:        0x118e246f7 - rustc_hir_analysis[c06ca58d4f3a4935]::collect::type_of::type_of
  38:        0x11a1666e8 - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>
  39:        0x119f3390f - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::DefIdCache<rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  40:        0x11a16f729 - rustc_query_impl[ab99e8e391ad42b2]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  41:        0x118cb0cde - rustc_middle[66eaac359ba8a608]::query::plumbing::query_get_at::<rustc_query_system[55587a8be6cb95b6]::query::caches::DefIdCache<rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>>
  42:        0x118d87ec5 - rustc_hir_analysis[c06ca58d4f3a4935]::check::check::check_item_type
  43:        0x118dbd0f1 - rustc_hir_analysis[c06ca58d4f3a4935]::check::wfcheck::check_well_formed
  44:        0x11a1620dc - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>
  45:        0x119ff02df - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::VecCache<rustc_hir[d0540023df9f77a9]::hir_id::OwnerId, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  46:        0x11a1ac7d0 - rustc_query_impl[ab99e8e391ad42b2]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  47:        0x118cb1d22 - rustc_middle[66eaac359ba8a608]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[55587a8be6cb95b6]::query::caches::VecCache<rustc_hir[d0540023df9f77a9]::hir_id::OwnerId, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>, ()>
  48:        0x118dcbd51 - rustc_hir_analysis[c06ca58d4f3a4935]::check::wfcheck::check_mod_type_wf
  49:        0x11a1620ac - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>
  50:        0x119f8d589 - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::DefaultCache<rustc_span[9df13b32b3ae4eb2]::def_id::LocalModDefId, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  51:        0x11a189200 - rustc_query_impl[ab99e8e391ad42b2]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  52:        0x118e4c0bc - rustc_hir_analysis[c06ca58d4f3a4935]::check_crate
  53:        0x11940ce37 - rustc_interface[f3798eed8f7e14ff]::passes::run_required_analyses
  54:        0x11940f2d3 - rustc_interface[f3798eed8f7e14ff]::passes::analysis
  55:        0x11a16671c - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>
  56:        0x119f3ebfe - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::SingleCache<rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  57:        0x11a170c77 - rustc_query_impl[ab99e8e391ad42b2]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  58:        0x118a23537 - <rustc_interface[f3798eed8f7e14ff]::queries::QueryResult<&rustc_middle[66eaac359ba8a608]::ty::context::GlobalCtxt>>::enter::<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
  59:        0x118a84c1b - rustc_interface[f3798eed8f7e14ff]::interface::run_compiler::<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}>::{closure#1}
  60:        0x118a6ffc1 - std[8bfe66706d3bd117]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_with_globals<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_pool_with_globals<rustc_interface[f3798eed8f7e14ff]::interface::run_compiler<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}>::{closure#1}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>
  61:        0x118a8b5e6 - <<std[8bfe66706d3bd117]::thread::Builder>::spawn_unchecked_<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_with_globals<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_pool_with_globals<rustc_interface[f3798eed8f7e14ff]::interface::run_compiler<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}>::{closure#1}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#2} as core[84f3396b7379d157]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  62:        0x10f7029bb - std::sys::pal::unix::thread::Thread::new::thread_start::hff8a09cc296b9c2d
  63:     0x7ff801f5318b - __pthread_start

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/sal/Documents/240714/rustc-ice-2024-07-15T02_02_55-63072.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `f`
#1 [type_of_opaque] computing type of opaque `f::{opaque#0}`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0380.
For more information about an error, try `rustc --explain E0107`.

Note

ICE location

} else if tcx.is_lang_item(trait_ref.def_id, LangItem::PointeeTrait) {
let tail = selcx.tcx().struct_tail_with_normalize(
self_ty,
|ty| {
// We throw away any obligations we get from this, since we normalize
// and confirm these obligations once again during confirmation
normalize_with_depth(
selcx,
obligation.param_env,
obligation.cause.clone(),
obligation.recursion_depth + 1,
ty,
)
.value
},
|| {},
);
match tail.kind() {
ty::Bool
| ty::Char
| ty::Int(_)
| ty::Uint(_)
| ty::Float(_)
| ty::Str
| ty::Array(..)
| ty::Pat(..)
| ty::Slice(_)
| ty::RawPtr(..)
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(..)
| ty::Dynamic(..)
| ty::Closure(..)
| ty::CoroutineClosure(..)
| ty::Coroutine(..)
| ty::CoroutineWitness(..)
| ty::Never
// Extern types have unit metadata, according to RFC 2850
| ty::Foreign(_)
// If returned by `struct_tail_without_normalization` this is a unit struct
// without any fields, or not a struct, and therefore is Sized.
| ty::Adt(..)
// If returned by `struct_tail_without_normalization` this is the empty tuple.
| ty::Tuple(..)
// Integers and floats are always Sized, and so have unit type metadata.
| ty::Infer(ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(..)) => true,
// We normalize from `Wrapper<Tail>::Metadata` to `Tail::Metadata` if able.
// Otherwise, type parameters, opaques, and unnormalized projections have
// unit metadata if they're known (e.g. by the param_env) to be sized.
ty::Param(_) | ty::Alias(..)
if self_ty != tail
|| selcx.infcx.predicate_must_hold_modulo_regions(
&obligation.with(
selcx.tcx(),
ty::TraitRef::new(
selcx.tcx(),
selcx.tcx().require_lang_item(
LangItem::Sized,
Some(obligation.cause.span()),
),
[self_ty],
),
),
) =>
{
true
}
// FIXME(compiler-errors): are Bound and Placeholder types ever known sized?
ty::Param(_)
| ty::Alias(..)
| ty::Bound(..)
| ty::Placeholder(..)
| ty::Infer(..)
| ty::Error(_) => {
if tail.has_infer_types() {
candidate_set.mark_ambiguous();
}
false
}
}
} else {
bug!("unexpected builtin trait with associated type: {trait_ref:?}")
}

@rustbot label +A-auto-traits +F-unboxed_closures

@Naserume Naserume 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 15, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) F-unboxed_closures `#![feature(unboxed_closures)]` labels Jul 15, 2024
@theemathas
Copy link
Contributor

Minimized:

#![feature(auto_traits)]

auto trait Trait {
    type Output;
}

fn f() {
    let _: <i32 as Trait>::Output = 1_i64;
}
Error output
   Compiling playground v0.0.1 (/playground)
error[E0380]: auto traits cannot have associated items
 --> src/lib.rs:4:10
  |
3 | auto trait Trait {
  |            ----- auto traits cannot have associated items
4 |     type Output;
  |     -----^^^^^^- help: remove these associated items

error: internal compiler error: compiler/rustc_trait_selection/src/traits/project.rs:1206:21: unexpected builtin trait with associated type: <i32 as Trait>

thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/project.rs:1206:21:
Box<dyn Any>
stack backtrace:
   0:     0x7fd2c0a22ab5 - std::backtrace_rs::backtrace::libunwind::trace::h90ef53671b8f35e2
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7fd2c0a22ab5 - std::backtrace_rs::backtrace::trace_unsynchronized::h4f56cd06e6931e36
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd2c0a22ab5 - std::sys::backtrace::_print_fmt::hc7ca1bfe672db1b4
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/backtrace.rs:68:5
   3:     0x7fd2c0a22ab5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h103b2337102fecbf
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/backtrace.rs:44:22
   4:     0x7fd2c0a7250b - core::fmt::rt::Argument::fmt::h1c3f905c574b7e34
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/fmt/rt.rs:173:76
   5:     0x7fd2c0a7250b - core::fmt::write::h7386266427c35607
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/core/src/fmt/mod.rs:1182:21
   6:     0x7fd2c0a173ef - std::io::Write::write_fmt::h6342dfcd770ba156
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/io/mod.rs:1835:15
   7:     0x7fd2c0a2288e - std::sys::backtrace::_print::h4286525352765247
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/backtrace.rs:47:5
   8:     0x7fd2c0a2288e - std::sys::backtrace::print::hc98e431c340084b2
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/backtrace.rs:34:9
   9:     0x7fd2c0a251d9 - std::panicking::default_hook::{{closure}}::h2ab543053f1e54a6
  10:     0x7fd2c0a24f7c - std::panicking::default_hook::ha284c4ce18b0445e
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/panicking.rs:292:9
  11:     0x7fd2c3ea21fa - std[85c3ca4c170da0bb]::panicking::update_hook::<alloc[d335478de6b4a53f]::boxed::Box<rustc_driver_impl[dc4b00a9cfefcaac]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fd2c0a25aff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hbe29137bf798c82c
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/boxed.rs:2078:9
  13:     0x7fd2c0a25aff - std::panicking::rust_panic_with_hook::h869b30cecbb157c4
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/panicking.rs:804:13
  14:     0x7fd2c3edd151 - std[85c3ca4c170da0bb]::panicking::begin_panic::<rustc_errors[24d2db88e61fdfbe]::ExplicitBug>::{closure#0}
  15:     0x7fd2c3ed0106 - std[85c3ca4c170da0bb]::sys::backtrace::__rust_end_short_backtrace::<std[85c3ca4c170da0bb]::panicking::begin_panic<rustc_errors[24d2db88e61fdfbe]::ExplicitBug>::{closure#0}, !>
  16:     0x7fd2c3ed00b6 - std[85c3ca4c170da0bb]::panicking::begin_panic::<rustc_errors[24d2db88e61fdfbe]::ExplicitBug>
  17:     0x7fd2c3ee6391 - <rustc_errors[24d2db88e61fdfbe]::diagnostic::BugAbort as rustc_errors[24d2db88e61fdfbe]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7fd2c44f3664 - rustc_middle[aeeec62211ae3a75]::util::bug::opt_span_bug_fmt::<rustc_span[67819806738ee56d]::span_encoding::Span>::{closure#0}
  19:     0x7fd2c44d9eda - rustc_middle[aeeec62211ae3a75]::ty::context::tls::with_opt::<rustc_middle[aeeec62211ae3a75]::util::bug::opt_span_bug_fmt<rustc_span[67819806738ee56d]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7fd2c44d9d5b - rustc_middle[aeeec62211ae3a75]::ty::context::tls::with_context_opt::<rustc_middle[aeeec62211ae3a75]::ty::context::tls::with_opt<rustc_middle[aeeec62211ae3a75]::util::bug::opt_span_bug_fmt<rustc_span[67819806738ee56d]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7fd2c1e89d50 - rustc_middle[aeeec62211ae3a75]::util::bug::bug_fmt
  22:     0x7fd2c5cdfe22 - rustc_trait_selection[32a10b8e227ae023]::traits::project::opt_normalize_projection_term
  23:     0x7fd2c5ccbc0d - <rustc_trait_selection[32a10b8e227ae023]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[33d27c6bc9b48538]::fold::TypeFolder<rustc_middle[aeeec62211ae3a75]::ty::context::TyCtxt>>::fold_ty
  24:     0x7fd2c5d252fb - <rustc_hir_typeck[4115a8e785646128]::fn_ctxt::FnCtxt>::normalize::<rustc_middle[aeeec62211ae3a75]::ty::Ty>
  25:     0x7fd2c5d2628b - <dyn rustc_hir_analysis[45c875b93a141787]::hir_ty_lowering::HirTyLowerer>::lower_ty_common::{closure#0}
  26:     0x7fd2c5d455c4 - <rustc_hir_typeck[4115a8e785646128]::gather_locals::GatherLocalsVisitor>::declare
  27:     0x7fd2c2daa1a2 - <rustc_hir_typeck[4115a8e785646128]::gather_locals::GatherLocalsVisitor as rustc_hir[b204fec8ca04ef98]::intravisit::Visitor>::visit_expr
  28:     0x7fd2c57fe56d - rustc_hir_typeck[4115a8e785646128]::check::check_fn
  29:     0x7fd2c5e6ee07 - rustc_hir_typeck[4115a8e785646128]::typeck
  30:     0x7fd2c5e6e79d - rustc_query_impl[1a70eeac4d27cd99]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1a70eeac4d27cd99]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeeec62211ae3a75]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7fd2c5820073 - rustc_query_system[a1535082eb398a6e]::query::plumbing::try_execute_query::<rustc_query_impl[1a70eeac4d27cd99]::DynamicConfig<rustc_query_system[a1535082eb398a6e]::query::caches::VecCache<rustc_span[67819806738ee56d]::def_id::LocalDefId, rustc_middle[aeeec62211ae3a75]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[1a70eeac4d27cd99]::plumbing::QueryCtxt, false>
  32:     0x7fd2c581f24d - rustc_query_impl[1a70eeac4d27cd99]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fd2c581ee44 - <rustc_middle[aeeec62211ae3a75]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[45c875b93a141787]::check_crate::{closure#4}>::{closure#0}
  34:     0x7fd2c581cc7c - rustc_hir_analysis[45c875b93a141787]::check_crate
  35:     0x7fd2c5813355 - rustc_interface[a6452cf60fc426fe]::passes::analysis
  36:     0x7fd2c5812f07 - rustc_query_impl[1a70eeac4d27cd99]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1a70eeac4d27cd99]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aeeec62211ae3a75]::query::erase::Erased<[u8; 1usize]>>
  37:     0x7fd2c6389665 - rustc_query_system[a1535082eb398a6e]::query::plumbing::try_execute_query::<rustc_query_impl[1a70eeac4d27cd99]::DynamicConfig<rustc_query_system[a1535082eb398a6e]::query::caches::SingleCache<rustc_middle[aeeec62211ae3a75]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1a70eeac4d27cd99]::plumbing::QueryCtxt, false>
  38:     0x7fd2c63893cf - rustc_query_impl[1a70eeac4d27cd99]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7fd2c6259745 - rustc_interface[a6452cf60fc426fe]::interface::run_compiler::<core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>, rustc_driver_impl[dc4b00a9cfefcaac]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7fd2c6226589 - std[85c3ca4c170da0bb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a6452cf60fc426fe]::util::run_in_thread_with_globals<rustc_interface[a6452cf60fc426fe]::util::run_in_thread_pool_with_globals<rustc_interface[a6452cf60fc426fe]::interface::run_compiler<core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>, rustc_driver_impl[dc4b00a9cfefcaac]::run_compiler::{closure#0}>::{closure#1}, core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>>::{closure#0}, core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>>
  41:     0x7fd2c622633a - <<std[85c3ca4c170da0bb]::thread::Builder>::spawn_unchecked_<rustc_interface[a6452cf60fc426fe]::util::run_in_thread_with_globals<rustc_interface[a6452cf60fc426fe]::util::run_in_thread_pool_with_globals<rustc_interface[a6452cf60fc426fe]::interface::run_compiler<core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>, rustc_driver_impl[dc4b00a9cfefcaac]::run_compiler::{closure#0}>::{closure#1}, core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>>::{closure#0}, core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2213ecb858fb81d5]::result::Result<(), rustc_span[67819806738ee56d]::ErrorGuaranteed>>::{closure#2} as core[2213ecb858fb81d5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7fd2c0a2f95b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7aa527871fe5008e
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/boxed.rs:2064:9
  43:     0x7fd2c0a2f95b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h661f413d6ffad84b
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/alloc/src/boxed.rs:2064:9
  44:     0x7fd2c0a2f95b - std::sys::pal::unix::thread::Thread::new::thread_start::h77623da8b368e6ce
                               at /rustc/c6727fc9b5c64cefa7263486497ee95e529bd0f8/library/std/src/sys/pal/unix/thread.rs:108:17
  45:     0x7fd2c0939609 - start_thread
  46:     0x7fd2c085c353 - clone
  47:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/playground/rustc-ice-2024-07-15T03_34_45-244.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
#0 [typeck] type-checking `f`
#1 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0380`.
error: could not compile `playground` (lib) due to 1 previous error

@rustbot label -F-unboxed_closures +F-auto_traits

@rustbot rustbot added F-auto_traits `#![feature(auto_traits)]` and removed F-unboxed_closures `#![feature(unboxed_closures)]` labels Jul 15, 2024
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 15, 2024
@GrigorenkoPV
Copy link
Contributor

#![feature(auto_traits)]
#![feature(unboxed_closures)]

trait T {}

fn f() -> impl Fn(T) {
    let p = ();
    |_| p
}

auto trait Fn {
    type Output;
}

fn main() {}

Regression in nightly-2024-01-11 (190f4c9...a2d9d73)

Minimized:

#![feature(auto_traits)]

auto trait Trait {
    type Output;
}

fn f() {
    let _: <i32 as Trait>::Output = 1_i64;
}

Regression in nightly-2023-06-18 (6bba061...3b2073f)

@matthiaskrgr
Copy link
Member

probably just another duplicate of #117829

@bors bors closed this as completed in 1fda084 Jul 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
Rollup merge of rust-lang#128160 - compiler-errors:auto, r=jackh726

Don't ICE when auto trait has assoc ty in old solver

Kinda a pointless change to make, but it's observable w/o the feature gate, so let's just fix it. I reintroduced this ICE when I removed the "auto impl" kind from `ImplSource` in rust-lang#112687.

Fixes rust-lang#117829
Fixes rust-lang#127746
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) C-bug Category: This is a bug. F-auto_traits `#![feature(auto_traits)]` 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.

6 participants