Skip to content

Commit 7303769

Browse files
committed
Do not assert that a change in global cache only happens when concurrent
1 parent 6f34f4e commit 7303769

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

compiler/rustc_type_ir/src/search_graph/global_cache.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ impl<X: Cx> GlobalCache<X> {
6262
} else {
6363
let prev = entry.success.replace(Success { required_depth, nested_goals, result });
6464
if let Some(prev) = &prev {
65-
assert!(cx.evaluation_is_concurrent());
6665
assert_eq!(cx.get_tracked(&prev.result), evaluation_result.result);
6766
}
6867
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/fn-delegation-opaque-cycle.rs:23:5: 23:24>::opaque_ret::{anon_assoc#0}`
2+
--> $DIR/fn-delegation-opaque-cycle.rs:24:25
3+
|
4+
LL | reuse to_reuse::opaque_ret;
5+
| ^^^^^^^^^^
6+
|
7+
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
8+
--> $DIR/fn-delegation-opaque-cycle.rs:24:25
9+
|
10+
LL | reuse to_reuse::opaque_ret;
11+
| ^^^^^^^^^^
12+
= note: ...which again requires computing type of `opaque::<impl at $DIR/fn-delegation-opaque-cycle.rs:23:5: 23:24>::opaque_ret::{anon_assoc#0}`, completing the cycle
13+
note: cycle used when checking assoc item `opaque::<impl at $DIR/fn-delegation-opaque-cycle.rs:23:5: 23:24>::opaque_ret` is compatible with trait definition
14+
--> $DIR/fn-delegation-opaque-cycle.rs:24:25
15+
|
16+
LL | reuse to_reuse::opaque_ret;
17+
| ^^^^^^^^^^
18+
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
19+
20+
error: aborting due to 1 previous error
21+
22+
For more information about this error, try `rustc --explain E0391`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/fn-delegation-opaque-cycle.rs:23:5: 23:24>::opaque_ret::{anon_assoc#0}`
2+
--> $DIR/fn-delegation-opaque-cycle.rs:24:25
3+
|
4+
LL | reuse to_reuse::opaque_ret;
5+
| ^^^^^^^^^^
6+
|
7+
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
8+
--> $DIR/fn-delegation-opaque-cycle.rs:24:25
9+
|
10+
LL | reuse to_reuse::opaque_ret;
11+
| ^^^^^^^^^^
12+
= note: ...which again requires computing type of `opaque::<impl at $DIR/fn-delegation-opaque-cycle.rs:23:5: 23:24>::opaque_ret::{anon_assoc#0}`, completing the cycle
13+
= note: cycle used when computing implied outlives bounds for `<u8 as opaque::ToReuse>::opaque_ret::{anon_assoc#0}` (hack disabled = false)
14+
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
15+
16+
error: aborting due to 1 previous error
17+
18+
For more information about this error, try `rustc --explain E0391`.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//@ revisions: current next
2+
//@ ignore-compare-mode-next-solver (explicit revisions)
3+
//@[next] compile-flags: -Znext-solver
4+
//@ check-fail
5+
6+
// Regression test for trait-system-refactor-initiative#234. If we end up in a
7+
// query cycle, it should be okay as long as results are the same.
8+
9+
#![feature(fn_delegation)]
10+
#![allow(incomplete_features)]
11+
12+
mod opaque {
13+
trait Trait {}
14+
impl Trait for () {}
15+
16+
mod to_reuse {
17+
use super::Trait;
18+
pub fn opaque_ret() -> impl Trait { () }
19+
}
20+
21+
trait ToReuse {
22+
fn opaque_ret() -> impl Trait { () }
23+
}
24+
25+
impl ToReuse for u8 {
26+
reuse to_reuse::opaque_ret; //~ ERROR cycle detected when computing type
27+
}
28+
}
29+
30+
fn main() {}

0 commit comments

Comments
 (0)