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: Failed to extract DefId: local_def_id_to_hir_id #99233

Closed
afonso360 opened this issue Jul 14, 2022 · 5 comments · Fixed by #99290
Closed

ICE: Failed to extract DefId: local_def_id_to_hir_id #99233

afonso360 opened this issue Jul 14, 2022 · 5 comments · Fixed by #99290
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation

Comments

@afonso360
Copy link
Contributor

afonso360 commented Jul 14, 2022

Hey, I hit this ICE while working on cranelift and I don't really know how to minimize it. Its a huge project.

This seems to be related (possibly a dup) of #97143.

Code

Since it may be incremental compilation (see #97143) related I have two branches, one before the ICE and one that triggers the ICE.

Here's the example code before the crash

https://github.com/afonso360/wasmtime/tree/rustc-ice-repro-before

and after

https://github.com/afonso360/wasmtime/tree/rustc-ice-repro-after

To reproduce do the following:

  • Clone rustc-ice-repro-before
  • git submodule update --init
  • cd cranelift
  • cargo build (this fails to compile, but that's okay)
  • git checkout rustc-ice-repro-after
  • cargo build

This seems to trigger the ICE even after cargo clean. Doing a cargo clean and then compiling rustc-ice-repro-after fixes the issue. However going from rustc-ice-repro-before to rustc-ice-repro-after reliably triggers the ICE for me.

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (6dba4ed21 2022-07-09)
binary: rustc
commit-hash: 6dba4ed215e7a60f0a2a19c04f3f73691f89c509
commit-date: 2022-07-09
host: x86_64-pc-windows-msvc
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo build
   Compiling cranelift-codegen v0.87.0 (C:\Users\Afonso\CLionProjects\wasmtime\cranelift\codegen)
thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id 1aa453c779adf6fd-53c00101e38ec6ab', compiler\rustc_middle\src\dep_graph\dep_node.rs:276:17
stack backtrace:
   0:     0x7ffddb9195af - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hef23f45976deca92
   1:     0x7ffddb953dca - core::fmt::write::hd395a3407025fcd0
   2:     0x7ffddb90c4fa - <std::io::IoSlice as core::fmt::Debug>::fmt::h34f34bee4af4de43
   3:     0x7ffddb91cf0b - std::panicking::default_hook::h760161844aaa65ca
   4:     0x7ffddb91cb37 - std::panicking::default_hook::h760161844aaa65ca
   5:     0x7ffdba9b5b96 - <rustc_session[e0d8b14a64b556fe]::options::WasiExecModel as rustc_session[e0d8b14a64b556fe]::config::dep_tracking::DepTrackingHash>::hash
   6:     0x7ffddb91d8ec - std::panicking::rust_panic_with_hook::h6c74749b84247d66
   7:     0x7ffddb91d66d - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h1c8e82c7514048d5
   8:     0x7ffddb91a297 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hef23f45976deca92
   9:     0x7ffddb91d340 - rust_begin_unwind
  10:     0x7ffddb989d75 - core::panicking::panic_fmt::hb22ecb829d7a5b44
  11:     0x7ffdbeeb450f - <rustc_query_system[c54040d80f7bd67d]::dep_graph::dep_node::DepNode<rustc_middle[e2a3c9cfc670f53f]::dep_graph::dep_node::DepKind> as rustc_middle[e2a3c9cfc670f53f]::dep_grap
h::dep_node::DepNodeExt>::extract_def_id
  12:     0x7ffdbef369a5 - <rustc_middle[e2a3c9cfc670f53f]::ty::context::TyCtxt>::def_path_hash_to_def_id
  13:     0x7ffdbeeb4474 - <rustc_query_system[c54040d80f7bd67d]::dep_graph::dep_node::DepNode<rustc_middle[e2a3c9cfc670f53f]::dep_graph::dep_node::DepKind> as rustc_middle[e2a3c9cfc670f53f]::dep_grap
h::dep_node::DepNodeExt>::extract_def_id
  14:     0x7ffdbe018d23 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  15:     0x7ffdbef1c563 - <rustc_middle[e2a3c9cfc670f53f]::ty::context::TyCtxt as rustc_query_system[c54040d80f7bd67d]::dep_graph::DepContext>::try_force_from_dep_node
  16:     0x7ffdbe28910e - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  17:     0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  18:     0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  19:     0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  20:     0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  21:     0x7ffdbe2890e7 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  22:     0x7ffdbe261580 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  23:     0x7ffdbe098f36 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  24:     0x7ffdbe256e43 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  25:     0x7ffdbd2b5774 - <rustc_builtin_macros[bf80a4e64d368975]::format_foreign::shell::Substitution as core[6cb971d316fff487]::fmt::Debug>::fmt
  26:     0x7ffdbd48cd73 - <rustc_typeck[f2237eae730687b5]::check::MaybeInProgressTables>::borrow_mut
  27:     0x7ffdbdfdb56e - <&[rustc_span[aee144ca6db227e2]::def_id::LocalDefId] as rustc_serialize[d6267468a4d4c477]::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecod
er>>::decode
  28:     0x7ffdbe2cc38f - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  29:     0x7ffdbe17fffd - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  30:     0x7ffdbe204d39 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  31:     0x7ffdbd492025 - <rustc_typeck[f2237eae730687b5]::constrained_generic_params::Parameter as core[6cb971d316fff487]::fmt::Debug>::fmt
  32:     0x7ffdbd2fb8a5 - rustc_typeck[f2237eae730687b5]::check_crate
  33:     0x7ffdbaaa368f - rustc_interface[76bb9c439a2899ad]::passes::analysis
  34:     0x7ffdbdfdb2de - <&[rustc_span[aee144ca6db227e2]::def_id::LocalDefId] as rustc_serialize[d6267468a4d4c477]::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecod
er>>::decode
  35:     0x7ffdbe2c2baf - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  36:     0x7ffdbe16d901 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  37:     0x7ffdbe2572c6 - <&rustc_index[923e3d3458dc1426]::vec::IndexVec<rustc_middle[e2a3c9cfc670f53f]::mir::Promoted, rustc_middle[e2a3c9cfc670f53f]::mir::Body> as rustc_serialize[d6267468a4d4c477]
::serialize::Decodable<rustc_query_impl[fd9b44e57b15857a]::on_disk_cache::CacheDecoder>>::decode
  38:     0x7ffdba95f476 - <rustc_middle[e2a3c9cfc670f53f]::ty::SymbolName as core[6cb971d316fff487]::fmt::Debug>::fmt
  39:     0x7ffdba9443dd - <chalk_engine[4f5fa8a5a4054be1]::TableIndex>::increment
  40:     0x7ffdba9adf37 - <rustc_session[e0d8b14a64b556fe]::options::WasiExecModel as rustc_session[e0d8b14a64b556fe]::config::dep_tracking::DepTrackingHash>::hash
  41:     0x7ffdba946b66 - <chalk_engine[4f5fa8a5a4054be1]::TableIndex>::increment
  42:     0x7ffdba94c3c8 - <rustc_middle[e2a3c9cfc670f53f]::ty::SymbolName as core[6cb971d316fff487]::fmt::Debug>::fmt
  43:     0x7ffddb92dbac - std::sys::windows::thread::Thread::new::h37d5bf4d23586b2f
  44:     0x7ffe55c57034 - BaseThreadInitThunk
  45:     0x7ffe56d82651 - RtlUserThreadStart

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.64.0-nightly (6dba4ed21 2022-07-09) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck_item_bodies] type-checking all item bodies
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `cranelift-codegen`
PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> 
Backtrace

<backtrace>

@afonso360 afonso360 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 14, 2022
@lqd
Copy link
Member

lqd commented Jul 15, 2022

Note:

  • this occurs during typechecking, so a cargo check will be enough to reproduce (this is most interesting for people needing to reproduce/debug the issue).
  • this looks recent, it doesn't reproduce on my 10 days old nightly but does on a more recent one, so I'll bisect and report back.

@lqd
Copy link
Member

lqd commented Jul 15, 2022

This seems to have appeared in nightly-2022-07-09, via #99054 which is unfortunately a rollup.

The last 2 feel more likely to me because the repro involves a failing build.

This is of course an incremental compilation ICE, so cc @rust-lang/wg-incr-comp.

@lqd lqd added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. A-incr-comp Area: Incremental compilation WG-incr-comp Working group: Incremental compilation labels Jul 15, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 15, 2022
@lqd
Copy link
Member

lqd commented Jul 15, 2022

I've checked locally that:

To check if the unexpected combination of the commits in this rollup causes this issue, I've also built the #98794 branch itself, so the result is independent of the previous 3 PRs (but depends on other PRs in the nightly): it does ICE as well.

All this makes me think that #98794 is the likely source of the regression in this rollup, cc PR author @compiler-errors and PR reviewer @michaelwoerister.

I don't know what is the priority/severity of this issue, and we don't have an MCVE to add as test yet (I'll try to see how hard that is, wasmtime and cranelift are huge), but I could post a revert if @rust-lang/wg-incr-comp wants one.

@compiler-errors
Copy link
Member

That makes sense. It was probably foolish to store a span in the first place anyways in a cacheable key like SelectionError.

I'll look into fixing it, or else revert.

@rustbot claim

@compiler-errors
Copy link
Member

compiler-errors commented Jul 15, 2022

Okay, so this is a deeper issue than just my PR. I reverted my PR and added the line

self.infcx.tcx.ensure().predicates_of(stack.obligation.cause.body_id.owner);

in the same place that I was touching in candidate_from_obligation_no_cache. This causes the same ICE.

So my PR is only the "cause" insofar as it adds a new call to the predicates_of query, which actually causes this ICE. I'm not exactly sure what to do in this case. I will probably put up a revert PR for now, but I'm not well-equipped to debug an incremental compilation bug like this.

@bors bors closed this as completed in 69e4f21 Jul 16, 2022
@inquisitivecrystal inquisitivecrystal removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 19, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Dec 13, 2022
…env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by `@lcnr)` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Dec 13, 2022
…env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by ``@lcnr)`` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 14, 2022
…env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by `@lcnr)` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 14, 2022
…env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by ``@lcnr)`` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 15, 2022
…env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by ```@lcnr)``` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 15, 2022
…env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by ````@lcnr)```` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 15, 2022
…v-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts rust-lang#98794 (i.e. reverts rust-lang#99290).

The previous time I attempted to land this PR, it was because of an incremental issue (rust-lang#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by `@lcnr)` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes rust-lang#105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes rust-lang#105131.
Fixes (again) rust-lang#98786
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants