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

ICE: RegionKind::ReError constructed but no error reported #108170

Closed
saethlin opened this issue Feb 17, 2023 · 3 comments · Fixed by #108176
Closed

ICE: RegionKind::ReError constructed but no error reported #108170

saethlin opened this issue Feb 17, 2023 · 3 comments · Fixed by #108176
Assignees
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@saethlin
Copy link
Member

saethlin commented Feb 17, 2023

Possibly related to #107988 ?

Code

cargo +nightly test in chwp v1.183.0
The error message is in building assertor v0.0.1 but I can't reproduce with just building that crate, which is odd.

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (9a7cc6c32 2023-02-16)
binary: rustc
commit-hash: 9a7cc6c32f1a690f86827e4724bcda85e506ef35
commit-date: 2023-02-16
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: RegionKind::ReError constructed but no error reported
Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: RegionKind::ReError constructed but no error reported
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_middle::ty::context::TyCtxt>::mk_re_error_misc
             3: rustc_infer::infer::lexical_region_resolve::resolve
             4: <rustc_infer::infer::InferCtxt>::resolve_regions
             5: rustc_hir_analysis::check::compare_impl_item::compare_method_predicate_entailment
             6: rustc_hir_analysis::check::compare_impl_item::compare_impl_method
             7: rustc_hir_analysis::check::check::check_mod_item_types
             8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
            10: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
            11: rustc_hir_analysis::check_crate
            12: rustc_interface::passes::analysis
            13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            15: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}>
            16: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
            17: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            18: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            19: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            20: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/9a7cc6c32f1a690f86827e4724bcda85e506ef35/library/alloc/src/boxed.rs:1988:9
            22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/9a7cc6c32f1a690f86827e4724bcda85e506ef35/library/alloc/src/boxed.rs:1988:9
            23: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/9a7cc6c32f1a690f86827e4724bcda85e506ef35/library/std/src/sys/unix/thread.rs:108:17
            24: <unknown>
            25: <unknown>
          

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.69.0-nightly (9a7cc6c32 2023-02-16) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

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

query stack during panic:
end of query stack
error: could not compile `assertor`; 1 warning emitted
warning: build failed, waiting for other jobs to finish...

@saethlin saethlin 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 Feb 17, 2023
@saethlin
Copy link
Member Author

@rustbot label +E-needs-mcve

@rustbot rustbot added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Feb 17, 2023
@compiler-errors
Copy link
Member

I'm pretty sure I know how to make an MCVE for this.

@rustbot claim

@compiler-errors
Copy link
Member

Ah, lol, it's because google/assertor#1 hasn't landed, and a recent ReError PR made it delay a bug that should've been handled more gracefully.

The error message is in building assertor v0.0.1 but I can't reproduce with just building that crate, which is odd.

If you build assertor with -Aimplied_bounds_entailment (or add #![allow(implied_bounds_entailment)]) then it ICEs similarly.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 22, 2023
…-resolve-bug, r=oli-obk

Don't delay `ReError` bug during lexical region resolve

Lexical region resolution returns a list of `RegionResolutionError` which don't necessarily correspond to diagnostics being emitted. The compiler may, validly, throw away these resolution errors and do something else. Therefore it's not valid to use `ReError` during lifetime resolution, since we may actually be on a totally fine compilation path.

For example, the `implied_bounds_entailment` lint runs region resolution twice, and only emits an error if it fails both times. If we delay a bug and create a `ReError` during this first run, then we will ICE.

Fixes rust-lang#108170

----

Side-note: this is conceptually equivalent to how we can't necessarily delay bugs or create `ty::Error` during trait solving/fulfillment, since the compiler is allowed to throw away these fulfillment errors to do other things. It's only once we actually emit an error (`report_region_errors` / `report_fulfillment_errors`)
@bors bors closed this as completed in 4d9effc Feb 23, 2023
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. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

Successfully merging a pull request may close this issue.

3 participants