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: 'assertion failed: (left == right), compiler/rustc_typeck/src/check/method/mod.rs:357:9 #84918

Closed
chengniansun opened this issue May 4, 2021 · 2 comments
Labels
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.

Comments

@chengniansun
Copy link

Code

#[lang = "shl_assign"]
trait ShlAssign {
    fn shl_assign(impl Clone);
}
macro_rules! shl_assign_impl {
    ( $ t : ty , $ f : ty ) => {
        impl t {
            fn shl_assign() {
                self <<= other
            }
        }
    };
}
macro_rules ! shl_assign_impl_all {
( $ ( $ t : ty ) * ) => ( $ (
shl_assign_impl !
                  { $ t , u16 }
)   )
}
shl_assign_impl_all! { u8                                                  }

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (716394d65 2021-05-03)
binary: rustc
commit-hash: 716394d6581b60c75cfdd88b8e5b876f2db88b62
commit-date: 2021-05-03
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.0

Error output

error: expected one of: `*`, `+`, or `?`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:15:29
   |
15 |   ( $ ( $ t : ty ) * ) => ( $ (
   |  _____________________________^
16 | | shl_assign_impl !
17 | |                   { $ t , u16 }
18 | | )   )
   | |_^

error[E0412]: cannot find type `t` in this scope
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:7:14
   |
7  |         impl t {
   |              ^ not found in this scope
...
20 | shl_assign_impl_all! { u8                                                  }
   | ---------------------------------------------------------------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0424]: expected value, found module `self`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:9:17
   |
8  |             fn shl_assign() {
   |                ---------- this function doesn't have a `self` parameter
9  |                 self <<= other
   |                 ^^^^ `self` value is a keyword only available in methods with a `self` parameter
...
20 | shl_assign_impl_all! { u8                                                  }
   | ---------------------------------------------------------------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: add a `self` receiver parameter to make the associated `fn` a method
   |
8  |             fn shl_assign(&self) {
   |                           ^^^^^

error[E0425]: cannot find value `other` in this scope
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:9:26
   |
9  |                 self <<= other
   |                          ^^^^^ not found in this scope
...
20 | shl_assign_impl_all! { u8                                                  }
   | ---------------------------------------------------------------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: language items are subject to change
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[lang = "shl_assign"]
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

warning: anonymous parameters are deprecated and will be removed in the next edition.
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:19
  |
3 |     fn shl_assign(impl Clone);
  |                   ^^^^^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: impl Clone`
  |
  = note: `#[warn(anonymous_parameters)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
  = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
   |
1  | / #[lang = "shl_assign"]
2  | | trait ShlAssign {
3  | |     fn shl_assign(impl Clone);
4  | | }
...  |
19 | | }
20 | | shl_assign_impl_all! { u8                                                  }
   | |____________________________________________________________________________^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0152]: found duplicate lang item `shl_assign`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:1
  |
2 | / trait ShlAssign {
3 | |     fn shl_assign(impl Clone);
4 | | }
  | |_^
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /home/cnsun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c8ded1707ad10767.rlib
  = note: second definition in the local crate (`perses_node_priority_with_dfs_delta_reduced_mutant`)

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`', compiler/rustc_typeck/src/check/method/mod.rs:357:9
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.54.0-nightly (716394d65 2021-05-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at perses_node_priority_with_dfs_delta_reduced_mutant.rs:7:9: 11:10>::shl_assign`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted

Some errors have detailed explanations: E0152, E0412, E0424, E0425, E0601, E0658.
For more information about an error, try `rustc --explain E0152`.
Backtrace

error: expected one of: `*`, `+`, or `?`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:15:29
   |
15 |   ( $ ( $ t : ty ) * ) => ( $ (
   |  _____________________________^
16 | | shl_assign_impl !
17 | |                   { $ t , u16 }
18 | | )   )
   | |_^

error[E0412]: cannot find type `t` in this scope
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:7:14
   |
7  |         impl t {
   |              ^ not found in this scope
...
20 | shl_assign_impl_all! { u8                                                  }
   | ---------------------------------------------------------------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0424]: expected value, found module `self`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:9:17
   |
8  |             fn shl_assign() {
   |                ---------- this function doesn't have a `self` parameter
9  |                 self <<= other
   |                 ^^^^ `self` value is a keyword only available in methods with a `self` parameter
...
20 | shl_assign_impl_all! { u8                                                  }
   | ---------------------------------------------------------------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: add a `self` receiver parameter to make the associated `fn` a method
   |
8  |             fn shl_assign(&self) {
   |                           ^^^^^

error[E0425]: cannot find value `other` in this scope
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:9:26
   |
9  |                 self <<= other
   |                          ^^^^^ not found in this scope
...
20 | shl_assign_impl_all! { u8                                                  }
   | ---------------------------------------------------------------------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: language items are subject to change
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[lang = "shl_assign"]
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

warning: anonymous parameters are deprecated and will be removed in the next edition.
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:19
  |
3 |     fn shl_assign(impl Clone);
  |                   ^^^^^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: impl Clone`
  |
  = note: `#[warn(anonymous_parameters)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
  = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
   |
1  | / #[lang = "shl_assign"]
2  | | trait ShlAssign {
3  | |     fn shl_assign(impl Clone);
4  | | }
...  |
19 | | }
20 | | shl_assign_impl_all! { u8                                                  }
   | |____________________________________________________________________________^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0152]: found duplicate lang item `shl_assign`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:1
  |
2 | / trait ShlAssign {
3 | |     fn shl_assign(impl Clone);
4 | | }
  | |_^
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /home/cnsun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c8ded1707ad10767.rlib
  = note: second definition in the local crate (`perses_node_priority_with_dfs_delta_reduced_mutant`)

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`', compiler/rustc_typeck/src/check/method/mod.rs:357:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/716394d6581b60c75cfdd88b8e5b876f2db88b62/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/716394d6581b60c75cfdd88b8e5b876f2db88b62/library/core/src/panicking.rs:92:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
   4: rustc_typeck::check::method::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method_in_trait
   5: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_op_method
   6: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_overloaded_binop
   7: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_binop_assign
   8: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
   9: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  10: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  11: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  12: rustc_typeck::check::check::check_fn
  13: rustc_typeck::check::inherited::InheritedBuilder::enter
  14: rustc_typeck::check::typeck
  15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  16: rustc_data_structures::stack::ensure_sufficient_stack
  17: rustc_query_system::query::plumbing::force_query_with_job
  18: rustc_query_system::query::plumbing::get_query_impl
  19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  20: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  21: rustc_typeck::check::typeck_item_bodies
  22: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  23: rustc_data_structures::stack::ensure_sufficient_stack
  24: rustc_query_system::query::plumbing::force_query_with_job
  25: rustc_query_system::query::plumbing::get_query_impl
  26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  27: rustc_session::utils::<impl rustc_session::session::Session>::time
  28: rustc_typeck::check_crate
  29: rustc_interface::passes::analysis
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::force_query_with_job
  33: rustc_query_system::query::plumbing::get_query_impl
  34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  35: rustc_interface::passes::QueryContext::enter
  36: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  37: rustc_span::with_source_map
  38: rustc_interface::interface::create_compiler_and_run
  39: scoped_tls::ScopedKey<T>::set
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.54.0-nightly (716394d65 2021-05-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at perses_node_priority_with_dfs_delta_reduced_mutant.rs:7:9: 11:10>::shl_assign`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted

Some errors have detailed explanations: E0152, E0412, E0424, E0425, E0601, E0658.
For more information about an error, try `rustc --explain E0152`.

@chengniansun chengniansun 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 May 4, 2021
@fanninpm
Copy link

fanninpm commented Jun 4, 2021

Does this still reproduce on the latest nightly? Here is a playground link, for reference.

@JohnTitor
Copy link
Member

Triage: Fixed by #85339. That PR should have a regression test for this case, closing.

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) ❄️ 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

3 participants