Open
Description
auto-reduced (treereduce-rust):
trait T {}
type Alias<'a> = impl T;
struct S;
impl<'a> T for &'a S {}
fn with_positive(fun: impl Fn(Alias<'_>)) {
with_positive(|&n| ());
}
original:
trait T {}
type Alias<'a> = impl T;
struct S;
impl<'a> T for &'a S {}
fn with_positive(fun: impl Fn(Alias<'_>)) {
with_positive(|&n| ());
}
fn main(Alias<'_>) {
with_positive(|&a| ());
}
Version information
rustc 1.79.0-nightly (b3df0d7e5 2024-03-22)
binary: rustc
commit-hash: b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87
commit-date: 2024-03-22
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0658]: `impl Trait` in type aliases is unstable
--> /tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs:3:18
|
3 | type Alias<'a> = impl T;
| ^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
= note: this compiler was built on 2024-03-22; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs:10:2
|
10 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs`
warning: unused variable: `fun`
--> /tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs:8:18
|
8 | fn with_positive(fun: impl Fn(Alias<'_>)) {
| ^^^ help: if this is intentional, prefix it with an underscore: `_fun`
|
= note: `#[warn(unused_variables)]` on by default
warning: function cannot return without recursing
--> /tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs:8:1
|
8 | fn with_positive(fun: impl Fn(Alias<'_>)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
9 | with_positive(|&n| ());
| ---------------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
= note: `#[warn(unconditional_recursion)]` on by default
warning: unused variable: `n`
--> /tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs:9:21
|
9 | with_positive(|&n| ());
| ^ help: if this is intentional, prefix it with an underscore: `_n`
error[E0507]: cannot move out of a shared reference
--> /tmp/icemaker_global_tempdir.Y54EKqIXoWUB/rustc_testrunner_tmpdir_reporting.e4LbEvdE1kIj/mvce.rs:9:20
|
9 | with_positive(|&n| ());
| ^-
| |
| data moved here
| move occurs because `n` has type `S`, which does not implement the `Copy` trait
|
help: consider removing the borrow
|
9 - with_positive(|&n| ());
9 + with_positive(|n| ());
|
thread 'rustc' panicked at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/compiler/rustc_mir_dataflow/src/un_derefer.rs:67:20:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
0: 0x737eb0d9afa5 - std::backtrace_rs::backtrace::libunwind::trace::h4515e3e00f57996f
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x737eb0d9afa5 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e64ac1112175e4e
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x737eb0d9afa5 - std::sys_common::backtrace::_print_fmt::h182160b5ad873150
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:68:5
3: 0x737eb0d9afa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h432843f19f8b2b6d
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:44:22
4: 0x737eb0debfeb - core::fmt::rt::Argument::fmt::hb59bbd21accf1885
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/fmt/rt.rs:142:9
5: 0x737eb0debfeb - core::fmt::write::haf243cf4605e411d
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/fmt/mod.rs:1153:17
6: 0x737eb0d8fd3f - std::io::Write::write_fmt::hd8c8c68b4f5b8f11
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/io/mod.rs:1843:15
7: 0x737eb0d9ad7e - std::sys_common::backtrace::_print::h0ec933d6103e5515
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:47:5
8: 0x737eb0d9ad7e - std::sys_common::backtrace::print::h55136fa64edb86e6
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:34:9
9: 0x737eb0d9d9f9 - std::panicking::default_hook::{{closure}}::h28cbeefc01b40f52
10: 0x737eb0d9d763 - std::panicking::default_hook::h15e904210c67a3ca
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:292:9
11: 0x737ead5cb6bf - std[48784e9e46568672]::panicking::update_hook::<alloc[590c7545ac68a568]::boxed::Box<rustc_driver_impl[9e9e6466696ec967]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x737eb0d9e150 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::had664932fcaf7f86
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2029:9
13: 0x737eb0d9e150 - std::panicking::rust_panic_with_hook::h9f23cc8a1f418825
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:783:13
14: 0x737eb0d9dea6 - std::panicking::begin_panic_handler::{{closure}}::h6c297ce5a3207845
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:657:13
15: 0x737eb0d9b469 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e27b03308c1610a
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys_common/backtrace.rs:171:18
16: 0x737eb0d9dbd7 - rust_begin_unwind
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/panicking.rs:645:5
17: 0x737eb0de8486 - core::panicking::panic_fmt::hc62934eef5acbd79
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/panicking.rs:72:14
18: 0x737eb0de86a7 - core::panicking::panic_bounds_check::h2ec889bc6f79e4c6
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/panicking.rs:205:5
19: 0x737eabbd9ccc - <rustc_mir_dataflow[6337c591d47c40ab]::move_paths::builder::Gatherer<<rustc_mir_transform[b03574829d5a714c]::elaborate_drops::ElaborateDrops as rustc_middle[cfd7f582085b2efd]::mir::MirPass>::run_pass::{closure#0}>>::gather_move
20: 0x737eabbc2e27 - <rustc_mir_transform[b03574829d5a714c]::elaborate_drops::ElaborateDrops as rustc_middle[cfd7f582085b2efd]::mir::MirPass>::run_pass
21: 0x737eaea01a0d - rustc_mir_transform[b03574829d5a714c]::pass_manager::run_passes_inner
22: 0x737eaf17dc4b - rustc_mir_transform[b03574829d5a714c]::mir_drops_elaborated_and_const_checked
23: 0x737eaf17d563 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>
24: 0x737eaebfe82e - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::VecCache<rustc_span[9e6cb2d6f72e9bb4]::def_id::LocalDefId, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
25: 0x737eaebfe10c - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
26: 0x737eaeea1068 - rustc_interface[7ddcde71cf02e108]::passes::analysis
27: 0x737eaee9fe51 - rustc_query_impl[82a63e1d7cdec9a7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[82a63e1d7cdec9a7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 1usize]>>
28: 0x737eaf7eb4a5 - rustc_query_system[ee3912bf2a9f33a7]::query::plumbing::try_execute_query::<rustc_query_impl[82a63e1d7cdec9a7]::DynamicConfig<rustc_query_system[ee3912bf2a9f33a7]::query::caches::SingleCache<rustc_middle[cfd7f582085b2efd]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[82a63e1d7cdec9a7]::plumbing::QueryCtxt, false>
29: 0x737eaf7eb209 - rustc_query_impl[82a63e1d7cdec9a7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
30: 0x737eaf6870d9 - rustc_interface[7ddcde71cf02e108]::interface::run_compiler::<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}
31: 0x737eaf752399 - std[48784e9e46568672]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_with_globals<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_pool_with_globals<rustc_interface[7ddcde71cf02e108]::interface::run_compiler<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>
32: 0x737eaf7521c6 - <<std[48784e9e46568672]::thread::Builder>::spawn_unchecked_<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_with_globals<rustc_interface[7ddcde71cf02e108]::util::run_in_thread_pool_with_globals<rustc_interface[7ddcde71cf02e108]::interface::run_compiler<core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>, rustc_driver_impl[9e9e6466696ec967]::run_compiler::{closure#0}>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b4a1350c838fc0f9]::result::Result<(), rustc_span[9e6cb2d6f72e9bb4]::ErrorGuaranteed>>::{closure#1} as core[b4a1350c838fc0f9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
33: 0x737eb0da7919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3e016c41180ed802
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9
34: 0x737eb0da7919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcf0716ba35a33b0c
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/alloc/src/boxed.rs:2015:9
35: 0x737eb0da7919 - std::sys::pal::unix::thread::Thread::new::thread_start::hd585680968d21553
at /rustc/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/std/src/sys/pal/unix/thread.rs:108:17
36: 0x737eb0b4755a - <unknown>
37: 0x737eb0bc4a3c - <unknown>
38: 0x0 - <unknown>
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: rustc 1.79.0-nightly (b3df0d7e5 2024-03-22) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `with_positive::{closure#0}`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0507, E0601, E0658.
For more information about an error, try `rustc --explain E0507`.