Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found unstable fingerprints for mir_borrowck, probably related to async code #99774

Closed
Mingun opened this issue Jul 26, 2022 · 1 comment
Closed
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Mingun
Copy link

Mingun commented Jul 26, 2022

Code

Unfortunately it is not reproduced anymore, so I cannot create a minimal example. The problem was reproduced in that state. Before that I've doing a rebase and compiled the 2 previous commits using the same command.

The bug happened on this commit:
https:/Mingun/quick-xml/tree/rustc-panic

Checkout the branch and run in the root repo directory:

cargo test --all-features

Meta

I use stable compiler:
rustc --version --verbose:

rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-pc-windows-msvc
release: 1.61.0
LLVM version: 14.0.0

I've also tried

cargo +nightly test --all-features

and (after small compilation fix)

cargo test --features async-tokio

as suggested by issue template, but problem did not reproduced. Also, after these commands it is no more reproduced by the original command. The compilation finishes successfully, although during panic it seems that borrow checker tried to complain about something.

Before the problem is arised, I've compiled similarly the same code (while I've worked on a PR for quick-xml) without problems. So this bug happened only once (but stable until I've run cargo test which seems to rewrite the file cache).

Error output

The full command output:

PS D:\Projects\quick-xml> cargo test --all-features
   Compiling quick-xml v0.23.0 (D:\Projects\quick-xml)
error: lifetime may not live long enough
   --> src\reader\mod.rs:141:39
    |
137 |               &mut self,
    |               - let's call the lifetime of this reference `'1`
...
141 |           ) -> Result<Option<&'b [u8]>> {
    |  _______________________________________^
142 | |             // search byte must be within the ascii range
143 | |             debug_assert!(byte.is_ascii());
144 | |
...   |
181 | |             }
182 | |         }
    | |_________^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'1`
    |
   ::: src\reader\async_reader.rs:21:27
    |
21  |       impl_buffered_source!('b, reader, async, await);
    |       -----------------------------------------------
    |       |                     |
    |       |                     lifetime `'b` defined here
    |       in this macro invocation
    |
    = note: this error originates in the macro `impl_buffered_source` (in Nightly builds, run with -Z macro-backtrace for more info)

error: lifetime may not live long enough
   --> src\reader\mod.rs:180:17
    |
137 |             &mut self,
    |             - let's call the lifetime of this reference `'1`
...
180 |                 Ok(Some(&buf[start..]))
    |                 ^^^^^^^^^^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'b`
    |
   ::: src\reader\async_reader.rs:21:27
    |
21  |     impl_buffered_source!('b, reader, async, await);
    |     -----------------------------------------------
    |     |                     |
    |     |                     lifetime `'b` defined here
    |     in this macro invocation
    |
    = note: this error originates in the macro `impl_buffered_source` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: encountered incremental compilation error with mir_borrowck(quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p quick_xml` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https:/rust-lang/rust/issues/84970> for more information

thread 'rustc' panicked at 'Found unstable fingerprints for mir_borrowck(quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until): BorrowCheckResult { concrete_opaque_types: VecMap([(OpaqueTypeKey { def_id: DefId(0:6217 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::{opaque#0}), substs: [R, ReFree(DefId(0:6215 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until), BrNamed(DefId(0:8720 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::'_), '_)), ReFree(DefId(0:6215 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until), BrNamed(DefId(0:8720 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::'_), '_)), ReFree(DefId(0:6215 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until), BrNamed(DefId(0:8721 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::'_#1), '_))] }, OpaqueHiddenType { span: src\reader\mod.rs:141:39: 182:10 (#4938), ty: [type error] })]), closure_requirements: None, used_mut_upvars: [], tainted_by_errors: Some(ErrorGuaranteed(())) }', compiler\rustc_query_system\src\query\plumbing.rs:626:9
stack backtrace:
   0:     0x7ffadc02988f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h50aa8caf753a2b27
   1:     0x7ffadc054c3a - core::fmt::write::h838fc71521d9a769
   2:     0x7ffadc01c709 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h36f954dfa88567a7
   3:     0x7ffadc02ceab - std::panicking::default_hook::h14f77031689d5a65
   4:     0x7ffadc02ca9e - std::panicking::default_hook::h14f77031689d5a65
   5:     0x7ffac8f02ee6 - rustc_driver[644f353906beda0e]::pretty::print_after_hir_lowering                                                                 
   6:     0x7ffadc02d78a - std::panicking::rust_panic_with_hook::h093296cdc6b43259
   7:     0x7ffadc02d4dd - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h87de4eb99e2d660b
   8:     0x7ffadc02a197 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h50aa8caf753a2b27
   9:     0x7ffadc02d1b9 - rust_begin_unwind
  10:     0x7ffadc092d15 - core::panicking::panic_fmt::h9a20e90cefbba781
  11:     0x7ffacdb417e0 - rustc_query_system[36f3c4afb232c86b]::query::plumbing::incremental_verify_ich_cold
  12:     0x7ffacc8def3e - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  13:     0x7ffacc9030a5 - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  14:     0x7ffacc83a819 - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  15:     0x7ffacc934248 - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  16:     0x7ffacd56a706 - <rustc_middle[f8c5bc87ecf9dc9e]::ty::context::TyCtxt>::mir_borrowck_opt_const_arg
  17:     0x7ffacb7097c0 - <rustc_mir_transform[2dafa68c8673e644]::mir_keys::GatherCtors as rustc_hir[ff973f7ee110f744]::intravisit::Visitor>::visit_variant_data
  18:     0x7ffacc644263 - <rustc_query_impl[5f7022dda011ac8e]::on_disk_cache::EncodedSourceFileId as core[14ebc1417b592300]::fmt::Debug>::fmt
  19:     0x7ffacc6ff614 - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  20:     0x7ffacc808ffe - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  21:     0x7ffacc96ec41 - <rustc_query_impl[5f7022dda011ac8e]::queries::global_backend_features as rustc_query_system[36f3c4afb232c86b]::query::config::QueryDescription<rustc_query_impl[5f7022dda011ac8e]::plumbing::QueryCtxt>>::describe
  22:     0x7ffacc622931 - <rustc_query_impl[5f7022dda011ac8e]::Queries as rustc_middle[f8c5bc87ecf9dc9e]::ty::query::QueryEngine>::try_mark_green
  23:     0x7ffacb70b28f - <rustc_mir_transform[2dafa68c8673e644]::mir_keys::GatherCtors as rustc_hir[ff973f7ee110f744]::intravisit::Visitor>::visit_variant_data
Backtrace

I've rerun command with the environment variable set:

PS D:\Projects\quick-xml> $env:RUST_BACKTRACE=1
PS D:\Projects\quick-xml> cargo test --all-features
   Compiling quick-xml v0.23.0 (D:\Projects\quick-xml)
error: lifetime may not live long enough                                                                                                                    
   --> src\reader\mod.rs:141:39
    |
137 |               &mut self,
    |               - let's call the lifetime of this reference `'1`
...
141 |           ) -> Result<Option<&'b [u8]>> {
    |  _______________________________________^
142 | |             // search byte must be within the ascii range
143 | |             debug_assert!(byte.is_ascii());
144 | |
...   |
181 | |             }
182 | |         }
    | |_________^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'1`
    |
   ::: src\reader\async_reader.rs:21:27
    |
21  |       impl_buffered_source!('b, reader, async, await);
    |       -----------------------------------------------
    |       |                     |
    |       |                     lifetime `'b` defined here
    |       in this macro invocation
    |
    = note: this error originates in the macro `impl_buffered_source` (in Nightly builds, run with -Z macro-backtrace for more info)

error: lifetime may not live long enough
   --> src\reader\mod.rs:180:17
    |
137 |             &mut self,
    |             - let's call the lifetime of this reference `'1`
...
180 |                 Ok(Some(&buf[start..]))
    |                 ^^^^^^^^^^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'b`
    |
   ::: src\reader\async_reader.rs:21:27
    |
21  |     impl_buffered_source!('b, reader, async, await);
    |     -----------------------------------------------
    |     |                     |
    |     |                     lifetime `'b` defined here
    |     in this macro invocation
    |
    = note: this error originates in the macro `impl_buffered_source` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: encountered incremental compilation error with mir_borrowck(quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p quick_xml` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https:/rust-lang/rust/issues/84970> for more information

thread 'rustc' panicked at 'Found unstable fingerprints for mir_borrowck(quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until): BorrowCheckResult { concrete_opaque_types: VecMap([(OpaqueTypeKey { def_id: DefId(0:6217 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::{opaque#0}), substs: [R, ReFree(DefId(0:6215 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until), BrNamed(DefId(0:8720 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::'_), '_)), ReFree(DefId(0:6215 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until), BrNamed(DefId(0:8720 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::'_), '_)), ReFree(DefId(0:6215 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until), BrNamed(DefId(0:8721 ~ quick_xml[bff6]::reader::async_reader::{impl#0}::read_bytes_until::'_#1), '_))] }, OpaqueHiddenType { span: src\reader\mod.rs:141:39: 182:10 (#4938), ty: [type error] })]), closure_requirements: None, used_mut_upvars: [], tainted_by_errors: Some(ErrorGuaranteed(())) }', compiler\rustc_query_system\src\query\plumbing.rs:626:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.                                                                     

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https:/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.61.0 (fe5b13d68 2022-05-18) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `reader::async_reader::<impl at src\reader\async_reader.rs:20:1: 22:2>::read_bytes_until`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `reader::async_reader::<impl at src\reader\async_reader.rs:20:1: 22:2>::read_bytes_until` 
#2 [optimized_mir] optimizing MIR for `reader::async_reader::<impl at src\reader\async_reader.rs:20:1: 22:2>::read_bytes_until`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `quick-xml` due to 3 previous errors                                                                                               
warning: build failed, waiting for other jobs to finish...
PS D:\Projects\quick-xml>

@Mingun Mingun added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 26, 2022
@cjgillot
Copy link
Contributor

Thanks for the report. This is #98890. This bug is fixed on the latest stable 1.62.1. You are running 1.61.0, upgrading should fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants