Skip to content

Commit ed73a32

Browse files
committed
address pnkfelix nits
1 parent 5778fec commit ed73a32

File tree

7 files changed

+59
-28
lines changed

7 files changed

+59
-28
lines changed

src/librustc/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ pub struct TypeckTables<'tcx> {
371371
/// other items.
372372
node_substs: ItemLocalMap<&'tcx Substs<'tcx>>,
373373

374-
/// Stores the substitutions that the user explicit gave (if any)
374+
/// Stores the substitutions that the user explicitly gave (if any)
375375
/// attached to `id`. These will not include any inferred
376376
/// values. The canonical form is used to capture things like `_`
377377
/// or other unspecified values.

src/librustc_mir/build/matches/test.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
344344
func: Operand::Constant(box Constant {
345345
span: test.span,
346346
ty: mty,
347-
user_ty: None, // FIXME
347+
348+
// FIXME(#47184): This constant comes from user
349+
// input (a constant in a pattern). Are
350+
// there forms where users can add type
351+
// annotations here? For example, an
352+
// associated constant? Need to
353+
// experiment.
354+
user_ty: None,
355+
348356
literal: method,
349357
}),
350358
args: vec![val, expect],

src/libsyntax/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
867867
cfg_fn!(rustc_attrs))),
868868
("rustc_dump_user_substs", Whitelisted, Gated(Stability::Unstable,
869869
"rustc_attrs",
870-
"the `#[rustc_error]` attribute \
870+
"this attribute \
871871
is just used for rustc unit tests \
872872
and will never be stable",
873873
cfg_fn!(rustc_attrs))),

src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr

+27-11
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,33 @@ LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
1818
LL | | fn(Inv<'y>)) }
1919
| |__________________________________________________- in this macro invocation
2020

21-
error: compilation successful
22-
--> $DIR/hr-subtype.rs:110:1
21+
error: unsatisfied lifetime constraints
22+
--> $DIR/hr-subtype.rs:43:13
2323
|
24-
LL | / fn main() {
25-
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
26-
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
27-
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
28-
LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
29-
LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
30-
LL | | }
31-
| |_^
24+
LL | fn subtype<'x,'y:'x,'z:'y>() {
25+
| -- -- lifetime `'y` defined here
26+
| |
27+
| lifetime `'x` defined here
28+
LL | gimme::<$t2>(None::<$t1>);
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
30+
...
31+
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
32+
LL | | fn(Inv<'y>)) }
33+
| |__________________________________________________- in this macro invocation
34+
35+
error: unsatisfied lifetime constraints
36+
--> $DIR/hr-subtype.rs:49:13
37+
|
38+
LL | fn supertype<'x,'y:'x,'z:'y>() {
39+
| -- -- lifetime `'y` defined here
40+
| |
41+
| lifetime `'x` defined here
42+
LL | gimme::<$t1>(None::<$t2>);
43+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
44+
...
45+
LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
46+
LL | | fn(Inv<'y>)) }
47+
| |__________________________________________________- in this macro invocation
3248

33-
error: aborting due to previous error
49+
error: aborting due to 2 previous errors
3450

src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr

+12-10
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ LL | / check! { free_x_vs_free_y: (fn(&'x u32),
88
LL | | fn(&'y u32)) }
99
| |__________________________________________- in this macro invocation
1010

11-
error: compilation successful
12-
--> $DIR/hr-subtype.rs:110:1
11+
error: unsatisfied lifetime constraints
12+
--> $DIR/hr-subtype.rs:49:13
1313
|
14-
LL | / fn main() {
15-
LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
16-
LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
17-
LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
18-
LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
19-
LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
20-
LL | | }
21-
| |_^
14+
LL | fn supertype<'x,'y:'x,'z:'y>() {
15+
| -- -- lifetime `'y` defined here
16+
| |
17+
| lifetime `'x` defined here
18+
LL | gimme::<$t1>(None::<$t2>);
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'x` must outlive `'y`
20+
...
21+
LL | / check! { free_x_vs_free_y: (fn(&'x u32),
22+
LL | | fn(&'y u32)) }
23+
| |__________________________________________- in this macro invocation
2224

2325
error: aborting due to previous error
2426

src/test/ui/nll/user-annotations/dump-fn-method.rs

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![feature(nll)]
1717
#![feature(rustc_attrs)]
1818

19+
// Note: we reference the names T and U in the comments below.
1920
trait Bazoom<T> {
2021
fn method<U>(&self, arg: T, arg2: U) { }
2122
}
@@ -36,6 +37,8 @@ fn main() {
3637
x(22);
3738

3839
// Here: we only want the `T` to be given, the rest should be variables.
40+
//
41+
// (`T` refers to the declaration of `Bazoom`)
3942
let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [?0, u32, ?1]
4043
x(&22, 44, 66);
4144

@@ -45,6 +48,8 @@ fn main() {
4548

4649
// Here: we want in particular that *only* the method `U`
4750
// annotation is given, the rest are variables.
51+
//
52+
// (`U` refers to the declaration of `Bazoom`)
4853
let y = 22_u32;
4954
y.method::<u32>(44, 66); //~ ERROR [?0, ?1, u32]
5055

src/test/ui/nll/user-annotations/dump-fn-method.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: user substs: Canonical { variables: [], value: [u32] }
2-
--> $DIR/dump-fn-method.rs:35:13
2+
--> $DIR/dump-fn-method.rs:36:13
33
|
44
LL | let x = foo::<u32>; //~ ERROR [u32]
55
| ^^^^^^^^^^
66

77
error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, u32, ?1] }
8-
--> $DIR/dump-fn-method.rs:39:13
8+
--> $DIR/dump-fn-method.rs:42:13
99
|
1010
LL | let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [?0, u32, ?1]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: user substs: Canonical { variables: [], value: [u8, u16, u32] }
14-
--> $DIR/dump-fn-method.rs:43:13
14+
--> $DIR/dump-fn-method.rs:46:13
1515
|
1616
LL | let x = <u8 as Bazoom<u16>>::method::<u32>; //~ ERROR [u8, u16, u32]
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: user substs: Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: [?0, ?1, u32] }
20-
--> $DIR/dump-fn-method.rs:49:5
20+
--> $DIR/dump-fn-method.rs:54:5
2121
|
2222
LL | y.method::<u32>(44, 66); //~ ERROR [?0, ?1, u32]
2323
| ^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)