about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-01 23:53:36 -0500
committerMichael Goulet <michael@errs.io>2022-12-02 00:05:35 -0500
commitdc45eb93f7541b3033487abaee653cb5bf6602d5 (patch)
tree8bb8401922140b32aedefd199ee493d8d3f83a7d /src
parent5ac7e08aaf10d2882c6addcf220872c9390ed91e (diff)
downloadrust-dc45eb93f7541b3033487abaee653cb5bf6602d5.tar.gz
rust-dc45eb93f7541b3033487abaee653cb5bf6602d5.zip
Revert 88f2140
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/issues/issue-35976.rs14
-rw-r--r--src/test/ui/issues/issue-35976.unimported.stderr (renamed from src/test/ui/issues/issue-35976.stderr)7
2 files changed, 15 insertions, 6 deletions
diff --git a/src/test/ui/issues/issue-35976.rs b/src/test/ui/issues/issue-35976.rs
index d075794d994..aa6f74cb5d4 100644
--- a/src/test/ui/issues/issue-35976.rs
+++ b/src/test/ui/issues/issue-35976.rs
@@ -1,5 +1,9 @@
+// revisions: imported unimported
+//[imported] check-pass
+
 mod private {
     pub trait Future {
+        //[unimported]~^^ HELP perhaps add a `use` for it
         fn wait(&self) where Self: Sized;
     }
 
@@ -8,13 +12,13 @@ mod private {
     }
 }
 
-//use private::Future;
+#[cfg(imported)]
+use private::Future;
 
 fn bar(arg: Box<dyn private::Future>) {
+    // Importing the trait means that we don't autoderef `Box<dyn Future>`
     arg.wait();
-    //~^ ERROR the `wait` method cannot be invoked on a trait object
+    //[unimported]~^ ERROR the `wait` method cannot be invoked on a trait object
 }
 
-fn main() {
-
-}
+fn main() {}
diff --git a/src/test/ui/issues/issue-35976.stderr b/src/test/ui/issues/issue-35976.unimported.stderr
index fe16f97b9d0..5d61bb8ea37 100644
--- a/src/test/ui/issues/issue-35976.stderr
+++ b/src/test/ui/issues/issue-35976.unimported.stderr
@@ -1,11 +1,16 @@
 error: the `wait` method cannot be invoked on a trait object
-  --> $DIR/issue-35976.rs:14:9
+  --> $DIR/issue-35976.rs:20:9
    |
 LL |         fn wait(&self) where Self: Sized;
    |                                    ----- this has a `Sized` requirement
 ...
 LL |     arg.wait();
    |         ^^^^
+   |
+help: another candidate was found in the following trait, perhaps add a `use` for it:
+   |
+LL | use private::Future;
+   |
 
 error: aborting due to previous error