Closed
Description
auto-reduced (treereduce-rust):
fn main() {
let b = 0.0f32;
bar(a);
读文(b);
}
original:
// Checks that we only suggest borrowing if &T actually implements the trait.
trait Tr {}
impl Tr for &f32 {}
fn bar<T: Tr>(t: T) {}
fn main((a, b): (i32, T)) {
let wat = 0i32;
let b = 0.0f32;
bar(a); //~ ERROR: the trait bound `i32: Tr` is not satisfied [E0277]
读文(b); //~ ERROR: the trait bound `f32: Tr` is not satisfied [E0277]
}
Version information
rustc 1.76.0-nightly (9bf30ebdf 2023-12-01)
binary: rustc
commit-hash: 9bf30ebdfa50db6286d9400615c2bcb324c1a587
commit-date: 2023-12-01
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0425]: cannot find value `a` in this scope
--> /tmp/icemaker_global_tempdir.24w6PkuCXqq1/rustc_testrunner_tmpdir_reporting.6ofXWFYDsQBI/mvce.rs:3:9
|
3 | bar(a);
| ^ help: a local variable with a similar name exists: `b`
error[E0425]: cannot find function `bar` in this scope
--> /tmp/icemaker_global_tempdir.24w6PkuCXqq1/rustc_testrunner_tmpdir_reporting.6ofXWFYDsQBI/mvce.rs:3:5
|
3 | bar(a);
| ^^^ not found in this scope
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/method/probe.rs:1803:18:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: 0x7fe705b8b28c - std::backtrace_rs::backtrace::libunwind::trace::h9d732439270c3383
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7fe705b8b28c - std::backtrace_rs::backtrace::trace_unsynchronized::h00fc8ac1c9b3c142
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fe705b8b28c - std::sys_common::backtrace::_print_fmt::h6e04e141aa46ac91
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7fe705b8b28c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0fc019919d3e63a6
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fe705bde2c0 - core::fmt::rt::Argument::fmt::h5b48578e292a11d2
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/core/src/fmt/rt.rs:142:9
5: 0x7fe705bde2c0 - core::fmt::write::h0b89aa2be2cfe571
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/core/src/fmt/mod.rs:1120:17
6: 0x7fe705b7f0ef - std::io::Write::write_fmt::h0ba18fb86594bb3f
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/io/mod.rs:1810:15
7: 0x7fe705b8b074 - std::sys_common::backtrace::_print::h71e0da75223aab58
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7fe705b8b074 - std::sys_common::backtrace::print::h8f0759a29c219f85
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7fe705b8dd07 - std::panicking::default_hook::{{closure}}::h3abd6eee3cd0fda2
10: 0x7fe705b8da6f - std::panicking::default_hook::h097cf129ec363cfe
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/panicking.rs:292:9
11: 0x7fe7088e6590 - std[93ea1b589bf29457]::panicking::update_hook::<alloc[5f7f0bf396af8345]::boxed::Box<rustc_driver_impl[48609f831332dbe0]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7fe705b8e448 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1d8a6b4800e422c1
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/alloc/src/boxed.rs:2021:9
13: 0x7fe705b8e448 - std::panicking::rust_panic_with_hook::h81a08ac0cc2711f4
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/panicking.rs:783:13
14: 0x7fe705b8e169 - std::panicking::begin_panic_handler::{{closure}}::hacaea439f4b5356f
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/panicking.rs:649:13
15: 0x7fe705b8b756 - std::sys_common::backtrace::__rust_end_short_backtrace::hb2736ea5aade0ff6
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/sys_common/backtrace.rs:171:18
16: 0x7fe705b8df02 - rust_begin_unwind
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/panicking.rs:645:5
17: 0x7fe705bda995 - core::panicking::panic_fmt::ha5cf272f5880693e
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/core/src/panicking.rs:72:14
18: 0x7fe705bdaa43 - core::panicking::panic::he8a03d2601d18bae
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/core/src/panicking.rs:142:5
19: 0x7fe70a175ff5 - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::probe_for_name
20: 0x7fe708afcef7 - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::lookup_probe_for_diagnostic
21: 0x7fe708aa6ffa - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::confirm_builtin_call
22: 0x7fe70a5a1804 - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::check_call
23: 0x7fe70a67e37b - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
24: 0x7fe70a164776 - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::check_block_with_expected
25: 0x7fe70a67e70d - <rustc_hir_typeck[b75a8e014774e517]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7fe70a0440ef - rustc_hir_typeck[b75a8e014774e517]::check::check_fn
27: 0x7fe709f08759 - rustc_hir_typeck[b75a8e014774e517]::typeck
28: 0x7fe709f07b3d - rustc_query_impl[27c039f8cc0d4cec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[27c039f8cc0d4cec]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[99f34480590a0e22]::query::erase::Erased<[u8; 8usize]>>
29: 0x7fe709e6c343 - rustc_query_system[eb791f1d27a77a7b]::query::plumbing::try_execute_query::<rustc_query_impl[27c039f8cc0d4cec]::DynamicConfig<rustc_query_system[eb791f1d27a77a7b]::query::caches::VecCache<rustc_span[1e2a69f3aea93f35]::def_id::LocalDefId, rustc_middle[99f34480590a0e22]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[27c039f8cc0d4cec]::plumbing::QueryCtxt, false>
30: 0x7fe709e6bfd0 - rustc_query_impl[27c039f8cc0d4cec]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
31: 0x7fe70a66a860 - <rustc_middle[99f34480590a0e22]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[a7e15cd0e5348565]::check_crate::{closure#7}>::{closure#0}
32: 0x7fe70a669320 - rustc_hir_analysis[a7e15cd0e5348565]::check_crate
33: 0x7fe70a670e62 - rustc_interface[dae0a1533f7b1618]::passes::analysis
34: 0x7fe70a670a9d - rustc_query_impl[27c039f8cc0d4cec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[27c039f8cc0d4cec]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[99f34480590a0e22]::query::erase::Erased<[u8; 1usize]>>
35: 0x7fe70ab5de40 - rustc_query_system[eb791f1d27a77a7b]::query::plumbing::try_execute_query::<rustc_query_impl[27c039f8cc0d4cec]::DynamicConfig<rustc_query_system[eb791f1d27a77a7b]::query::caches::SingleCache<rustc_middle[99f34480590a0e22]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[27c039f8cc0d4cec]::plumbing::QueryCtxt, false>
36: 0x7fe70ab5dc47 - rustc_query_impl[27c039f8cc0d4cec]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
37: 0x7fe70ab6c512 - rustc_interface[dae0a1533f7b1618]::interface::run_compiler::<core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>, rustc_driver_impl[48609f831332dbe0]::run_compiler::{closure#0}>::{closure#0}
38: 0x7fe70ab5f909 - std[93ea1b589bf29457]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dae0a1533f7b1618]::util::run_in_thread_with_globals<rustc_interface[dae0a1533f7b1618]::util::run_in_thread_pool_with_globals<rustc_interface[dae0a1533f7b1618]::interface::run_compiler<core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>, rustc_driver_impl[48609f831332dbe0]::run_compiler::{closure#0}>::{closure#0}, core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>>::{closure#0}, core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>>
39: 0x7fe70ab5f733 - <<std[93ea1b589bf29457]::thread::Builder>::spawn_unchecked_<rustc_interface[dae0a1533f7b1618]::util::run_in_thread_with_globals<rustc_interface[dae0a1533f7b1618]::util::run_in_thread_pool_with_globals<rustc_interface[dae0a1533f7b1618]::interface::run_compiler<core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>, rustc_driver_impl[48609f831332dbe0]::run_compiler::{closure#0}>::{closure#0}, core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>>::{closure#0}, core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75f1a5f8e69b4518]::result::Result<(), rustc_span[1e2a69f3aea93f35]::ErrorGuaranteed>>::{closure#1} as core[75f1a5f8e69b4518]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
40: 0x7fe705b982d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfe69761f953335b6
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/alloc/src/boxed.rs:2007:9
41: 0x7fe705b982d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h626a827d88bd2697
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/alloc/src/boxed.rs:2007:9
42: 0x7fe705b982d5 - std::sys::unix::thread::Thread::new::thread_start::h3df882f04a39f11a
at /rustc/9bf30ebdfa50db6286d9400615c2bcb324c1a587/library/std/src/sys/unix/thread.rs:108:17
43: 0x7fe7059529eb - <unknown>
44: 0x7fe7059d67cc - <unknown>
45: 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.76.0-nightly (9bf30ebdf 2023-12-01) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.