about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-08-23 17:37:41 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-08-24 13:27:38 -0400
commited73a3267a648cffb92f60e50aa75a6547d9955d (patch)
treedc2399e896e9f2dd734f16955c822d03e7b1c60d
parent5778fec665ae2660426293bcfd3b30530d22e3b5 (diff)
downloadrust-ed73a3267a648cffb92f60e50aa75a6547d9955d.tar.gz
rust-ed73a3267a648cffb92f60e50aa75a6547d9955d.zip
address pnkfelix nits
-rw-r--r--src/librustc/ty/context.rs2
-rw-r--r--src/librustc_mir/build/matches/test.rs10
-rw-r--r--src/libsyntax/feature_gate.rs2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr38
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr22
-rw-r--r--src/test/ui/nll/user-annotations/dump-fn-method.rs5
-rw-r--r--src/test/ui/nll/user-annotations/dump-fn-method.stderr8
7 files changed, 59 insertions, 28 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 388c2455eb3..424139e7527 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -371,7 +371,7 @@ pub struct TypeckTables<'tcx> {
     /// other items.
     node_substs: ItemLocalMap<&'tcx Substs<'tcx>>,
 
-    /// Stores the substitutions that the user explicit gave (if any)
+    /// Stores the substitutions that the user explicitly gave (if any)
     /// attached to `id`. These will not include any inferred
     /// values. The canonical form is used to capture things like `_`
     /// or other unspecified values.
diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs
index 2baefc47f8e..4a0b4b0c885 100644
--- a/src/librustc_mir/build/matches/test.rs
+++ b/src/librustc_mir/build/matches/test.rs
@@ -344,7 +344,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
                         func: Operand::Constant(box Constant {
                             span: test.span,
                             ty: mty,
-                            user_ty: None, // FIXME
+
+                            // FIXME(#47184): This constant comes from user
+                            // input (a constant in a pattern).  Are
+                            // there forms where users can add type
+                            // annotations here?  For example, an
+                            // associated constant? Need to
+                            // experiment.
+                            user_ty: None,
+
                             literal: method,
                         }),
                         args: vec![val, expect],
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 28d27836034..e2a22167b7e 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -867,7 +867,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
                                        cfg_fn!(rustc_attrs))),
     ("rustc_dump_user_substs", Whitelisted, Gated(Stability::Unstable,
                                        "rustc_attrs",
-                                       "the `#[rustc_error]` attribute \
+                                       "this attribute \
                                         is just used for rustc unit tests \
                                         and will never be stable",
                                        cfg_fn!(rustc_attrs))),
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
index 1999df909ed..bb4e922fdc0 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
@@ -18,17 +18,33 @@ LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
 LL | |                                     fn(Inv<'y>)) }
    | |__________________________________________________- in this macro invocation
 
-error: compilation successful
-  --> $DIR/hr-subtype.rs:110:1
+error: unsatisfied lifetime constraints
+  --> $DIR/hr-subtype.rs:43:13
    |
-LL | / fn main() {
-LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
-LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
-LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
-LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
-LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
-LL | | }
-   | |_^
+LL |           fn subtype<'x,'y:'x,'z:'y>() {
+   |                      -- -- lifetime `'y` defined here
+   |                      |
+   |                      lifetime `'x` defined here
+LL |               gimme::<$t2>(None::<$t1>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | |                                     fn(Inv<'y>)) }
+   | |__________________________________________________- in this macro invocation
+
+error: unsatisfied lifetime constraints
+  --> $DIR/hr-subtype.rs:49:13
+   |
+LL |           fn supertype<'x,'y:'x,'z:'y>() {
+   |                        -- -- lifetime `'y` defined here
+   |                        |
+   |                        lifetime `'x` defined here
+LL |               gimme::<$t1>(None::<$t2>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | |                                     fn(Inv<'y>)) }
+   | |__________________________________________________- in this macro invocation
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
index f76b26b5191..c33e6fbfde7 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
@@ -8,17 +8,19 @@ LL | / check! { free_x_vs_free_y: (fn(&'x u32),
 LL | |                             fn(&'y u32)) }
    | |__________________________________________- in this macro invocation
 
-error: compilation successful
-  --> $DIR/hr-subtype.rs:110:1
+error: unsatisfied lifetime constraints
+  --> $DIR/hr-subtype.rs:49:13
    |
-LL | / fn main() {
-LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
-LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
-LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
-LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
-LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
-LL | | }
-   | |_^
+LL |           fn supertype<'x,'y:'x,'z:'y>() {
+   |                        -- -- lifetime `'y` defined here
+   |                        |
+   |                        lifetime `'x` defined here
+LL |               gimme::<$t1>(None::<$t2>);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | |                             fn(&'y u32)) }
+   | |__________________________________________- in this macro invocation
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.rs b/src/test/ui/nll/user-annotations/dump-fn-method.rs
index fa14009da5a..7f726d13a33 100644
--- a/src/test/ui/nll/user-annotations/dump-fn-method.rs
+++ b/src/test/ui/nll/user-annotations/dump-fn-method.rs
@@ -16,6 +16,7 @@
 #![feature(nll)]
 #![feature(rustc_attrs)]
 
+// Note: we reference the names T and U in the comments below.
 trait Bazoom<T> {
     fn method<U>(&self, arg: T, arg2: U) { }
 }
@@ -36,6 +37,8 @@ fn main() {
     x(22);
 
     // Here: we only want the `T` to be given, the rest should be variables.
+    //
+    // (`T` refers to the declaration of `Bazoom`)
     let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [?0, u32, ?1]
     x(&22, 44, 66);
 
@@ -45,6 +48,8 @@ fn main() {
 
     // Here: we want in particular that *only* the method `U`
     // annotation is given, the rest are variables.
+    //
+    // (`U` refers to the declaration of `Bazoom`)
     let y = 22_u32;
     y.method::<u32>(44, 66); //~ ERROR [?0, ?1, u32]
 
diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.stderr b/src/test/ui/nll/user-annotations/dump-fn-method.stderr
index 8f3a0498e24..6531f87dd98 100644
--- a/src/test/ui/nll/user-annotations/dump-fn-method.stderr
+++ b/src/test/ui/nll/user-annotations/dump-fn-method.stderr
@@ -1,23 +1,23 @@
 error: user substs: Canonical { variables: [], value: [u32] }
-  --> $DIR/dump-fn-method.rs:35:13
+  --> $DIR/dump-fn-method.rs:36:13
    |
 LL |     let x = foo::<u32>; //~ ERROR [u32]
    |             ^^^^^^^^^^
 
 error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, u32, ?1] }
-  --> $DIR/dump-fn-method.rs:39:13
+  --> $DIR/dump-fn-method.rs:42:13
    |
 LL |     let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [?0, u32, ?1]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: user substs: Canonical { variables: [], value: [u8, u16, u32] }
-  --> $DIR/dump-fn-method.rs:43:13
+  --> $DIR/dump-fn-method.rs:46:13
    |
 LL |     let x = <u8 as Bazoom<u16>>::method::<u32>; //~ ERROR [u8, u16, u32]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, ?1, u32] }
-  --> $DIR/dump-fn-method.rs:49:5
+  --> $DIR/dump-fn-method.rs:54:5
    |
 LL |     y.method::<u32>(44, 66); //~ ERROR [?0, ?1, u32]
    |     ^^^^^^^^^^^^^^^^^^^^^^^