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

[Internal Compiler Error] occurred when compiling eww with latest nightly build (2022-01-21) #93197

Closed
Animeshz opened this issue Jan 22, 2022 · 16 comments · Fixed by #93752
Closed
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) ❄️ ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Animeshz
Copy link

Animeshz commented Jan 22, 2022

Builds fails only with the latest (yesterday released) rustc 1.60.0-nightly (17d29dcdc 2022-01-21) running on x86_64-unknown-linux-gnu compiler. Tested with 2022-01-20 compiler and it works all okay!

Code

For now: refer to elkowar/eww:crates/eww/src/script_var_handler.rs#L137. I'll update if I'm able to minimize where actually the rustc panics.

<code>

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (17d29dcdc 2022-01-21)
binary: rustc
commit-hash: 17d29dcdce9b9e838635eb0adefd9b8b1588410b
commit-date: 2022-01-21
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

  eww on  master [✘] via  via 🦀 v1.60.0-nightly >>> cargo build --release
    ...
   Compiling gdk-pixbuf v0.14.0
   Compiling gdk v0.14.3
warning: the feature `format_args_capture` has been stable since 1.58.0 and no longer requires an attribute to enable
 --> crates/simplexpr/src/lib.rs:2:12
  |
2 | #![feature(format_args_capture)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

   Compiling gdkx11 v0.14.0
warning: `simplexpr` (lib) generated 1 warning
    Building [=======================> ] 364/366: gtk                                                                                                      Bu   Compiling eww v0.2.0 (/home/animesh/Projects/RustProjects/eww/crates/eww)
thread 'rustc' panicked at 'Expression ID not found', compiler/rustc_typeck/src/check/generator_interior/drop_ranges/cfg_build.rs:468: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.60.0-nightly (17d29dcdc 2022-01-21) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no --crate-type bin

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

query stack during panic:
#0 [typeck] type-checking `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#1 [mir_built] building MIR for `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
end of query stack
error: could not compile `eww`
Backtrace

  eww on  master [✘] via  via 🦀 v1.60.0-nightly took 2m15s ✗✗✗ RUST_BACKTRACE=1 cargo build --release
warning: /home/animesh/Projects/RustProjects/eww/crates/eww/Cargo.toml: the cargo feature `edition2021` has been stabilized in the 1.56 release and is no longer necessary to be listed in the manifest
  See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature.
warning: the feature `format_args_capture` has been stable since 1.58.0 and no longer requires an attribute to enable
 --> crates/simplexpr/src/lib.rs:2:12
  |
2 | #![feature(format_args_capture)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

warning: `simplexpr` (lib) generated 1 warning
   Compiling eww v0.2.0 (/home/animesh/Projects/RustProjects/eww/crates/eww)
thread 'rustc' panicked at 'Expression ID not found', compiler/rustc_typeck/src/check/generator_interior/drop_ranges/cfg_build.rs:468:52
stack backtrace:
   0: rust_begin_unwind
             at /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/library/std/src/panicking.rs:577:5
   1: core::panicking::panic_fmt
             at /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/library/core/src/panicking.rs:110:14
   2: core::panicking::panic_display
             at /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/library/core/src/panicking.rs:65:5
   3: core::panicking::panic_str
             at /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/library/core/src/panicking.rs:56:5
   4: core::option::expect_failed
             at /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/library/core/src/option.rs:1840:5
   5: <rustc_typeck::check::generator_interior::drop_ranges::DropRangesBuilder>::process_deferred_edges
   6: rustc_typeck::check::generator_interior::drop_ranges::cfg_build::build_control_flow_graph
   7: rustc_typeck::check::generator_interior::drop_ranges::compute_drop_ranges
   8: rustc_typeck::check::generator_interior::resolve_interior
   9: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  10: rustc_typeck::check::typeck
  11: 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::ty::context::TypeckResults>>
  12: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  13: <rustc_middle::ty::context::TyCtxt>::typeck_opt_const_arg
  14: rustc_mir_build::build::mir_built
  15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>>
  16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_built
  17: rustc_mir_transform::check_unsafety::unsafety_check_result
  18: <rustc_mir_transform::check_unsafety::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  19: 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::UnsafetyCheckResult>>
  20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result
  21: rustc_mir_transform::mir_const
  22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>>
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const
  24: rustc_mir_transform::mir_promoted
  25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, (&rustc_data_structures::steal::Steal<rustc_middle::mir::Body>, &rustc_data_structures::steal::Steal<rustc_index::vec::IndexVec<rustc_middle::mir::Promoted, rustc_middle::mir::Body>>)>>
  26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_promoted
  27: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  28: 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>>
  29: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  30: rustc_typeck::collect::type_of::type_of
  31: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of
  32: <rustc_middle::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  33: <&rustc_middle::ty::TyS as rustc_middle::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle::ty::util::OpaqueTypeExpander>
  34: rustc_middle::ty::util::fold_list::<rustc_middle::ty::util::OpaqueTypeExpander, &rustc_middle::ty::TyS, <&rustc_middle::ty::list::List<&rustc_middle::ty::TyS> as rustc_middle::ty::fold::TypeFoldable>::try_super_fold_with<rustc_middle::ty::util::OpaqueTypeExpander>::{closure#0}>
  35: <rustc_middle::ty::util::OpaqueTypeExpander as rustc_middle::ty::fold::FallibleTypeFolder>::try_fold_binder::<&rustc_middle::ty::list::List<&rustc_middle::ty::TyS>>
  36: <&rustc_middle::ty::TyS as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::<rustc_middle::ty::util::OpaqueTypeExpander>
  37: <smallvec::SmallVec<[rustc_middle::ty::subst::GenericArg; 8]> as core::iter::traits::collect::Extend<rustc_middle::ty::subst::GenericArg>>::extend::<core::iter::adapters::ResultShunt<core::iter::adapters::map::Map<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::subst::GenericArg>>, <&rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg> as rustc_middle::ty::fold::TypeFoldable>::try_super_fold_with<rustc_middle::ty::util::OpaqueTypeExpander>::{closure#0}>, !>>
  38: <&rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg> as rustc_middle::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle::ty::util::OpaqueTypeExpander>
  39: <&rustc_middle::ty::TyS as rustc_middle::ty::fold::TypeFoldable>::super_fold_with::<rustc_middle::ty::util::OpaqueTypeExpander>
  40: <&rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg> as rustc_middle::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle::ty::util::OpaqueTypeExpander>
  41: <rustc_middle::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  42: <rustc_middle::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  43: <rustc_middle::ty::context::TyCtxt>::try_expand_impl_trait_type
  44: rustc_typeck::check::check::check_item_type
  45: <rustc_middle::hir::map::Map>::visit_item_likes_in_module::<rustc_typeck::check::CheckItemTypesVisitor>
  46: rustc_typeck::check::check::check_mod_item_types
  47: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, ()>>
  48: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
  49: <rustc_middle::hir::map::Map>::for_each_module::<rustc_typeck::check_crate::{closure#6}::{closure#0}>
  50: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#6}>
  51: rustc_typeck::check_crate
  52: rustc_interface::passes::analysis
  53: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
  54: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  55: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
  56: <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::ErrorReported>>
  57: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  58: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
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://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.60.0-nightly (17d29dcdc 2022-01-21) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no --crate-type bin

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

query stack during panic:
#0 [typeck] type-checking `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#1 [mir_built] building MIR for `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#2 [unsafety_check_result] unsafety-checking `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#3 [mir_const] processing MIR for `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#4 [mir_promoted] processing `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#5 [mir_borrowck] borrow-checking `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start`
#6 [type_of] computing type of `script_var_handler::<impl at crates/eww/src/script_var_handler.rs:131:1: 179:2>::start::{opaque#0}`
#7 [check_mod_item_types] checking item types in module `script_var_handler`
#8 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `eww`

@Animeshz Animeshz 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 Jan 22, 2022
@Animeshz Animeshz changed the title [Internal Compiler Error] occurred when compiling eww [Internal Compiler Error] occurred when compiling eww with latest nightly build (2022-01-21) Jan 22, 2022
@lqd
Copy link
Member

lqd commented Jan 22, 2022

This looks like a drop ranges regression, I expect it will be fixed by the #93165 revert shortly. This looks different from #93161 so it's as of yet unclear whether #93180 will properly fix it cc @eholk.

@lqd
Copy link
Member

lqd commented Jan 22, 2022

@Animeshz would you be able to test if #93180 would fix your issue ? (it doesn't seem to fix other similar issues, but maybe it will fix this one), by following these steps:

  1. if you don't have it already, install rustup-toolchain-install-master to allow installing rust PR artifacts into rustup as easily as the stable or nightly toolchains.
  2. install the PR artifacts with rustup-toolchain-install-master 12c8eb434c751050bfbc9b7e270af75a2ef98b4c
  3. check if the PR does indeed fix this issue for you: by rerunning the command used to trigger the ICE above, adding the toolchain with +, for example cargo +12c8eb434c751050bfbc9b7e270af75a2ef98b4c build --release.

Thanks in advance.

@lqd
Copy link
Member

lqd commented Jan 22, 2022

@eholk I wasn't able to test #93165 on the eww crate here, but a friend tried it with the PR's try artifacts d634ef421795e0140724aa9fddf8137b83e616c9: the ICE seemed still present.
They also tried #93180 but it didn't fix it either.

@Animeshz
Copy link
Author

Animeshz commented Jan 22, 2022

Hello @lqd how do we find the PR hash? I tried commit hash 197640a but seems like PR commits aren't indexed: error: toolchain 197640adea324c9fdedd3162286fdbb84f50805a doesn't exist in any channel 👀 (sorry I'm new to this).

@lqd
Copy link
Member

lqd commented Jan 22, 2022

@Animeshz PRs are only built on-demand, so either when the bots test and merge it after review, or when someone asks manually for a try build before the PR is merged.

The latter is what I did here. The bot leaves a comment with the hash when/if the build is successful. In this case it is 12c8eb434c751050bfbc9b7e270af75a2ef98b4c as mentioned in my initial comment.

It would be helpful if you could also try d634ef421795e0140724aa9fddf8137b83e616c9.

However, it's likely that neither of these will fix the exact issue you're having. Someone has tried them on eww without success, unfortunately.

@Animeshz
Copy link
Author

Animeshz commented Jan 22, 2022

d634ef421795e0140724aa9fddf8137b83e616c9 didn't worked unfortunately, I'll try to find the commit which break this tomorrow what's actually is the minimal example where this is happening and check what's missing in drop range calculation tomorrow :)

@Animeshz
Copy link
Author

Okay, so the area of problem is shorten down, and it exactly happens when there's a Result unwrapping at here, i.e.:

evt_send.send(app::DaemonCommand::NoOp);   // compiles fine
evt_send.send(app::DaemonCommand::NoOp)?;  // throws ICE

@Animeshz
Copy link
Author

Animeshz commented Jan 23, 2022

This however works fine:

match evt_send.send(app::DaemonCommand::NoOp) {
    Ok(v) => v,
    Err(e) => {
        return Err(e);
    }
}

compiler/rustc_ast_lowering/src/expr.rs:1431 might have some significance in this issue 👀 (I guess?).

@lqd
Copy link
Member

lqd commented Jan 23, 2022

An MCVE of this issue would be super helpful.

@rustbot label +E-needs-mcve

@rustbot ping icebreakers-cleanup-crew

@rustbot rustbot added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections labels Jan 23, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jan 23, 2022

Hey Cleanup Crew ICE-breakers! This bug has been identified as a good
"Cleanup ICE-breaking candidate". In case it's useful, here are some
instructions for tackling these sorts of bugs. Maybe take a look?
Thanks! <3

cc @AminArria @ayazhafiz @camelid @chrissimpkins @contrun @elshize @h-michael @HallerPatrick @hdhoang @hellow554 @henryboisdequin @imtsuki @JamesPatrickGill @kanru @KarlK90 @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @shekohex @sinato @smmalis37 @steffahn @Stupremee @tamuhey @turboladen @woshilapin @yerke

@Animeshz
Copy link
Author

Here we go: unwrap-ice-repro.zip

@lqd
Copy link
Member

lqd commented Jan 24, 2022

That's a great first step, thanks. It still relies on tokio and could still be minimized, if anyone would want to take a stab at that.

@eholk
Copy link
Contributor

eholk commented Jan 24, 2022

@rustbot claim

@eholk
Copy link
Contributor

eholk commented Jan 24, 2022

Taking some time to look closer at this now. It looks like where this is crashing is not covered by #93165, so I will work on a proper fix or disabling PR.

eholk added a commit to eholk/rust that referenced this issue Jan 25, 2022
The previous PR, rust-lang#93165, still performed the drop range analysis
despite ignoring the results. Unfortunately, there were ICEs in
the analysis as well, so some packages failed to build (see the
issue rust-lang#93197 for an example). This change further disables the
analysis and just provides dummy results in that case.
@eholk
Copy link
Contributor

eholk commented Jan 25, 2022

I haven't gotten as much time to look into this today as I'd hope, but I did at least prepare a PR that disables the drop range analysis (#93284) and I've confirmed that eww builds with that change.

@hellow554
Copy link
Contributor

@eholk please add this testcase to your PR:

#![feature(try_blocks)]

use std::sync::{mpsc, mpsc::SendError};

pub async fn foo() {
    let (tx, _) = mpsc::channel();

    let _: Result<(), SendError<&str>> = try { tx.send("hello")?; };
}

fn main() {}

This also panics on stable. Feel free to add the regression from stable to stable tag.
This also panics without the feature gate, this might need further investigation.

eholk added a commit to eholk/rust that referenced this issue Jan 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 1, 2022
…pnkfelix

Disable drop range analysis

The previous PR, rust-lang#93165, still performed the drop range analysis despite ignoring the results. Unfortunately, there were ICEs in the analysis as well, so some packages failed to build (see the issue rust-lang#93197 for an example). This change further disables the analysis and just provides dummy results in that case.
eholk added a commit to eholk/rust that referenced this issue Feb 1, 2022
@bors bors closed this as completed in 0c3f0cd Feb 15, 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. 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) ❄️ ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections 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.

5 participants