error[E0658]: use of unstable library feature `const_destruct`
--> bug.rs:2:5
|
2 | use std::marker::Destruct;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
= help: add `#![feature(const_destruct)]` to the crate attributes to enable
= note: this compiler was built on 2026-01-30; consider upgrading it if it is out of date
error[E0658]: use of unstable const library feature `const_destruct`
--> bug.rs:8:71
|
8 | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>((): F) {}
| ------- ^^^^^^^^
| |
| trait is not stable as const yet
|
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
= help: add `#![feature(const_destruct)]` to the crate attributes to enable
= note: this compiler was built on 2026-01-30; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `const_destruct`
--> bug.rs:8:71
|
8 | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>((): F) {}
| ^^^^^^^^
|
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
= help: add `#![feature(const_destruct)]` to the crate attributes to enable
= note: this compiler was built on 2026-01-30; consider upgrading it if it is out of date
warning: trait objects without an explicit `dyn` are deprecated
--> bug.rs:5:27
|
5 | pub type Alias<'a> = T<>;
| ^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
help: if this is a dyn-compatible trait, use `dyn`
|
5 | pub type Alias<'a> = dyn T<>;
| +++
error[E0308]: mismatched types
--> bug.rs:8:81
|
8 | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>((): F) {}
| - ^^ - expected due to this
| | |
| expected this type parameter expected type parameter `F`, found `()`
|
= note: expected type parameter `F`
found unit type `()`
error[E0277]: expected a `Fn(&'a (dyn T + 'static))` closure, found `()`
--> bug.rs:11:19
|
11 | with_positive(());
| ------------- ^^ expected an `Fn(&'a (dyn T + 'static))` closure, found `()`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'a> Fn(&'a (dyn T + 'static))` is not implemented for `()`
note: required by a bound in `with_positive`
--> bug.rs:8:27
|
8 | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>((): F) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_positive`
thread 'rustc' (104640) panicked at /rustc-dev/a293cc4af8b26701c42738381c0c6f9d2ba881e0/compiler/rustc_middle/src/ty/predicate.rs:471:9:
`TraitPredicate(<() as std::ops::Fn<(&'a (dyn foo::T + 'static),)>>, polarity:Positive)` has escaping bound vars, so it cannot be wrapped in a dummy binder.
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <rustc_type_ir::binder::Binder<rustc_middle::ty::context::TyCtxt, rustc_type_ir::predicate_kind::PredicateKind<rustc_middle::ty::context::TyCtxt>>>::dummy.llvm.3075746312566460461.cold
3: <rustc_infer::infer::InferCtxt as rustc_trait_selection::solve::select::InferCtxtSelectExt>::select_in_new_trait_solver
4: <rustc_trait_selection::traits::select::SelectionContext>::select
5: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_host_effect_error
6: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_selection_error
7: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_call
9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
12: rustc_hir_typeck::typeck_with_inspect::{closure#0}
[... omitted 1 frame ...]
13: rustc_mir_build::thir::pattern::check_match::check_match
[... omitted 1 frame ...]
14: rustc_mir_build::builder::build_mir_inner_impl
15: rustc_mir_transform::mir_built
[... omitted 2 frames ...]
16: rustc_const_eval::const_eval::eval_queries::eval_to_const_value_raw_provider
[... omitted 1 frame ...]
17: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
18: rustc_hir_analysis::check_crate
19: rustc_interface::passes::analysis
[... omitted 1 frame ...]
20: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
21: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: 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: please make sure that you have updated to the latest nightly
note: please attach the file at `/home/laix/Study/Traitor/trait-fuzzer/test/rustc-ice-2026-01-31T06_42_12-104542.txt` to your bug report
note: rustc 1.95.0-nightly (a293cc4af 2026-01-30) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z next-solver=globally
query stack during panic:
#0 [typeck] type-checking `BAR`
#1 [check_match] match-checking `BAR`
#2 [mir_built] building MIR for `BAR`
#3 [trivial_const] checking if `BAR` is a trivial const
#4 [eval_to_const_value_raw] simplifying constant for the type system `BAR`
#5 [analysis] running analysis passes on crate `bug`
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted
Some errors have detailed explanations: E0277, E0308, E0658.
For more information about an error, try `rustc --explain E0277`.
I tried this code : (auto-reduced)
-Znext-solver=globally)Meta
rustc --version --verbose:Backtrace