Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion compiler/rustc_query_impl/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,16 @@ fn wait_for_query<'tcx, C: QueryCache>(

(v, Some(index))
}
Err(cycle) => (mk_cycle(query, tcx, cycle.lift()), None),
Err(mut cycle) => {
if let Some(def_id) = key.key_as_def_id() {
if let Some(pos) = cycle.cycle.iter().position(|entry| {
entry.frame.dep_kind == query.dep_kind && entry.frame.def_id == Some(def_id)
}) {
cycle.cycle.rotate_left(pos);
}
}
(mk_cycle(query, tcx, cycle.lift()), None)
}
}
}

Expand Down
17 changes: 17 additions & 0 deletions tests/ui/parallel-rustc/fn-sig-cycle-ice-153391.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Regression test for #153391.
//
//@ edition:2024
//@ compile-flags: -Z threads=16
//@ compare-output-by-lines

trait A {
fn g() -> B;
//~^ ERROR expected a type, found a trait
}

trait B {
fn bar(&self, x: &A);
//~^ ERROR expected a type, found a trait
}

fn main() {}
30 changes: 30 additions & 0 deletions tests/ui/parallel-rustc/fn-sig-cycle-ice-153391.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error[E0782]: expected a type, found a trait
|
LL | fn bar(&self, x: &A);
| ^
|
= note: `A` is dyn-incompatible, otherwise a trait object could be used
help: use a new generic type parameter, constrained by `A`
|
LL - fn bar(&self, x: &A);
LL + fn bar<T: A>(&self, x: &T);
|
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
LL | fn bar(&self, x: &impl A);
| ++++

error[E0782]: expected a type, found a trait
--> $DIR/fn-sig-cycle-ice-153391.rs:8:15
|
LL | fn g() -> B;
| ^
|
|
LL | fn g() -> impl B;
| ++++
|

error: aborting due to 2 previous errors

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