Open
Description
auto-reduced (treereduce-rust):
trait F = Fn() -> Self;
fn _f3<Fut>(a: dyn F<Fut>) {}
original:
use std::future::Future;
trait F<Fut: Future<Output = usize>> = Fn() -> Self;
fn _f3<Fut>(a: dyn F<Fut>) {}
//~^ ERROR the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time
fn main() {}
Version information
rustc 1.87.0-nightly (90f5eab95 2025-03-24)
binary: rustc
commit-hash: 90f5eab952728ac6edcf529a171f7de5c25e5d49
commit-date: 2025-03-24
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.1
Possibly related line of code:
rust/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
Lines 398 to 410 in 90f5eab
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0658]: trait aliases are experimental
--> /tmp/icemaker_global_tempdir.9RJGbLHtZS3f/rustc_testrunner_tmpdir_reporting.K3JbY4FM9GbA/mvce.rs:1:1
|
1 | trait F = Fn() -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
= help: add `#![feature(trait_alias)]` to the crate attributes to enable
= note: this compiler was built on 2025-03-24; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.9RJGbLHtZS3f/rustc_testrunner_tmpdir_reporting.K3JbY4FM9GbA/mvce.rs:3:30
|
3 | fn _f3<Fut>(a: dyn F<Fut>) {}
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.9RJGbLHtZS3f/rustc_testrunner_tmpdir_reporting.K3JbY4FM9GbA/mvce.rs`
error[E0107]: trait alias takes 0 generic arguments but 1 generic argument was supplied
--> /tmp/icemaker_global_tempdir.9RJGbLHtZS3f/rustc_testrunner_tmpdir_reporting.K3JbY4FM9GbA/mvce.rs:3:20
|
3 | fn _f3<Fut>(a: dyn F<Fut>) {}
| ^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: trait alias defined here, with 0 generic parameters
--> /tmp/icemaker_global_tempdir.9RJGbLHtZS3f/rustc_testrunner_tmpdir_reporting.K3JbY4FM9GbA/mvce.rs:1:7
|
1 | trait F = Fn() -> Self;
| ^
error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:404:17: encountered a fresh type during canonicalization
thread 'rustc' panicked at compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:404:17:
Box<dyn Any>
stack backtrace:
0: 0x7cb472c372f3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2760fe8863421f5c
1: 0x7cb473405b11 - core::fmt::write::h3dac15c2c2ecb533
2: 0x7cb4747adcd1 - std::io::Write::write_fmt::h075eef10e49b35aa
3: 0x7cb472c37152 - std::sys::backtrace::BacktraceLock::print::hfd69c92aba7c12c8
4: 0x7cb472c39a0a - std::panicking::default_hook::{{closure}}::h08503484e559a2f9
5: 0x7cb472c3958f - std::panicking::default_hook::h141fa4f2c715ef5e
6: 0x7cb471cb0250 - std[89bc5ccdd7126a22]::panicking::update_hook::<alloc[285974f900039e31]::boxed::Box<rustc_driver_impl[bd7fc35b05314b57]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7cb472c3a283 - std::panicking::rust_panic_with_hook::h226a3fc30a0b89e9
8: 0x7cb471cedb71 - std[89bc5ccdd7126a22]::panicking::begin_panic::<rustc_errors[533322d0018a48b8]::ExplicitBug>::{closure#0}
9: 0x7cb471ce1d36 - std[89bc5ccdd7126a22]::sys::backtrace::__rust_end_short_backtrace::<std[89bc5ccdd7126a22]::panicking::begin_panic<rustc_errors[533322d0018a48b8]::ExplicitBug>::{closure#0}, !>
10: 0x7cb471cde88b - std[89bc5ccdd7126a22]::panicking::begin_panic::<rustc_errors[533322d0018a48b8]::ExplicitBug>
11: 0x7cb471cf7411 - <rustc_errors[533322d0018a48b8]::diagnostic::BugAbort as rustc_errors[533322d0018a48b8]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7cb47232ecaa - rustc_middle[a1c7959211e9dd4e]::util::bug::opt_span_bug_fmt::<rustc_span[6d7120c72a98845f]::span_encoding::Span>::{closure#0}
13: 0x7cb47230a67a - rustc_middle[a1c7959211e9dd4e]::ty::context::tls::with_opt::<rustc_middle[a1c7959211e9dd4e]::util::bug::opt_span_bug_fmt<rustc_span[6d7120c72a98845f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7cb47230a4eb - rustc_middle[a1c7959211e9dd4e]::ty::context::tls::with_context_opt::<rustc_middle[a1c7959211e9dd4e]::ty::context::tls::with_opt<rustc_middle[a1c7959211e9dd4e]::util::bug::opt_span_bug_fmt<rustc_span[6d7120c72a98845f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7cb4702fbde0 - rustc_middle[a1c7959211e9dd4e]::util::bug::bug_fmt
16: 0x7cb473c78e90 - <rustc_infer[a2306f7a6093687f]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[e2203e1e22965ec]::fold::TypeFolder<rustc_middle[a1c7959211e9dd4e]::ty::context::TyCtxt>>::fold_ty
17: 0x7cb473c75bbf - <rustc_infer[a2306f7a6093687f]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[e2203e1e22965ec]::fold::TypeFolder<rustc_middle[a1c7959211e9dd4e]::ty::context::TyCtxt>>::fold_ty
18: 0x7cb474701fd7 - rustc_trait_selection[44c579af88ade2df]::traits::outlives_bounds::implied_outlives_bounds
19: 0x7cb473aab842 - <rustc_infer[a2306f7a6093687f]::infer::outlives::env::OutlivesEnvironment as rustc_trait_selection[44c579af88ade2df]::regions::OutlivesEnvironmentBuildExt>::new_with_implied_bounds_compat::<core[b9c58c49076e5645]::iter::adapters::copied::Copied<indexmap[306b0dcaefb62a11]::set::iter::Iter<rustc_middle[a1c7959211e9dd4e]::ty::Ty>>>
20: 0x7cb473aaae89 - rustc_hir_analysis[44fec3f23cf762cf]::check::wfcheck::check_item_fn
21: 0x7cb4738f1918 - rustc_hir_analysis[44fec3f23cf762cf]::check::wfcheck::check_well_formed
22: 0x7cb4738efa87 - rustc_query_impl[b86e1ec47b6ca816]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b86e1ec47b6ca816]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a1c7959211e9dd4e]::query::erase::Erased<[u8; 1usize]>>
23: 0x7cb4738ef517 - rustc_query_system[af38d3c28df6173e]::query::plumbing::try_execute_query::<rustc_query_impl[b86e1ec47b6ca816]::DynamicConfig<rustc_data_structures[36b80869008ebc33]::vec_cache::VecCache<rustc_span[6d7120c72a98845f]::def_id::LocalDefId, rustc_middle[a1c7959211e9dd4e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[af38d3c28df6173e]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[b86e1ec47b6ca816]::plumbing::QueryCtxt, false>
24: 0x7cb4738ef003 - rustc_query_impl[b86e1ec47b6ca816]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
25: 0x7cb4738ec495 - rustc_hir_analysis[44fec3f23cf762cf]::check::wfcheck::check_mod_type_wf
26: 0x7cb4738ec2b5 - rustc_query_impl[b86e1ec47b6ca816]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b86e1ec47b6ca816]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a1c7959211e9dd4e]::query::erase::Erased<[u8; 1usize]>>
27: 0x7cb4744d0b53 - rustc_query_system[af38d3c28df6173e]::query::plumbing::try_execute_query::<rustc_query_impl[b86e1ec47b6ca816]::DynamicConfig<rustc_query_system[af38d3c28df6173e]::query::caches::DefaultCache<rustc_span[6d7120c72a98845f]::def_id::LocalModDefId, rustc_middle[a1c7959211e9dd4e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b86e1ec47b6ca816]::plumbing::QueryCtxt, false>
28: 0x7cb4744d08ca - rustc_query_impl[b86e1ec47b6ca816]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
29: 0x7cb47374d817 - rustc_hir_analysis[44fec3f23cf762cf]::check_crate
30: 0x7cb4737e475d - rustc_interface[5d0158996fce411b]::passes::run_required_analyses
31: 0x7cb4742775de - rustc_interface[5d0158996fce411b]::passes::analysis
32: 0x7cb4742775b3 - rustc_query_impl[b86e1ec47b6ca816]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b86e1ec47b6ca816]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a1c7959211e9dd4e]::query::erase::Erased<[u8; 0usize]>>
33: 0x7cb47451867a - rustc_query_system[af38d3c28df6173e]::query::plumbing::try_execute_query::<rustc_query_impl[b86e1ec47b6ca816]::DynamicConfig<rustc_query_system[af38d3c28df6173e]::query::caches::SingleCache<rustc_middle[a1c7959211e9dd4e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b86e1ec47b6ca816]::plumbing::QueryCtxt, false>
34: 0x7cb474518378 - rustc_query_impl[b86e1ec47b6ca816]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
35: 0x7cb4746def7c - rustc_interface[5d0158996fce411b]::passes::create_and_enter_global_ctxt::<core[b9c58c49076e5645]::option::Option<rustc_interface[5d0158996fce411b]::queries::Linker>, rustc_driver_impl[bd7fc35b05314b57]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
36: 0x7cb4744ff6e2 - rustc_interface[5d0158996fce411b]::interface::run_compiler::<(), rustc_driver_impl[bd7fc35b05314b57]::run_compiler::{closure#0}>::{closure#1}
37: 0x7cb474437a08 - std[89bc5ccdd7126a22]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5d0158996fce411b]::util::run_in_thread_with_globals<rustc_interface[5d0158996fce411b]::util::run_in_thread_pool_with_globals<rustc_interface[5d0158996fce411b]::interface::run_compiler<(), rustc_driver_impl[bd7fc35b05314b57]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
38: 0x7cb4744382f4 - <<std[89bc5ccdd7126a22]::thread::Builder>::spawn_unchecked_<rustc_interface[5d0158996fce411b]::util::run_in_thread_with_globals<rustc_interface[5d0158996fce411b]::util::run_in_thread_pool_with_globals<rustc_interface[5d0158996fce411b]::interface::run_compiler<(), rustc_driver_impl[bd7fc35b05314b57]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b9c58c49076e5645]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39: 0x7cb4744396eb - std::sys::pal::unix::thread::Thread::new::thread_start::ha2b3be6e9515328e
40: 0x7cb46e2a370a - <unknown>
41: 0x7cb46e327aac - <unknown>
42: 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: rustc 1.87.0-nightly (90f5eab95 2025-03-24) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [check_well_formed] checking that `_f3` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0107, E0601, E0658.
For more information about an error, try `rustc --explain E0107`.
Metadata
Metadata
Assignees
Labels
Area: trait objects, vtable layoutCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(trait_alias)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: a bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.