about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-08 15:49:46 +0200
committerGitHub <noreply@github.com>2023-07-08 15:49:46 +0200
commitf3f1b0394d5aae12855dad5a5c35ceaefb8d40fc (patch)
tree6afde1755451b19b26283eb9c954a3fad374fbbc
parente0b290f1a8dfd2cf6dbad94c0425f04f387842d1 (diff)
parentf55b046931cfa1b281375ff8ec4e590d8386f0c4 (diff)
downloadrust-f3f1b0394d5aae12855dad5a5c35ceaefb8d40fc.tar.gz
rust-f3f1b0394d5aae12855dad5a5c35ceaefb8d40fc.zip
Rollup merge of #113335 - compiler-errors:reveal-opaques-in-new-solver, r=lcnr
Reveal opaques in new solver

We were testing against the wrong reveal mode :fearful:

Also a couple of misc commits that I don't want to really put in separate prs

r? ``@lcnr``
-rw-r--r--compiler/rustc_trait_selection/src/solve/normalize.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types2.rs30
-rw-r--r--tests/ui/dyn-star/param-env-region-infer.current.stderr2
-rw-r--r--tests/ui/dyn-star/param-env-region-infer.next.stderr29
-rw-r--r--tests/ui/dyn-star/param-env-region-infer.rs6
-rw-r--r--tests/ui/impl-trait/reveal-during-codegen.rs11
-rw-r--r--tests/ui/issues/issue-67552.rs1
-rw-r--r--tests/ui/issues/issue-67552.stderr4
-rw-r--r--tests/ui/recursion/issue-95134.rs1
9 files changed, 50 insertions, 38 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/normalize.rs b/compiler/rustc_trait_selection/src/solve/normalize.rs
index c0ee1a576e5..c388850d831 100644
--- a/compiler/rustc_trait_selection/src/solve/normalize.rs
+++ b/compiler/rustc_trait_selection/src/solve/normalize.rs
@@ -167,9 +167,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
         // We don't normalize opaque types unless we have
         // `Reveal::All`, even if we're in the defining scope.
         let data = match *ty.kind() {
-            ty::Alias(kind, alias_ty) if kind != ty::Opaque || reveal == Reveal::UserFacing => {
-                alias_ty
-            }
+            ty::Alias(kind, alias_ty) if kind != ty::Opaque || reveal == Reveal::All => alias_ty,
             _ => return ty.try_super_fold_with(self),
         };
 
diff --git a/tests/ui/async-await/in-trait/async-associated-types2.rs b/tests/ui/async-await/in-trait/async-associated-types2.rs
deleted file mode 100644
index b889f616a03..00000000000
--- a/tests/ui/async-await/in-trait/async-associated-types2.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// check-pass
-// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
-#![feature(async_fn_in_trait)]
-#![feature(impl_trait_in_assoc_type)]
-#![allow(incomplete_features)]
-
-use std::future::Future;
-
-trait MyTrait {
-    type Fut<'a>: Future<Output = i32>
-    where
-        Self: 'a;
-
-    fn foo<'a>(&'a self) -> Self::Fut<'a>;
-}
-
-impl MyTrait for i32 {
-    type Fut<'a> = impl Future<Output = i32> + 'a
-    where
-        Self: 'a;
-
-    fn foo<'a>(&'a self) -> Self::Fut<'a> {
-        async { *self }
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/dyn-star/param-env-region-infer.current.stderr b/tests/ui/dyn-star/param-env-region-infer.current.stderr
index c606a50c8a9..902053ecfef 100644
--- a/tests/ui/dyn-star/param-env-region-infer.current.stderr
+++ b/tests/ui/dyn-star/param-env-region-infer.current.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/param-env-region-infer.rs:16:10
+  --> $DIR/param-env-region-infer.rs:18:10
    |
 LL |     t as _
    |          ^ cannot infer type
diff --git a/tests/ui/dyn-star/param-env-region-infer.next.stderr b/tests/ui/dyn-star/param-env-region-infer.next.stderr
new file mode 100644
index 00000000000..dd724a65908
--- /dev/null
+++ b/tests/ui/dyn-star/param-env-region-infer.next.stderr
@@ -0,0 +1,29 @@
+error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}`
+  --> $DIR/param-env-region-infer.rs:16:60
+   |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+   |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: ...which requires type-checking `make_dyn_star`...
+  --> $DIR/param-env-region-infer.rs:16:1
+   |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: ...which requires computing layout of `make_dyn_star::{opaque#0}`...
+   = note: ...which requires normalizing `make_dyn_star::{opaque#0}`...
+   = note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle
+note: cycle used when checking item types in top-level module
+  --> $DIR/param-env-region-infer.rs:10:1
+   |
+LL | / #![feature(dyn_star, pointer_like_trait)]
+LL | | #![allow(incomplete_features)]
+LL | |
+LL | | use std::fmt::Debug;
+...  |
+LL | |
+LL | | fn main() {}
+   | |____________^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/dyn-star/param-env-region-infer.rs b/tests/ui/dyn-star/param-env-region-infer.rs
index 9c337e4a89b..537473abc3a 100644
--- a/tests/ui/dyn-star/param-env-region-infer.rs
+++ b/tests/ui/dyn-star/param-env-region-infer.rs
@@ -1,6 +1,7 @@
 // revisions: current next
-//[next] compile-flags: -Ztrait-solver=next
-//[next] check-pass
+// Need `-Zdeduplicate-diagnostics=yes` because the number of cycle errors
+// emitted is for some horrible reason platform-specific.
+//[next] compile-flags: -Ztrait-solver=next -Zdeduplicate-diagnostics=yes
 // incremental
 
 // checks that we don't ICE if there are region inference variables in the environment
@@ -13,6 +14,7 @@ use std::fmt::Debug;
 use std::marker::PointerLike;
 
 fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+    //[next]~^ ERROR cycle detected when computing
     t as _
     //[current]~^ ERROR type annotations needed
 }
diff --git a/tests/ui/impl-trait/reveal-during-codegen.rs b/tests/ui/impl-trait/reveal-during-codegen.rs
new file mode 100644
index 00000000000..11463772eb3
--- /dev/null
+++ b/tests/ui/impl-trait/reveal-during-codegen.rs
@@ -0,0 +1,11 @@
+// build-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+fn test() -> Option<impl Sized> {
+    Some("")
+}
+
+fn main() {
+    test();
+}
diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/issues/issue-67552.rs
index ec1997ccd5d..7336b873dd6 100644
--- a/tests/ui/issues/issue-67552.rs
+++ b/tests/ui/issues/issue-67552.rs
@@ -1,6 +1,7 @@
 // build-fail
 // compile-flags: -Copt-level=0
 // normalize-stderr-test: ".nll/" -> "/"
+// ignore-compare-mode-next-solver (hangs)
 
 fn main() {
     rec(Empty);
diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/issues/issue-67552.stderr
index 4746f918bf8..f93ed67dab2 100644
--- a/tests/ui/issues/issue-67552.stderr
+++ b/tests/ui/issues/issue-67552.stderr
@@ -1,11 +1,11 @@
 error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>`
-  --> $DIR/issue-67552.rs:29:9
+  --> $DIR/issue-67552.rs:30:9
    |
 LL |         rec(identity(&mut it))
    |         ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: `rec` defined here
-  --> $DIR/issue-67552.rs:22:1
+  --> $DIR/issue-67552.rs:23:1
    |
 LL | / fn rec<T>(mut it: T)
 LL | | where
diff --git a/tests/ui/recursion/issue-95134.rs b/tests/ui/recursion/issue-95134.rs
index 2f1cffa2fa9..7ee31d85c2b 100644
--- a/tests/ui/recursion/issue-95134.rs
+++ b/tests/ui/recursion/issue-95134.rs
@@ -3,6 +3,7 @@
 // compile-flags: -Copt-level=0
 // dont-check-failure-status
 // dont-check-compiler-stderr
+// ignore-compare-mode-next-solver (hangs)
 
 pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
     if n > 15 {