Closed
Description
auto-reduced (treereduce-rust):
use std::io::{self, Read};
pub struct Container<'a> {
reader: &'a mut dyn Read,
}
impl<'a> Container {
pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> {
Container { reader: reader }
}
}
original:
use std::io::{self, Read};
use std::vec;
pub struct Container<'a> {
reader: &'a mut dyn Read
}
impl<'a> Container<'local_mac_tt> {
pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> {
Container { reader: reader }
}
pub fn read_to(&mut self, vec: &mut [u8]) {
self.reader.read(3, 4);
}
}
pub fn for_stdin<'a>() -> Container<'dropping_copy_types> {
let mut r = io::stdin();
Container::wrap(&mut r as &mut dyn io::Read)
//~^ ERROR cannot return value referencing local variable
}
fn main() {
let mut c = for_stdin();
let (Ok(_x) | Err(!)) = &res;
c.read_to(v); //~ ERROR E0308
}
Version information
rustc 1.81.0-nightly (bcf1f6db4 2024-07-11)
binary: rustc
commit-hash: bcf1f6db4594ae6132378b179a30cdb3599a863d
commit-date: 2024-07-11
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zpolonius=next
Program output
error[E0726]: implicit elided lifetime not allowed here
--> /tmp/icemaker_global_tempdir.4feaX3V4ADCu/rustc_testrunner_tmpdir_reporting.ZXhnCcXmdGdv/mvce.rs:7:10
|
7 | impl<'a> Container {
| ^^^^^^^^^ expected lifetime parameter
|
help: indicate the anonymous lifetime
|
7 | impl<'a> Container<'_> {
| ++++
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.4feaX3V4ADCu/rustc_testrunner_tmpdir_reporting.ZXhnCcXmdGdv/mvce.rs:11:2
|
11 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.4feaX3V4ADCu/rustc_testrunner_tmpdir_reporting.ZXhnCcXmdGdv/mvce.rs`
thread 'rustc' panicked at compiler/rustc_borrowck/src/dataflow.rs:418:13:
assertion `left == right` failed: polonius loan scopes differ from NLL borrow scopes, for body /tmp/icemaker_global_tempdir.4feaX3V4ADCu/rustc_testrunner_tmpdir_reporting.ZXhnCcXmdGdv/mvce.rs:8:5: 10:6 (#0)
left: {bb0[3]: [bw0]}
right: {bb0[4]: [bw0]}
stack backtrace:
0: 0x7362c658f655 - std::backtrace_rs::backtrace::libunwind::trace::hcb29af1cb57bcb8d
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x7362c658f655 - std::backtrace_rs::backtrace::trace_unsynchronized::he36459e1f5f5e93a
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7362c658f655 - std::sys::backtrace::_print_fmt::heffc99ac4b4675cf
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/sys/backtrace.rs:68:5
3: 0x7362c658f655 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf245997fe8a5daf1
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/sys/backtrace.rs:44:22
4: 0x7362c65ded3b - core::fmt::rt::Argument::fmt::h0e5779e064dbb7df
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/core/src/fmt/rt.rs:173:76
5: 0x7362c65ded3b - core::fmt::write::h98cec97192061fdf
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/core/src/fmt/mod.rs:1182:21
6: 0x7362c658403f - std::io::Write::write_fmt::he6c3afdd93fdc681
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/io/mod.rs:1835:15
7: 0x7362c658f42e - std::sys::backtrace::_print::h636b421fd7a2e420
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/sys/backtrace.rs:47:5
8: 0x7362c658f42e - std::sys::backtrace::print::haa02f8c85818b01f
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/sys/backtrace.rs:34:9
9: 0x7362c6591d79 - std::panicking::default_hook::{{closure}}::h50c9c60844185e9c
10: 0x7362c6591b1c - std::panicking::default_hook::hde778ca172ded902
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/panicking.rs:292:9
11: 0x7362c2a21c59 - std[ad414beb854749b5]::panicking::update_hook::<alloc[4dde9fbc2019d87d]::boxed::Box<rustc_driver_impl[7c2f87ab8379164f]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7362c659269f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h77bec8c01b3205fe
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/alloc/src/boxed.rs:2078:9
13: 0x7362c659269f - std::panicking::rust_panic_with_hook::h02aa1f3fa26e53db
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/panicking.rs:804:13
14: 0x7362c65922c7 - std::panicking::begin_panic_handler::{{closure}}::he573aa5eefbb7bfc
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/panicking.rs:670:13
15: 0x7362c658fb19 - std::sys::backtrace::__rust_end_short_backtrace::ha97f3bba049b4ef0
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/sys/backtrace.rs:171:18
16: 0x7362c6591f54 - rust_begin_unwind
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/panicking.rs:661:5
17: 0x7362c65db2f3 - core::panicking::panic_fmt::hd5960ad38e738d13
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/core/src/panicking.rs:74:14
18: 0x7362c65db8cf - core::panicking::assert_failed_inner::h02724f5e69869174
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/core/src/panicking.rs:405:23
19: 0x7362c26d1527 - core[5577311df7d42be1]::panicking::assert_failed::<indexmap[5fb9d275e5314e4d]::map::IndexMap<rustc_middle[77b0c22bfadf3e56]::mir::Location, alloc[4dde9fbc2019d87d]::vec::Vec<rustc_borrowck[6a0718d1facf5b73]::dataflow::BorrowIndex>, core[5577311df7d42be1]::hash::BuildHasherDefault<rustc_hash[fad87a7c8a3801b7]::FxHasher>>, indexmap[5fb9d275e5314e4d]::map::IndexMap<rustc_middle[77b0c22bfadf3e56]::mir::Location, alloc[4dde9fbc2019d87d]::vec::Vec<rustc_borrowck[6a0718d1facf5b73]::dataflow::BorrowIndex>, core[5577311df7d42be1]::hash::BuildHasherDefault<rustc_hash[fad87a7c8a3801b7]::FxHasher>>>
20: 0x7362c504194c - rustc_borrowck[6a0718d1facf5b73]::do_mir_borrowck
21: 0x7362c5025142 - rustc_query_impl[996ec1e1a9f37899]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[996ec1e1a9f37899]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[77b0c22bfadf3e56]::query::erase::Erased<[u8; 8usize]>>
22: 0x7362c43a47b3 - rustc_query_system[f92dbd75fbf471ce]::query::plumbing::try_execute_query::<rustc_query_impl[996ec1e1a9f37899]::DynamicConfig<rustc_query_system[f92dbd75fbf471ce]::query::caches::VecCache<rustc_span[9d9e1055ab85fce3]::def_id::LocalDefId, rustc_middle[77b0c22bfadf3e56]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[996ec1e1a9f37899]::plumbing::QueryCtxt, false>
23: 0x7362c43a420d - rustc_query_impl[996ec1e1a9f37899]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
24: 0x7362c4397a21 - rustc_interface[d8bba0fea4cb4dbe]::passes::analysis
25: 0x7362c4396c07 - rustc_query_impl[996ec1e1a9f37899]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[996ec1e1a9f37899]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[77b0c22bfadf3e56]::query::erase::Erased<[u8; 1usize]>>
26: 0x7362c4ef7be5 - rustc_query_system[f92dbd75fbf471ce]::query::plumbing::try_execute_query::<rustc_query_impl[996ec1e1a9f37899]::DynamicConfig<rustc_query_system[f92dbd75fbf471ce]::query::caches::SingleCache<rustc_middle[77b0c22bfadf3e56]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[996ec1e1a9f37899]::plumbing::QueryCtxt, false>
27: 0x7362c4ef794f - rustc_query_impl[996ec1e1a9f37899]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
28: 0x7362c4df7305 - rustc_interface[d8bba0fea4cb4dbe]::interface::run_compiler::<core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>, rustc_driver_impl[7c2f87ab8379164f]::run_compiler::{closure#0}>::{closure#1}
29: 0x7362c4dc5509 - std[ad414beb854749b5]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d8bba0fea4cb4dbe]::util::run_in_thread_with_globals<rustc_interface[d8bba0fea4cb4dbe]::util::run_in_thread_pool_with_globals<rustc_interface[d8bba0fea4cb4dbe]::interface::run_compiler<core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>, rustc_driver_impl[7c2f87ab8379164f]::run_compiler::{closure#0}>::{closure#1}, core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>>::{closure#0}, core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>>
30: 0x7362c4dc52ba - <<std[ad414beb854749b5]::thread::Builder>::spawn_unchecked_<rustc_interface[d8bba0fea4cb4dbe]::util::run_in_thread_with_globals<rustc_interface[d8bba0fea4cb4dbe]::util::run_in_thread_pool_with_globals<rustc_interface[d8bba0fea4cb4dbe]::interface::run_compiler<core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>, rustc_driver_impl[7c2f87ab8379164f]::run_compiler::{closure#0}>::{closure#1}, core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>>::{closure#0}, core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5577311df7d42be1]::result::Result<(), rustc_span[9d9e1055ab85fce3]::ErrorGuaranteed>>::{closure#2} as core[5577311df7d42be1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x7362c659c4fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4b9d0e9c592a6ae1
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/alloc/src/boxed.rs:2064:9
32: 0x7362c659c4fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6892ad45769a753a
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/alloc/src/boxed.rs:2064:9
33: 0x7362c659c4fb - std::sys::pal::unix::thread::Thread::new::thread_start::h4695e9cd59270e16
at /rustc/bcf1f6db4594ae6132378b179a30cdb3599a863d/library/std/src/sys/pal/unix/thread.rs:108:17
34: 0x7362bf4a6ded - <unknown>
35: 0x7362bf52a0dc - <unknown>
36: 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: please make sure that you have updated to the latest nightly
note: rustc 1.81.0-nightly (bcf1f6db4 2024-07-11) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z polonius=next -Z dump-mir-dir=dir
query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /tmp/icemaker_global_tempdir.4feaX3V4ADCu/rustc_testrunner_tmpdir_reporting.ZXhnCcXmdGdv/mvce.rs:7:1: 7:19>::wrap`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0601, E0726.
For more information about an error, try `rustc --explain E0601`.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issues related for using Polonius in the borrow checkerStatus: This bug is tracked inside the repo by a `known-bug` test.Status: 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.