about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-01 23:31:51 +0000
committerbors <bors@rust-lang.org>2020-02-01 23:31:51 +0000
commite5b150edafc0e72cd7f5f3f67a4e8b417d515b01 (patch)
treef29b6c6172ad7b834afac0155d93036c028cfc63 /src/test
parent13db6501c7273cd1997ce20e15106f362e5613c4 (diff)
parent87bb0c4389b09bfa86780eb014a4a2de95a3840b (diff)
downloadrust-e5b150edafc0e72cd7f5f3f67a4e8b417d515b01.tar.gz
rust-e5b150edafc0e72cd7f5f3f67a4e8b417d515b01.zip
Auto merge of #68752 - JohnTitor:rollup-zz3u4xl, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #68460 (Use BufWriter for emitting MIR)
 - #68681 (Suggest path separator for single-colon typos)
 - #68688 ([docs] remind bug reporters to update nightly)
 - #68704 (Ignore `build` dir formatting)
 - #68727 (Remove a comment about pretty printer in formatting tests)
 - #68736 (Remove `Alloc` in favor of `AllocRef`)
 - #68740 (Do not suggest things named underscore)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/ifmt.rs6
-rw-r--r--src/test/ui/parser/qualified-path-in-turbofish.fixed19
-rw-r--r--src/test/ui/parser/qualified-path-in-turbofish.rs19
-rw-r--r--src/test/ui/parser/qualified-path-in-turbofish.stderr8
-rw-r--r--src/test/ui/resolve/typo-suggestion-named-underscore.rs14
-rw-r--r--src/test/ui/resolve/typo-suggestion-named-underscore.stderr16
6 files changed, 76 insertions, 6 deletions
diff --git a/src/test/ui/ifmt.rs b/src/test/ui/ifmt.rs
index 1a070843cc4..27ab3d6b7ab 100644
--- a/src/test/ui/ifmt.rs
+++ b/src/test/ui/ifmt.rs
@@ -99,7 +99,6 @@ pub fn main() {
     let a: &dyn fmt::Debug = &1;
     t!(format!("{:?}", a), "1");
 
-
     // Formatting strings and their arguments
     t!(format!("{}", "a"), "a");
     t!(format!("{:4}", "a"), "a   ");
@@ -187,10 +186,6 @@ pub fn main() {
     // Ergonomic format_args!
     t!(format!("{0:x} {0:X}", 15), "f F");
     t!(format!("{0:x} {0:X} {}", 15), "f F 15");
-    // NOTE: For now the longer test cases must not be followed immediately by
-    // >1 empty lines, or the pretty printer will break. Since no one wants to
-    // touch the current pretty printer (#751), we have no choice but to work
-    // around it. Some of the following test cases are also affected.
     t!(format!("{:x}{0:X}{a:x}{:X}{1:x}{a:X}", 13, 14, a=15), "dDfEeF");
     t!(format!("{a:x} {a:X}", a=15), "f F");
 
@@ -201,7 +196,6 @@ pub fn main() {
     t!(format!("{a:.*} {0} {:.*}", 4, 3, "efgh", a="abcdef"), "abcd 4 efg");
     t!(format!("{:.a$} {a} {a:#x}", "aaaaaa", a=2), "aa 2 0x2");
 
-
     // Test that pointers don't get truncated.
     {
         let val = usize::MAX;
diff --git a/src/test/ui/parser/qualified-path-in-turbofish.fixed b/src/test/ui/parser/qualified-path-in-turbofish.fixed
new file mode 100644
index 00000000000..404d2f7762d
--- /dev/null
+++ b/src/test/ui/parser/qualified-path-in-turbofish.fixed
@@ -0,0 +1,19 @@
+// run-rustfix
+trait T {
+    type Ty;
+}
+
+struct Impl;
+
+impl T for Impl {
+    type Ty = u32;
+}
+
+fn template<T>() -> i64 {
+    3
+}
+
+fn main() {
+    template::<<Impl as T>::Ty>();
+    //~^ ERROR found single colon before projection in qualified path
+}
diff --git a/src/test/ui/parser/qualified-path-in-turbofish.rs b/src/test/ui/parser/qualified-path-in-turbofish.rs
new file mode 100644
index 00000000000..2f4b2ed348b
--- /dev/null
+++ b/src/test/ui/parser/qualified-path-in-turbofish.rs
@@ -0,0 +1,19 @@
+// run-rustfix
+trait T {
+    type Ty;
+}
+
+struct Impl;
+
+impl T for Impl {
+    type Ty = u32;
+}
+
+fn template<T>() -> i64 {
+    3
+}
+
+fn main() {
+    template::<<Impl as T>:Ty>();
+    //~^ ERROR found single colon before projection in qualified path
+}
diff --git a/src/test/ui/parser/qualified-path-in-turbofish.stderr b/src/test/ui/parser/qualified-path-in-turbofish.stderr
new file mode 100644
index 00000000000..8857d2ef30c
--- /dev/null
+++ b/src/test/ui/parser/qualified-path-in-turbofish.stderr
@@ -0,0 +1,8 @@
+error: found single colon before projection in qualified path
+  --> $DIR/qualified-path-in-turbofish.rs:17:27
+   |
+LL |     template::<<Impl as T>:Ty>();
+   |                           ^ help: use double colon: `::`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/resolve/typo-suggestion-named-underscore.rs b/src/test/ui/resolve/typo-suggestion-named-underscore.rs
new file mode 100644
index 00000000000..a2b05db0351
--- /dev/null
+++ b/src/test/ui/resolve/typo-suggestion-named-underscore.rs
@@ -0,0 +1,14 @@
+const _: () = ();
+
+fn main() {
+    a // Shouldn't suggest underscore
+    //~^ ERROR: cannot find value `a` in this scope
+}
+
+trait Unknown {}
+
+#[allow(unused_imports)]
+use Unknown as _;
+
+fn foo<T: A>(x: T) {} // Shouldn't suggest underscore
+//~^ ERROR: cannot find trait `A` in this scope
diff --git a/src/test/ui/resolve/typo-suggestion-named-underscore.stderr b/src/test/ui/resolve/typo-suggestion-named-underscore.stderr
new file mode 100644
index 00000000000..65d1b084a3a
--- /dev/null
+++ b/src/test/ui/resolve/typo-suggestion-named-underscore.stderr
@@ -0,0 +1,16 @@
+error[E0425]: cannot find value `a` in this scope
+  --> $DIR/typo-suggestion-named-underscore.rs:4:5
+   |
+LL |     a // Shouldn't suggest underscore
+   |     ^ not found in this scope
+
+error[E0405]: cannot find trait `A` in this scope
+  --> $DIR/typo-suggestion-named-underscore.rs:13:11
+   |
+LL | fn foo<T: A>(x: T) {} // Shouldn't suggest underscore
+   |           ^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0405, E0425.
+For more information about an error, try `rustc --explain E0405`.