about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-24 15:59:00 +0000
committerbors <bors@rust-lang.org>2019-07-24 15:59:00 +0000
commit03f19f7ff128a3b01eeab3f87f04cce22883f006 (patch)
tree5a84f2e53c728cc5aa241b4c01ef5bdf2aee08f6 /src/test
parent27a6a304e2baaabca88059753f020377f2476978 (diff)
parente27927d2fff6d8147da7e622f84101cb03521cec (diff)
Auto merge of #62935 - Centril:rollup-hzj9att, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #62641 (Regenerate character tables for Unicode 12.1)
 - #62716 (state also in the intro that UnsafeCell has no effect on &mut)
 - #62738 (Remove uses of mem::uninitialized from std::sys::cloudabi)
 - #62772 (Suggest trait bound on type parameter when it is unconstrained)
 - #62890 (Normalize use of backticks in compiler messages for libsyntax/*)
 - #62905 (Normalize use of backticks in compiler messages for doc)
 - #62916 (Add test `self-in-enum-definition`)
 - #62917 (Always emit trailing slash error)
 - #62926 (Fix typo in mem::uninitialized doc)
 - #62927 (use PanicMessage in MIR, kill InterpError::description)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/issues/issue-39559.stderr8
-rw-r--r--src/test/ui/parser/issue-62913.rs3
-rw-r--r--src/test/ui/parser/issue-62913.stderr16
-rw-r--r--src/test/ui/proc-macro/proc-macro-gates.stderr2
-rw-r--r--src/test/ui/span/issue-7575.stderr8
-rw-r--r--src/test/ui/suggestions/issue-21673.rs13
-rw-r--r--src/test/ui/suggestions/issue-21673.stderr27
-rw-r--r--src/test/ui/type-alias-enum-variants/self-in-enum-definition.rs8
-rw-r--r--src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr28
9 files changed, 106 insertions, 7 deletions
diff --git a/src/test/ui/issues/issue-39559.stderr b/src/test/ui/issues/issue-39559.stderr
index aded0c2de45..b945b5e6654 100644
--- a/src/test/ui/issues/issue-39559.stderr
+++ b/src/test/ui/issues/issue-39559.stderr
@@ -4,9 +4,11 @@ error[E0599]: no function or associated item named `dim` found for type `D` in t
 LL |     entries: [T; D::dim()],
    |                     ^^^ function or associated item not found in `D`
    |
-   = help: items from traits can only be used if the trait is implemented and in scope
-   = note: the following trait defines an item `dim`, perhaps you need to implement it:
-           candidate #1: `Dim`
+   = help: items from traits can only be used if the type parameter is bounded by the trait
+help: the following trait defines an item `dim`, perhaps you need to restrict type parameter `D` with it:
+   |
+LL | pub struct Vector<T, D: Dim + Dim> {
+   |                      ^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-62913.rs b/src/test/ui/parser/issue-62913.rs
new file mode 100644
index 00000000000..cfa19a2a310
--- /dev/null
+++ b/src/test/ui/parser/issue-62913.rs
@@ -0,0 +1,3 @@
+"\u\\"
+//~^ ERROR incorrect unicode escape sequence
+//~| ERROR invalid trailing slash in literal
diff --git a/src/test/ui/parser/issue-62913.stderr b/src/test/ui/parser/issue-62913.stderr
new file mode 100644
index 00000000000..05c5c4d000a
--- /dev/null
+++ b/src/test/ui/parser/issue-62913.stderr
@@ -0,0 +1,16 @@
+error: incorrect unicode escape sequence
+  --> $DIR/issue-62913.rs:1:2
+   |
+LL | "\u\"
+   |  ^^^ incorrect unicode escape sequence
+   |
+   = help: format of unicode escape sequences is `\u{...}`
+
+error: invalid trailing slash in literal
+  --> $DIR/issue-62913.rs:1:5
+   |
+LL | "\u\"
+   |     ^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr
index 8197bbd71fb..8462b564ec1 100644
--- a/src/test/ui/proc-macro/proc-macro-gates.stderr
+++ b/src/test/ui/proc-macro/proc-macro-gates.stderr
@@ -34,7 +34,7 @@ LL |     #![empty_attr]
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable
 
-error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token
+error: custom attribute invocations must be of the form `#[foo]` or `#[foo(..)]`, the macro name must only be followed by a delimiter token
   --> $DIR/proc-macro-gates.rs:21:1
    |
 LL | #[empty_attr = "y"]
diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr
index 614638752f1..36db5bea862 100644
--- a/src/test/ui/span/issue-7575.stderr
+++ b/src/test/ui/span/issue-7575.stderr
@@ -61,9 +61,11 @@ note: the candidate is defined in the trait `ManyImplTrait`
 LL |     fn is_str() -> bool {
    |     ^^^^^^^^^^^^^^^^^^^
    = help: to disambiguate the method call, write `ManyImplTrait::is_str(t)` instead
-   = help: items from traits can only be used if the trait is implemented and in scope
-   = note: the following trait defines an item `is_str`, perhaps you need to implement it:
-           candidate #1: `ManyImplTrait`
+   = help: items from traits can only be used if the type parameter is bounded by the trait
+help: the following trait defines an item `is_str`, perhaps you need to restrict type parameter `T` with it:
+   |
+LL | fn param_bound<T: ManyImplTrait + ManyImplTrait>(t: T) -> bool {
+   |                ^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/suggestions/issue-21673.rs b/src/test/ui/suggestions/issue-21673.rs
new file mode 100644
index 00000000000..9d66cae056a
--- /dev/null
+++ b/src/test/ui/suggestions/issue-21673.rs
@@ -0,0 +1,13 @@
+trait Foo {
+    fn method(&self) {}
+}
+
+fn call_method<T: std::fmt::Debug>(x: &T) {
+    x.method() //~ ERROR E0599
+}
+
+fn call_method_2<T>(x: T) {
+    x.method() //~ ERROR E0599
+}
+
+fn main() {}
diff --git a/src/test/ui/suggestions/issue-21673.stderr b/src/test/ui/suggestions/issue-21673.stderr
new file mode 100644
index 00000000000..6cf71c8b7c5
--- /dev/null
+++ b/src/test/ui/suggestions/issue-21673.stderr
@@ -0,0 +1,27 @@
+error[E0599]: no method named `method` found for type `&T` in the current scope
+  --> $DIR/issue-21673.rs:6:7
+   |
+LL |     x.method()
+   |       ^^^^^^
+   |
+   = help: items from traits can only be used if the type parameter is bounded by the trait
+help: the following trait defines an item `method`, perhaps you need to restrict type parameter `T` with it:
+   |
+LL | fn call_method<T: Foo + std::fmt::Debug>(x: &T) {
+   |                ^^^^^^^^
+
+error[E0599]: no method named `method` found for type `T` in the current scope
+  --> $DIR/issue-21673.rs:10:7
+   |
+LL |     x.method()
+   |       ^^^^^^
+   |
+   = help: items from traits can only be used if the type parameter is bounded by the trait
+help: the following trait defines an item `method`, perhaps you need to restrict type parameter `T` with it:
+   |
+LL | fn call_method_2<T: Foo>(x: T) {
+   |                  ^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/type-alias-enum-variants/self-in-enum-definition.rs b/src/test/ui/type-alias-enum-variants/self-in-enum-definition.rs
new file mode 100644
index 00000000000..63b21faa62b
--- /dev/null
+++ b/src/test/ui/type-alias-enum-variants/self-in-enum-definition.rs
@@ -0,0 +1,8 @@
+#[repr(u8)]
+enum Alpha {
+    V1 = 41,
+    V2 = Self::V1 as u8 + 1, // OK; See #50072.
+    V3 = Self::V1 {} as u8 + 2, //~ ERROR cycle detected when const-evaluating
+}
+
+fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr
new file mode 100644
index 00000000000..dc4050e44ab
--- /dev/null
+++ b/src/test/ui/type-alias-enum-variants/self-in-enum-definition.stderr
@@ -0,0 +1,28 @@
+error[E0391]: cycle detected when const-evaluating + checking `Alpha::V3::{{constant}}#0`
+  --> $DIR/self-in-enum-definition.rs:5:10
+   |
+LL |     V3 = Self::V1 {} as u8 + 2,
+   |          ^^^^^^^^
+   |
+note: ...which requires const-evaluating `Alpha::V3::{{constant}}#0`...
+  --> $DIR/self-in-enum-definition.rs:5:10
+   |
+LL |     V3 = Self::V1 {} as u8 + 2,
+   |          ^^^^^^^^
+   = note: ...which requires computing layout of `Alpha`...
+   = note: ...which again requires const-evaluating + checking `Alpha::V3::{{constant}}#0`, completing the cycle
+note: cycle used when collecting item types in top-level module
+  --> $DIR/self-in-enum-definition.rs:1:1
+   |
+LL | / #[repr(u8)]
+LL | | enum Alpha {
+LL | |     V1 = 41,
+LL | |     V2 = Self::V1 as u8 + 1, // OK; See #50072.
+...  |
+LL | |
+LL | | fn main() {}
+   | |____________^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.