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: no type for node #101623

Closed
yshui opened this issue Sep 9, 2022 · 3 comments · Fixed by #101629
Closed

ICE: no type for node #101623

yshui opened this issue Sep 9, 2022 · 3 comments · Fixed by #101629
Assignees
Labels
C-bug Category: This is a bug. P-medium Medium priority regression-untriaged Untriaged performance or correctness regression. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@yshui
Copy link
Contributor

yshui commented Sep 9, 2022

Code

I tried this code:

pub struct Stuff {
    inner: *mut (),
}

pub struct Wrap<T>(T);

fn fun<T>(t: T) -> Wrap<T> {
	todo!()
}

pub trait Trait<'de> {
    fn do_stuff(_: Wrap<&'de mut Self>);
}

impl<'a> Trait<'a> for () {
    fn do_stuff(_: Wrap<&'a mut Self>) {}
}

 fn fun2(t: &mut Stuff) -> () {
     let Stuff { inner, .. } = t;
     Trait::do_stuff({ fun(&mut *inner) });
 }

Version

searched nightlies: from nightly-2022-08-18 to nightly-2022-09-09
regressed nightly: nightly-2022-08-23
searched commit range: c0941df...015a824
regressed commit: 0b71ffc

bisected with cargo-bisect-rustc v0.6.4

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc ice

Backtrace

Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/compiler/rustc_errors/src/lib.rs:1460:9
stack backtrace:
   0:     0x7f9f39479eb0 - std::backtrace_rs::backtrace::libunwind::trace::hd4d72bf9fe10967c
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f9f39479eb0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6503f59b8cbe2ed6
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9f39479eb0 - std::sys_common::backtrace::_print_fmt::h589945bf8bc39343
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f9f39479eb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2f4d863594a68c91
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f9f394d4efe - core::fmt::write::h9fd78932fc37b51c
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f9f3946a595 - std::io::Write::write_fmt::h6066f9f8807a65d2
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/io/mod.rs:1679:15
   6:     0x7f9f3947cb63 - std::sys_common::backtrace::_print::h355143466bed5429
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f9f3947cb63 - std::sys_common::backtrace::print::hb82c149c248573a7
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f9f3947cb63 - std::panicking::default_hook::{{closure}}::h9412e92c58f99121
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:295:22
   9:     0x7f9f3947c84f - std::panicking::default_hook::h1a8b46d36ee22d51
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:314:9
  10:     0x7f9f3bce0101 - rustc_driver[8f3cca79f91367d]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f9f3947d39d - std::panicking::rust_panic_with_hook::he6adbff8aae13c88
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:702:17
  12:     0x7f9f3cc91e11 - std[dce46a4773fb9772]::panicking::begin_panic::<rustc_errors[724a1349d7209c57]::ExplicitBug>::{closure#0}
  13:     0x7f9f3cc91436 - std[dce46a4773fb9772]::sys_common::backtrace::__rust_end_short_backtrace::<std[dce46a4773fb9772]::panicking::begin_panic<rustc_errors[724a1349d7209c57]::ExplicitBug>::{closure#0}, !>
  14:     0x7f9f3cc913d6 - std[dce46a4773fb9772]::panicking::begin_panic::<rustc_errors[724a1349d7209c57]::ExplicitBug>
  15:     0x7f9f3cc913c6 - std[dce46a4773fb9772]::panic::panic_any::<rustc_errors[724a1349d7209c57]::ExplicitBug>
  16:     0x7f9f3cc8f0ad - <rustc_errors[724a1349d7209c57]::HandlerInner>::bug::<&alloc[c797b21ee8d71470]::string::String>
  17:     0x7f9f3cc8ebb0 - <rustc_errors[724a1349d7209c57]::Handler>::bug::<&alloc[c797b21ee8d71470]::string::String>
  18:     0x7f9f3cd6aa4d - rustc_middle[a60e78b424f055fe]::ty::context::tls::with_context_opt::<rustc_middle[a60e78b424f055fe]::ty::context::tls::with_opt<rustc_middle[a60e78b424f055fe]::util::bug::opt_span_bug_fmt<rustc_span[5934fe088b167bef]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:     0x7f9f3cd6bea6 - rustc_middle[a60e78b424f055fe]::util::bug::opt_span_bug_fmt::<rustc_span[5934fe088b167bef]::span_encoding::Span>
  20:     0x7f9f3a6623a3 - rustc_middle[a60e78b424f055fe]::util::bug::bug_fmt
  21:     0x7f9f3abf965d - <rustc_middle[a60e78b424f055fe]::ty::context::TypeckResults>::expr_ty_adjusted
  22:     0x7f9f3cafd584 - <rustc_infer[98c54418d1cb0d3e]::infer::InferCtxt as rustc_trait_selection[3d01787dfec269ea]::traits::error_reporting::suggestions::InferCtxtExt>::note_obligation_cause_code::<rustc_middle[a60e78b424f055fe]::ty::Predicate>
  23:     0x7f9f3cb0ca7f - <rustc_infer[98c54418d1cb0d3e]::infer::InferCtxt as rustc_trait_selection[3d01787dfec269ea]::traits::error_reporting::InferCtxtPrivExt>::note_obligation_cause
  24:     0x7f9f3cb03e58 - <rustc_infer[98c54418d1cb0d3e]::infer::InferCtxt as rustc_trait_selection[3d01787dfec269ea]::traits::error_reporting::InferCtxtExt>::report_selection_error
  25:     0x7f9f3cb103fa - <rustc_infer[98c54418d1cb0d3e]::infer::InferCtxt as rustc_trait_selection[3d01787dfec269ea]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  26:     0x7f9f3cb026e3 - <rustc_infer[98c54418d1cb0d3e]::infer::InferCtxt as rustc_trait_selection[3d01787dfec269ea]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  27:     0x7f9f3a8db782 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_argument_types
  28:     0x7f9f3a87dd12 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_call
  29:     0x7f9f3a83f3d3 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7f9f3a878cd6 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x7f9f3a83f4fc - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7f9f3a8d7994 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_argument_types
  33:     0x7f9f3a87dd12 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_call
  34:     0x7f9f3a83f3d3 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:     0x7f9f3a878b1c - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  36:     0x7f9f3a83f4fc - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  37:     0x7f9f3aa36ee6 - <rustc_typeck[73db7158453d7c81]::check::fn_ctxt::FnCtxt>::check_return_expr
  38:     0x7f9f3aa3475e - rustc_typeck[73db7158453d7c81]::check::check::check_fn
  39:     0x7f9f3aa25e9e - <rustc_typeck[73db7158453d7c81]::check::inherited::InheritedBuilder>::enter::<rustc_typeck[73db7158453d7c81]::check::typeck_with_fallback<rustc_typeck[73db7158453d7c81]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[a60e78b424f055fe]::ty::context::TypeckResults>
  40:     0x7f9f3aa23f8f - rustc_typeck[73db7158453d7c81]::check::typeck
  41:     0x7f9f3b597f8d - <rustc_query_system[2fad7ab5aded87ba]::dep_graph::graph::DepGraph<rustc_middle[a60e78b424f055fe]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a60e78b424f055fe]::ty::context::TyCtxt, rustc_span[5934fe088b167bef]::def_id::LocalDefId, &rustc_middle[a60e78b424f055fe]::ty::context::TypeckResults>
  42:     0x7f9f3b590824 - rustc_query_system[2fad7ab5aded87ba]::query::plumbing::try_execute_query::<rustc_query_impl[b8ee68d052e5990]::plumbing::QueryCtxt, rustc_query_system[2fad7ab5aded87ba]::query::caches::DefaultCache<rustc_span[5934
fe088b167bef]::def_id::LocalDefId, &rustc_middle[a60e78b424f055fe]::ty::context::TypeckResults>>
  43:     0x7f9f3bc1aff3 - <rustc_query_impl[b8ee68d052e5990]::Queries as rustc_middle[a60e78b424f055fe]::ty::query::QueryEngine>::typeck
  44:     0x7f9f3ba6ace7 - rustc_data_structures[22f783ec505e1d99]::sync::par_for_each_in::<&[rustc_span[5934fe088b167bef]::def_id::LocalDefId], <rustc_middle[a60e78b424f055fe]::hir::map::Map>::par_body_owners<rustc_typeck[73db7158453d7c81]::check::typeck_item_bodies::{closure#0}>::{closure#0}>
  45:     0x7f9f3ba6aaa3 - rustc_typeck[73db7158453d7c81]::check::typeck_item_bodies
  46:     0x7f9f3b96f255 - <rustc_query_system[2fad7ab5aded87ba]::dep_graph::graph::DepGraph<rustc_middle[a60e78b424f055fe]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a60e78b424f055fe]::ty::context::TyCtxt, (), ()>
  47:     0x7f9f3b96e23e - rustc_query_system[2fad7ab5aded87ba]::query::plumbing::try_execute_query::<rustc_query_impl[b8ee68d052e5990]::plumbing::QueryCtxt, rustc_query_system[2fad7ab5aded87ba]::query::caches::DefaultCache<(), ()>>
  48:     0x7f9f3b96dc4c - rustc_query_system[2fad7ab5aded87ba]::query::plumbing::get_query::<rustc_query_impl[b8ee68d052e5990]::queries::typeck_item_bodies, rustc_query_impl[b8ee68d052e5990]::plumbing::QueryCtxt>
  49:     0x7f9f3b03311f - <rustc_session[c1d6deef70235337]::session::Session>::time::<(), rustc_typeck[73db7158453d7c81]::check_crate::{closure#7}>
  50:     0x7f9f3b032cdf - rustc_typeck[73db7158453d7c81]::check_crate
  51:     0x7f9f3b0322a7 - rustc_interface[a2838c864f6eb7ab]::passes::analysis
  52:     0x7f9f3baba4c2 - <rustc_query_system[2fad7ab5aded87ba]::dep_graph::graph::DepGraph<rustc_middle[a60e78b424f055fe]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a60e78b424f055fe]::ty::context::TyCtxt, (), core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>
  53:     0x7f9f3bab9b8a - rustc_query_system[2fad7ab5aded87ba]::query::plumbing::try_execute_query::<rustc_query_impl[b8ee68d052e5990]::plumbing::QueryCtxt, rustc_query_system[2fad7ab5aded87ba]::query::caches::DefaultCache<(), core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>>
  54:     0x7f9f3bab9659 - rustc_query_system[2fad7ab5aded87ba]::query::plumbing::get_query::<rustc_query_impl[b8ee68d052e5990]::queries::analysis, rustc_query_impl[b8ee68d052e5990]::plumbing::QueryCtxt>
  55:     0x7f9f3aabb1b7 - <rustc_interface[a2838c864f6eb7ab]::passes::QueryContext>::enter::<rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>
  56:     0x7f9f3aaaebec - rustc_interface[a2838c864f6eb7ab]::interface::create_compiler_and_run::<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>
  57:     0x7f9f3aaad531 - <scoped_tls[f2fbc1eb2eeeae22]::ScopedKey<rustc_span[5934fe088b167bef]::SessionGlobals>>::set::<rustc_interface[a2838c864f6eb7ab]::interface::run_compiler<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>
  58:     0x7f9f3aaad21f - std[dce46a4773fb9772]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a2838c864f6eb7ab]::util::run_in_thread_pool_with_globals<rustc_interface[a2838c864f6eb7ab]::interface::run_compiler<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>
  59:     0x7f9f3bb4a610 - <<std[dce46a4773fb9772]::thread::Builder>::spawn_unchecked_<rustc_interface[a2838c864f6eb7ab]::util::run_in_thread_pool_with_globals<rustc_interface[a2838c864f6eb7ab]::interface::run_compiler<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>::{closure#1} as core[3035f67f4d4c8105]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  60:     0x7f9f39487173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2546ce459201572e
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/alloc/src/boxed.rs:1940:9
  61:     0x7f9f39487173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha02ec324858dc3c8
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/alloc/src/boxed.rs:1940:9
  62:     0x7f9f39487173 - std::sys::unix::thread::Thread::new::thread_start::h9bd74d28238bdb06
                               at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys/unix/thread.rs:108:17
  63:     0x7f9f391d36a3 - <unknown>
  64:     0x7f9f3925952c - <unknown>
  65:                0x0 - <unknown>

@yshui yshui added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Sep 9, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 9, 2022
@yshui
Copy link
Contributor Author

yshui commented Sep 9, 2022

Regression introduced in: #100654

@yshui
Copy link
Contributor Author

yshui commented Sep 9, 2022

This block around fun(&mut *inner) is crucial to trigger the ICE.

@compiler-errors compiler-errors self-assigned this Sep 9, 2022
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 14, 2022
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 14, 2022
@bors bors closed this as completed in 503e19d Sep 19, 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. P-medium Medium priority regression-untriaged Untriaged performance or correctness regression. 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