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

rustc panic #98170

Closed
rickardnorlander opened this issue Jun 16, 2022 · 3 comments · Fixed by #98184
Closed

rustc panic #98170

rickardnorlander opened this issue Jun 16, 2022 · 3 comments · Fixed by #98184
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

@rickardnorlander
Copy link

Code

pub struct MyStruct<'a> {
    field: &'a [u32],
}

impl MyStruct<'_> {
    pub fn new<'a>(field: &'a[u32]) -> MyStruct<'a> {
	Self{field}
    }
}

fn main() {
}

Meta

rustc 1.63.0-nightly (b31f9cc22 2022-06-15)
binary: rustc
commit-hash: b31f9cc22bcd720b37ddf927afe378108a5b9a54
commit-date: 2022-06-15
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.5

Error output

Compiling crash_repro v0.1.0 (/home/rickard/repro)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_borrowck/src/diagnostics/region_errors.rs:683:52
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.63.0-nightly (b31f9cc22 2022-06-15) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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 `<impl at src/main.rs:5:1: 9:2>::new`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `crash_repro`
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/b31f9cc22bcd720b37ddf927afe378108a5b9a54/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/b31f9cc22bcd720b37ddf927afe378108a5b9a54/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/b31f9cc22bcd720b37ddf927afe378108a5b9a54/library/core/src/panicking.rs:48:5
   3: <rustc_borrowck::MirBorrowckCtxt>::report_general_error
   4: rustc_borrowck::do_mir_borrowck
   5: rustc_borrowck::mir_borrowck
   6: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
   7: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
   8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>>
   9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  10: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_interface::passes::analysis::{closure#2}::{closure#0}>
  11: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#2}>
  12: rustc_interface::passes::analysis
  13: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  15: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  16: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  17: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  18: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  19: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>

@rickardnorlander rickardnorlander 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 Jun 16, 2022
@rickardnorlander
Copy link
Author

Changing Self{field} to MyStruct{field} makes it build btw.

@compiler-errors compiler-errors self-assigned this Jun 16, 2022
@jhpratt
Copy link
Member

jhpratt commented Jun 16, 2022

I haven't done a search for the exact commit, but on the playground this regressed between beta and nightly.

@rustbot label +regression-from-stable-to-nightly

@compiler-errors
Copy link
Member

compiler-errors commented Jun 16, 2022

This is due to the NLL stabilization PR #95565, since it manifests with #![feature(nll)] on 1.61 (with env BOOTSTRAP_RUSTC=1 to allow feature flags). I'll be looking at it in a few hours when I get home!

matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Jun 18, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Jun 18, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 19, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 21, 2022
…impl-nll, r=cjgillot

Give name if anonymous region appears in impl signature

Fixes rust-lang#98170

We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 21, 2022
…impl-nll, r=cjgillot

Give name if anonymous region appears in impl signature

Fixes rust-lang#98170

We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 22, 2022
…impl-nll, r=cjgillot

Give name if anonymous region appears in impl signature

Fixes rust-lang#98170

We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jun 23, 2022
…impl-nll, r=cjgillot

Give name if anonymous region appears in impl signature

Fixes rust-lang#98170

We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
@bors bors closed this as completed in 49bcc70 Jun 24, 2022
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. glacier ICE tracked in rust-lang/glacier. 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.

4 participants