about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/issues/issue-22933-3.stderr4
-rw-r--r--src/test/ui/suggestions/suggest-std-when-using-type.rs7
-rw-r--r--src/test/ui/suggestions/suggest-std-when-using-type.stderr24
3 files changed, 35 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr
index b1afda6d151..e0e8b5e18a4 100644
--- a/src/test/ui/issues/issue-22933-3.stderr
+++ b/src/test/ui/issues/issue-22933-3.stderr
@@ -3,6 +3,10 @@ error[E0599]: no associated item named `MIN` found for type `u8` in the current
    |
 LL | const FOO: [u32; u8::MIN as usize] = [];
    |                      ^^^ associated item not found in `u8`
+help: you are looking for the module in `std`, not the primitive type
+   |
+LL | const FOO: [u32; std::u8::MIN as usize] = [];
+   |                  ^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/suggest-std-when-using-type.rs b/src/test/ui/suggestions/suggest-std-when-using-type.rs
new file mode 100644
index 00000000000..9ca68a635da
--- /dev/null
+++ b/src/test/ui/suggestions/suggest-std-when-using-type.rs
@@ -0,0 +1,7 @@
+fn main() {
+    let pi = f32::consts::PI; //~ ERROR ambiguous associated type
+    let bytes = "hello world".as_bytes();
+    let string = unsafe {
+        str::from_utf8(bytes) //~ ERROR no function or associated item named `from_utf8` found
+    };
+}
diff --git a/src/test/ui/suggestions/suggest-std-when-using-type.stderr b/src/test/ui/suggestions/suggest-std-when-using-type.stderr
new file mode 100644
index 00000000000..eecb4e60f9d
--- /dev/null
+++ b/src/test/ui/suggestions/suggest-std-when-using-type.stderr
@@ -0,0 +1,24 @@
+error[E0223]: ambiguous associated type
+  --> $DIR/suggest-std-when-using-type.rs:2:14
+   |
+LL |     let pi = f32::consts::PI;
+   |              ^^^^^^^^^^^^^^^
+help: you are looking for the module in `std`, not the primitive type
+   |
+LL |     let pi = std::f32::consts::PI;
+   |              ^^^^^^^^^^^^^^^^^^^^
+
+error[E0599]: no function or associated item named `from_utf8` found for type `str` in the current scope
+  --> $DIR/suggest-std-when-using-type.rs:5:14
+   |
+LL |         str::from_utf8(bytes)
+   |              ^^^^^^^^^ function or associated item not found in `str`
+help: you are looking for the module in `std`, not the primitive type
+   |
+LL |         std::str::from_utf8(bytes)
+   |         ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0223, E0599.
+For more information about an error, try `rustc --explain E0223`.