address pnkfelix nits
This commit is contained in:
parent
5778fec665
commit
ed73a3267a
@ -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.
|
||||
|
@ -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],
|
||||
|
@ -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))),
|
||||
|
@ -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: aborting due to previous error
|
||||
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 2 previous errors
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
Loading…
x
Reference in New Issue
Block a user