Skip to content

Commit 0d238c2

Browse files
authored
Rollup merge of rust-lang#113335 - compiler-errors:reveal-opaques-in-new-solver, r=lcnr
Reveal opaques in new solver We were testing against the wrong reveal mode 😨 Also a couple of misc commits that I don't want to really put in separate prs r? `@lcnr`
2 parents f106202 + 51d7111 commit 0d238c2

File tree

9 files changed

+74
-37
lines changed

9 files changed

+74
-37
lines changed

compiler/rustc_trait_selection/src/solve/normalize.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
166166
// We don't normalize opaque types unless we have
167167
// `Reveal::All`, even if we're in the defining scope.
168168
let data = match *ty.kind() {
169-
ty::Alias(kind, alias_ty) if kind != ty::Opaque || reveal == Reveal::UserFacing => {
170-
alias_ty
171-
}
169+
ty::Alias(kind, alias_ty) if kind != ty::Opaque || reveal == Reveal::All => alias_ty,
172170
_ => return ty.try_super_fold_with(self),
173171
};
174172

tests/ui/async-await/in-trait/async-associated-types2.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/ui/dyn-star/param-env-region-infer.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0282]: type annotations needed
2-
--> $DIR/param-env-region-infer.rs:16:10
2+
--> $DIR/param-env-region-infer.rs:17:10
33
|
44
LL | t as _
55
| ^ cannot infer type
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}`
2+
--> $DIR/param-env-region-infer.rs:14:60
3+
|
4+
LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: ...which requires type-checking `make_dyn_star`...
8+
--> $DIR/param-env-region-infer.rs:14:1
9+
|
10+
LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: ...which requires computing layout of `make_dyn_star::{opaque#0}`...
13+
= note: ...which requires normalizing `make_dyn_star::{opaque#0}`...
14+
= note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle
15+
note: cycle used when checking item types in top-level module
16+
--> $DIR/param-env-region-infer.rs:8:1
17+
|
18+
LL | / #![feature(dyn_star, pointer_like_trait)]
19+
LL | | #![allow(incomplete_features)]
20+
LL | |
21+
LL | | use std::fmt::Debug;
22+
... |
23+
LL | |
24+
LL | | fn main() {}
25+
| |____________^
26+
27+
error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}`
28+
--> $DIR/param-env-region-infer.rs:14:60
29+
|
30+
LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
31+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
|
33+
note: ...which requires type-checking `make_dyn_star`...
34+
--> $DIR/param-env-region-infer.rs:14:1
35+
|
36+
LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
= note: ...which requires computing layout of `make_dyn_star::{opaque#0}`...
39+
= note: ...which requires normalizing `make_dyn_star::{opaque#0}`...
40+
= note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle
41+
note: cycle used when checking item types in top-level module
42+
--> $DIR/param-env-region-infer.rs:8:1
43+
|
44+
LL | / #![feature(dyn_star, pointer_like_trait)]
45+
LL | | #![allow(incomplete_features)]
46+
LL | |
47+
LL | | use std::fmt::Debug;
48+
... |
49+
LL | |
50+
LL | | fn main() {}
51+
| |____________^
52+
53+
error: aborting due to 2 previous errors
54+
55+
For more information about this error, try `rustc --explain E0391`.

tests/ui/dyn-star/param-env-region-infer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// revisions: current next
22
//[next] compile-flags: -Ztrait-solver=next
3-
//[next] check-pass
43
// incremental
54

65
// checks that we don't ICE if there are region inference variables in the environment
@@ -13,6 +12,8 @@ use std::fmt::Debug;
1312
use std::marker::PointerLike;
1413

1514
fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
15+
//[next]~^ ERROR cycle detected when computing
16+
//[next]~| ERROR cycle detected when computing
1617
t as _
1718
//[current]~^ ERROR type annotations needed
1819
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// build-pass
2+
// revisions: current next
3+
//[next] compile-flags: -Ztrait-solver=next
4+
5+
fn test() -> Option<impl Sized> {
6+
Some("")
7+
}
8+
9+
fn main() {
10+
test();
11+
}

tests/ui/issues/issue-67552.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// build-fail
22
// compile-flags: -Copt-level=0
33
// normalize-stderr-test: ".nll/" -> "/"
4+
// ignore-compare-mode-next-solver (hangs)
45

56
fn main() {
67
rec(Empty);

tests/ui/issues/issue-67552.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>`
2-
--> $DIR/issue-67552.rs:29:9
2+
--> $DIR/issue-67552.rs:30:9
33
|
44
LL | rec(identity(&mut it))
55
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: `rec` defined here
8-
--> $DIR/issue-67552.rs:22:1
8+
--> $DIR/issue-67552.rs:23:1
99
|
1010
LL | / fn rec<T>(mut it: T)
1111
LL | | where

tests/ui/recursion/issue-95134.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// compile-flags: -Copt-level=0
44
// dont-check-failure-status
55
// dont-check-compiler-stderr
6+
// ignore-compare-mode-next-solver (hangs)
67

78
pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
89
if n > 15 {

0 commit comments

Comments
 (0)