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: error performing operation: fully_perform #124189

Open
cushionbadak opened this issue Apr 20, 2024 · 3 comments
Open

ICE: error performing operation: fully_perform #124189

cushionbadak opened this issue Apr 20, 2024 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cushionbadak
Copy link

Code

(reduced)

trait Trait {
    type Type;
}

impl<T> Trait for T {
    type Type = ();
}

fn f(_: <&Copy as Trait>::Type) {}

fn main() {
    f(());
}
Original Code

//@ check-fail

trait Trait {
    type Type;
}

impl<T> Trait for T {
    type Type = ();
}

fn f<'a, 'b>(_: <&'a Copy as Trait>::Type)
where
    'a: 'a,
    'b: 'b,
{
}

fn g<'a, 'b>() {
    f::<'a, 'b>(());
    //~^ ERROR lifetime may not live long enough
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (f9b161492 2024-04-19)
binary: rustc
commit-hash: f9b16149208c8a8a349c32813312716f6603eb6f
commit-date: 2024-04-19
host: aarch64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.4

Command

rustc

Error output

warning: trait objects without an explicit `dyn` are deprecated
 --> r_crushed_497411.rs:9:11
  |
9 | fn f(_: <&Copy as Trait>::Type) {}
  |           ^^^^
  |
  = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
  = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
  = note: `#[warn(bare_trait_objects)]` on by default
help: if this is an object-safe trait, use `dyn`
  |
9 | fn f(_: <&dyn Copy as Trait>::Type) {}
  |           +++

warning: 1 warning emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors
Backtrace


error: internal compiler error: error performing operation: fully_perform
  --> r_crushed_497411.rs:12:5
   |
12 |     f(());
   |     ^^^^^
   |
note: delayed at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:85:25
         0: std::backtrace::Backtrace::create
         1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         2: <rustc_errors::DiagCtxt>::emit_diagnostic
         3: <rustc_errors::diagnostic::Diag>::emit_producing_error_guaranteed
         4: rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints::<rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate>, (), <rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform::{closure#1}>
         5: <rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform
         6: <rustc_borrowck::type_check::TypeChecker>::fully_perform_op::<(), rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate>>
         7: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
         8: rustc_borrowck::type_check::type_check
         9: rustc_borrowck::nll::compute_regions
        10: rustc_borrowck::do_mir_borrowck
        11: rustc_borrowck::mir_borrowck
        12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        13: <rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
        14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        15: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        16: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
        17: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::enabled::par_for_each_in<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>
        18: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#1}>
        19: rustc_interface::passes::analysis
        20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        21: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        23: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        24: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#3}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        25: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
        26: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        27: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#2} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        28: std::sys::pal::unix::thread::Thread::new::thread_start
        29: __pthread_joiner_wake
  --> r_crushed_497411.rs:12:5
   |
12 |     f(());
   |     ^^^^^

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: please attach the file at `/Users/jisukbyun/workspace/placeholder/240420_rustexec/rustc-ice-2024-04-20T05_47_07-83822.txt` to your bug report

query stack during panic:
end of query stack

Note

@cushionbadak cushionbadak 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 Apr 20, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 20, 2024
@cushionbadak
Copy link
Author

cushionbadak commented Apr 20, 2024

The ICE indeed appeared at rustc command (at nightly-2024-04-20 as reported),
but I cannot reproduce it with cargo-bisect-rustc.

❯ cargo bisect-rustc --version                                        
cargo-bisect-rustc-bisect-rustc 0.6.8
2024-01-01 ~ 2024-04-20 Log

❯ cargo bisect-rustc --start=2024-01-01 --end=2024-04-20 --preserve --regress=ice
checking the start range to find a passing nightly
installing nightly-2024-01-01
testing...
RESULT: nightly-2024-01-01, ===> No

checking the end range to verify it does not pass
installing nightly-2024-04-20
testing...
RESULT: nightly-2024-04-20, ===> No
uninstalling nightly-2024-04-20

ERROR: the end of the range (nightly-2024-04-20) does not reproduce the regression

Stack backtrace:
   0: __mh_execute_header
   1: __mh_execute_header
   2: __mh_execute_header
   3: __mh_execute_header
   4: __mh_execute_header
   5: __mh_execute_header

2024-01-01 ~ 2024-04-19 Log

❯ cargo bisect-rustc --start=2024-01-01 --end=2024-04-19 --preserve --regress=ice
checking the start range to find a passing nightly
installing nightly-2024-01-01
testing...
RESULT: nightly-2024-01-01, ===> No

checking the end range to verify it does not pass
installing nightly-2024-04-19
testing...
RESULT: nightly-2024-04-19, ===> No

ERROR: the end of the range (nightly-2024-04-19) does not reproduce the regression

Stack backtrace:
   0: __mh_execute_header
   1: __mh_execute_header
   2: __mh_execute_header
   3: __mh_execute_header
   4: __mh_execute_header
   5: __mh_execute_header

@matthiaskrgr
Copy link
Member

This is probably a duplicate of #103899

@lqd
Copy link
Member

lqd commented Apr 20, 2024

Ah I see, it only ICEs on older editions. If you're using a new cargo project to bisect, it will be set to edition=2021 by cargo new.

With that, an ICE bisects to nightly-2022-08-10: broken MIR in DefId(0:9 ~ issue_124189[40d2]::main) (NoSolution): could not prove Binder(WellFormed(<&dyn std::marker::Copy as Trait>::Type), []).

Yeah it looks related to #103899, and both are in very close pieces of code -- although the repro there seems older, so maybe not an exact duplicate per se, but seemingly share some common WF-related cause. That one ICEs in liveness (one of the steps in MIR typeck, <rustc_borrowck::type_check::liveness::trace::LivenessContext>::compute_drop_data) while this one in MIR typeck directly (<rustc_borrowck::type_check::TypeChecker>::fully_perform_op::<(), rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate>>).

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 22, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 4, 2024
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) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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

5 participants