Open matthiaskrgr opened 2 days ago
bisects to #126552 🤔
bit smaller 🤷
use std::ops::Add;
pub trait Numoid
where
for<N: Numoid> &'a Self: Add<Self>,
{
}
pub fn compute<N: Numoid>(a: N) -> N {
&a + a
}
Taking off requires-nightly as this ICEs on stable, no features need to be turned on
auto-reduced (treereduce-rust):
original:
Version information
Possibly related line of code: https://github.com/rust-lang/rust/blob/c22887b4d97400e8e024e19fb5f724eda65ad58d/compiler/rustc_hir_typeck/src/op.rs#L587-L599
Command:
/home/gh-matthiaskrgr/.rustup/toolchains/master/bin/rustc
Program output
``` error[E0261]: use of undeclared lifetime name `'a` --> /tmp/icemaker_global_tempdir.8MhAhK5jiuLv/rustc_testrunner_tmpdir_reporting.CRfxbVTvebpq/mvce.rs:6:21 | 6 | for &'a Self: Add,
| ^^ 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 `'a` lifetime
|
6 | for<'a, N: Numoid> &'a Self: Add,
| +++
help: consider introducing lifetime `'a` here
|
3 | pub trait Numoid<'a>
| ++++
error[E0658]: only lifetime parameters can be used in this context
--> /tmp/icemaker_global_tempdir.8MhAhK5jiuLv/rustc_testrunner_tmpdir_reporting.CRfxbVTvebpq/mvce.rs:6:9
|
6 | for &'a Self: Add,
| ^
|
= note: see issue #108185 for more information
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
= note: this compiler was built on 2024-11-10; consider upgrading it if it is out of date
error: bounds cannot be used in this context
--> /tmp/icemaker_global_tempdir.8MhAhK5jiuLv/rustc_testrunner_tmpdir_reporting.CRfxbVTvebpq/mvce.rs:6:12
|
6 | for &'a Self: Add,
| ^^^^^^
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.8MhAhK5jiuLv/rustc_testrunner_tmpdir_reporting.CRfxbVTvebpq/mvce.rs:12:2
|
12 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.8MhAhK5jiuLv/rustc_testrunner_tmpdir_reporting.CRfxbVTvebpq/mvce.rs`
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/op.rs:593:30:
called `Result::unwrap_err()` on an `Ok` value: MethodCallee { def_id: DefId(2:3465 ~ core[c9a4]::ops::arith::Add::add), args: [&'?1 N/#0, N/#0], sig: fn(&'?1 N/#0, N/#0) -> ?4t }
stack backtrace:
0: 0x71bc56a6ea2a - ::fmt::h83ad5e2a379fc4af
1: 0x71bc57204126 - core::fmt::write::hd8ade6666fd2c40a
2: 0x71bc5820c551 - std::io::Write::write_fmt::h7d2b379dca789286
3: 0x71bc56a6e882 - std::sys::backtrace::BacktraceLock::print::h59e64fca617eeec6
4: 0x71bc56a70d86 - std::panicking::default_hook::{{closure}}::h16156878543f93cc
5: 0x71bc56a70bd0 - std::panicking::default_hook::hbaee2e322f8f0f8f
6: 0x71bc55ae8e89 - std[248d60aad2b34f5b]::panicking::update_hook::>::{closure#0}
7: 0x71bc56a71498 - std::panicking::rust_panic_with_hook::h1585e6a773a078df
8: 0x71bc56a7126a - std::panicking::begin_panic_handler::{{closure}}::h3c7880b1e47691e7
9: 0x71bc56a6eed9 - std::sys::backtrace::__rust_end_short_backtrace::hfac10c8ba5512bd0
10: 0x71bc56a70f2c - rust_begin_unwind
11: 0x71bc534d2650 - core::panicking::panic_fmt::h8ce9768a1a123ba1
12: 0x71bc53986e46 - core::result::unwrap_failed::h51824eae6f4049d1
13: 0x71bc573eb52a - ::check_overloaded_binop
14: 0x71bc57fe139e - ::check_expr_with_expectation_and_args
15: 0x71bc57fd9659 - ::check_block_with_expected
16: 0x71bc57fdf9e4 - ::check_expr_with_expectation_and_args
17: 0x71bc5741085b - rustc_hir_typeck[d66e89de08caab9]::check::check_fn
18: 0x71bc5740632c - rustc_hir_typeck[d66e89de08caab9]::typeck
19: 0x71bc57405cd3 - rustc_query_impl[edd1d74896ea38c9]::plumbing::__rust_begin_short_backtrace::>
20: 0x71bc578b6681 - rustc_query_system[16014b61255515c2]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[edd1d74896ea38c9]::plumbing::QueryCtxt, false>
21: 0x71bc578b4d8d - rustc_query_impl[edd1d74896ea38c9]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
22: 0x71bc578b4a07 - ::par_body_owners::::{closure#0}
23: 0x71bc578b29cf - rustc_hir_analysis[aca35e167d413358]::check_crate
24: 0x71bc578a310a - rustc_interface[1e17fd868ff3e64c]::passes::run_required_analyses
25: 0x71bc5800141e - rustc_interface[1e17fd868ff3e64c]::passes::analysis
26: 0x71bc580013ef - rustc_query_impl[edd1d74896ea38c9]::plumbing::__rust_begin_short_backtrace::>
27: 0x71bc581d5d2e - rustc_query_system[16014b61255515c2]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[edd1d74896ea38c9]::plumbing::QueryCtxt, false>
28: 0x71bc581d5a0e - rustc_query_impl[edd1d74896ea38c9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
29: 0x71bc580cc93a - rustc_interface[1e17fd868ff3e64c]::interface::run_compiler::, rustc_driver_impl[85a2628807024745]::run_compiler::{closure#0}>::{closure#1}
30: 0x71bc58183410 - std[248d60aad2b34f5b]::sys::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[85a2628807024745]::run_compiler::{closure#0}>::{closure#1}, core[c9a4dec56b015974]::result::Result<(), rustc_span[966ebffeac22211b]::ErrorGuaranteed>>::{closure#0}, core[c9a4dec56b015974]::result::Result<(), rustc_span[966ebffeac22211b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c9a4dec56b015974]::result::Result<(), rustc_span[966ebffeac22211b]::ErrorGuaranteed>>
31: 0x71bc5818382b - <::spawn_unchecked_, rustc_driver_impl[85a2628807024745]::run_compiler::{closure#0}>::{closure#1}, core[c9a4dec56b015974]::result::Result<(), rustc_span[966ebffeac22211b]::ErrorGuaranteed>>::{closure#0}, core[c9a4dec56b015974]::result::Result<(), rustc_span[966ebffeac22211b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c9a4dec56b015974]::result::Result<(), rustc_span[966ebffeac22211b]::ErrorGuaranteed>>::{closure#1} as core[c9a4dec56b015974]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
32: 0x71bc581842f9 - std::sys::pal::unix::thread::Thread::new::thread_start::hd6ed3da90976b7d6
33: 0x71bc5209ca94 - start_thread
at ./nptl/pthread_create.c:447:8
34: 0x71bc52129c3c - clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
35: 0x0 -
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: rustc 1.84.0-nightly (c22887b4d 2024-11-10) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `compute`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0261, E0601, E0658.
For more information about an error, try `rustc --explain E0261`.
```