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: Normalizing ImplHeader, compiler/rustc_trait_selection/src/traits/project.rs #87558

Closed
chengniansun opened this issue Jul 28, 2021 · 4 comments · Fixed by #98540
Closed
Assignees
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

Code

struct ErrorKind;
struct Error(ErrorKind);
impl Fn(&isize) for Error {
    fn from() {}
}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (2faabf579 2021-07-27)
binary: rustc
commit-hash: 2faabf579323f5252329264cc53ba9ff803429a3
commit-date: 2021-07-27
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

Error output

error[E0407]: method `from` is not a member of trait `Fn`
 --> mutant.rs:4:5
  |
4 |     fn from() {}
  |     ^^^^^^^^^^^^ not a member of trait `Fn`

error[E0601]: `main` function not found in crate `mutant`
 --> mutant.rs:1:1
  |
1 | / struct ErrorKind;
2 | | struct Error(ErrorKind);
3 | | impl Fn(&isize) for Error {
4 | |     fn from() {}
5 | | }
  | |_^ consider adding a `main` function to `mutant.rs`

error[E0229]: associated type bindings are not allowed here
 --> mutant.rs:3:6
  |
3 | impl Fn(&isize) for Error {
  |      ^^^^^^^^^^ associated type not allowed here

thread 'rustc' panicked at 'Normalizing ImplHeader { impl_def_id: DefId(0:8 ~ mutant[57b0]::{impl#0}), self_ty: Error, trait_ref: Some(<Error as std::ops::Fn<(&isize,)>>), predicates: [] } without wrapping in a `Binder`', compiler/rustc_trait_selection/src/traits/project.rs:332: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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `std::ops::Fn`
#1 [coherent_trait] coherence checking all impls of trait `std::ops::Fn`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0229, E0407, E0601.
For more information about an error, try `rustc --explain E0229`.
Backtrace

error[E0407]: method `from` is not a member of trait `Fn`
 --> mutant.rs:4:5
  |
4 |     fn from() {}
  |     ^^^^^^^^^^^^ not a member of trait `Fn`

error[E0601]: `main` function not found in crate `mutant`
 --> mutant.rs:1:1
  |
1 | / struct ErrorKind;
2 | | struct Error(ErrorKind);
3 | | impl Fn(&isize) for Error {
4 | |     fn from() {}
5 | | }
  | |_^ consider adding a `main` function to `mutant.rs`

error[E0229]: associated type bindings are not allowed here
 --> mutant.rs:3:6
  |
3 | impl Fn(&isize) for Error {
  |      ^^^^^^^^^^ associated type not allowed here

thread 'rustc' panicked at 'Normalizing ImplHeader { impl_def_id: DefId(0:8 ~ mutant[57b0]::{impl#0}), self_ty: Error, trait_ref: Some(<Error as std::ops::Fn<(&isize,)>>), predicates: [] } without wrapping in a `Binder`', compiler/rustc_trait_selection/src/traits/project.rs:332:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:515:5
   1: std::panicking::begin_panic_fmt
             at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:457:5
   2: rustc_trait_selection::traits::project::AssocTypeNormalizer::fold
   3: rustc_trait_selection::traits::project::normalize
   4: rustc_trait_selection::traits::coherence::with_fresh_ty_vars
   5: rustc_trait_selection::traits::coherence::overlap_within_probe
   6: rustc_infer::infer::InferCtxtBuilder::enter
   7: rustc_trait_selection::traits::coherence::overlapping_impls
   8: <rustc_middle::traits::specialization_graph::Children as rustc_trait_selection::traits::specialize::specialization_graph::ChildrenExt>::insert
   9: <rustc_middle::traits::specialization_graph::Graph as rustc_trait_selection::traits::specialize::specialization_graph::GraphExt>::insert
  10: rustc_trait_selection::traits::specialize::specialization_graph_provider
  11: rustc_query_system::query::plumbing::get_query_impl
  12: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::specialization_graph_of
  13: rustc_typeck::coherence::coherent_trait
  14: rustc_query_system::query::plumbing::get_query_impl
  15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::coherent_trait
  16: rustc_session::session::Session::track_errors
  17: rustc_typeck::check_crate
  18: rustc_interface::passes::analysis
  19: rustc_query_system::query::plumbing::get_query_impl
  20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  21: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  22: rustc_span::with_source_map
  23: rustc_interface::interface::create_compiler_and_run
  24: 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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `std::ops::Fn`
#1 [coherent_trait] coherence checking all impls of trait `std::ops::Fn`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0229, E0407, E0601.
For more information about an error, try `rustc --explain E0229`.

@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 Jul 28, 2021
@jonas-schievink jonas-schievink added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 28, 2021
@jackh726
Copy link
Member

So, #85499 will fix this ICE. But the coherence code should probably not be passing escaping bound vars to begin with.

As for prioritization, this is an ICE that occurs only after an error that, if fixed, will solve the ICE. I say low or medium.

@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-low

@rustbot rustbot added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 29, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Aug 12, 2021
@jackh726
Copy link
Member

#85499 didn't fix this ICE; it's actually different than others and utterly broken (as expected)

@Alexendoo
Copy link
Member

No longer ICEs since #92441

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jan 16, 2022
@TaKO8Ki TaKO8Ki self-assigned this Jun 26, 2022
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Jun 26, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 26, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 26, 2022
…askrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#97140 (std: use an event-flag-based thread parker on SOLID)
 - rust-lang#97295 ([rustc_parse] Forbid `let`s in certain places)
 - rust-lang#97743 (make const_err show up in future breakage reports)
 - rust-lang#97908 (Stabilize NonZero* checked operations constness.)
 - rust-lang#98297 (Transform help popup into a pocket menu)
 - rust-lang#98428 (macros: use typed identifiers in diag and subdiag derive)
 - rust-lang#98528 (Respect --color when building rustbuild itself)
 - rust-lang#98535 (Add regression test for generic const in rustdoc)
 - rust-lang#98538 (Add a ui test for issue rust-lang#91883)
 - rust-lang#98540 (Add regression test for rust-lang#87558)
 - rust-lang#98541 (Update `std::alloc::System` doc example code style)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
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-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority 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.

8 participants