mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Respect test style guidelines in tests::traits
This commit is contained in:
parent
4bf32eea21
commit
8113c3a914
@ -270,8 +270,7 @@ fn infer_from_bound_1() {
|
|||||||
fn test() {
|
fn test() {
|
||||||
let s = S(unknown);
|
let s = S(unknown);
|
||||||
foo(s);
|
foo(s);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
85..86 't': T
|
85..86 't': T
|
||||||
91..93 '{}': ()
|
91..93 '{}': ()
|
||||||
@ -298,8 +297,7 @@ fn infer_from_bound_2() {
|
|||||||
fn test() {
|
fn test() {
|
||||||
let s = S(unknown);
|
let s = S(unknown);
|
||||||
let x: u32 = foo(s);
|
let x: u32 = foo(s);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
86..87 't': T
|
86..87 't': T
|
||||||
97..99 '{}': ()
|
97..99 '{}': ()
|
||||||
@ -326,8 +324,7 @@ fn trait_default_method_self_bound_implements_trait() {
|
|||||||
fn bar(&self) -> {
|
fn bar(&self) -> {
|
||||||
let x = self.foo();
|
let x = self.foo();
|
||||||
}
|
}
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
26..30 'self': &Self
|
26..30 'self': &Self
|
||||||
52..56 'self': &Self
|
52..56 'self': &Self
|
||||||
@ -350,8 +347,7 @@ fn trait_default_method_self_bound_implements_super_trait() {
|
|||||||
fn bar(&self) -> {
|
fn bar(&self) -> {
|
||||||
let x = self.foo();
|
let x = self.foo();
|
||||||
}
|
}
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
31..35 'self': &Self
|
31..35 'self': &Self
|
||||||
85..89 'self': &Self
|
85..89 'self': &Self
|
||||||
@ -377,8 +373,7 @@ fn infer_project_associated_type() {
|
|||||||
let y: <T as Iterable>::Item = no_matter;
|
let y: <T as Iterable>::Item = no_matter;
|
||||||
let z: T::Item = no_matter;
|
let z: T::Item = no_matter;
|
||||||
let a: <T>::Item = no_matter;
|
let a: <T>::Item = no_matter;
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
108..261 '{ ...ter; }': ()
|
108..261 '{ ...ter; }': ()
|
||||||
118..119 'x': u32
|
118..119 'x': u32
|
||||||
@ -409,8 +404,7 @@ fn infer_return_associated_type() {
|
|||||||
let x = foo1(S);
|
let x = foo1(S);
|
||||||
let y = foo2(S);
|
let y = foo2(S);
|
||||||
let z = foo3(S);
|
let z = foo3(S);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
106..107 't': T
|
106..107 't': T
|
||||||
123..125 '{}': ()
|
123..125 '{}': ()
|
||||||
@ -444,8 +438,7 @@ fn infer_associated_type_bound() {
|
|||||||
}
|
}
|
||||||
fn test<T: Iterable<Item=u32>>() {
|
fn test<T: Iterable<Item=u32>>() {
|
||||||
let y: T::Item = unknown;
|
let y: T::Item = unknown;
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
67..100 '{ ...own; }': ()
|
67..100 '{ ...own; }': ()
|
||||||
77..78 'y': u32
|
77..78 'y': u32
|
||||||
@ -459,8 +452,7 @@ fn infer_const_body() {
|
|||||||
check_infer(
|
check_infer(
|
||||||
r#"
|
r#"
|
||||||
const A: u32 = 1 + 1;
|
const A: u32 = 1 + 1;
|
||||||
static B: u64 = { let x = 1; x };
|
static B: u64 = { let x = 1; x };"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
15..16 '1': u32
|
15..16 '1': u32
|
||||||
15..20 '1 + 1': u32
|
15..20 '1 + 1': u32
|
||||||
@ -482,8 +474,7 @@ fn tuple_struct_fields() {
|
|||||||
let a = S(4, 6);
|
let a = S(4, 6);
|
||||||
let b = a.0;
|
let b = a.0;
|
||||||
a.1
|
a.1
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
37..86 '{ ... a.1 }': u64
|
37..86 '{ ... a.1 }': u64
|
||||||
47..48 'a': S
|
47..48 'a': S
|
||||||
@ -509,8 +500,7 @@ fn tuple_struct_with_fn() {
|
|||||||
let a = S(|i| 2*i);
|
let a = S(|i| 2*i);
|
||||||
let b = a.0(4);
|
let b = a.0(4);
|
||||||
a.0(2)
|
a.0(2)
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
43..101 '{ ...0(2) }': u64
|
43..101 '{ ...0(2) }': u64
|
||||||
53..54 'a': S
|
53..54 'a': S
|
||||||
@ -968,8 +958,7 @@ fn argument_impl_trait() {
|
|||||||
x.foo2();
|
x.foo2();
|
||||||
y.foo2();
|
y.foo2();
|
||||||
z.foo2();
|
z.foo2();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
29..33 'self': &Self
|
29..33 'self': &Self
|
||||||
54..58 'self': &Self
|
54..58 'self': &Self
|
||||||
@ -1029,8 +1018,7 @@ fn argument_impl_trait_type_args_1() {
|
|||||||
foo(S);
|
foo(S);
|
||||||
foo::<u32>(S);
|
foo::<u32>(S);
|
||||||
foo::<u32, i32>(S); // we should ignore the extraneous i32
|
foo::<u32, i32>(S); // we should ignore the extraneous i32
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
155..156 'x': impl Trait
|
155..156 'x': impl Trait
|
||||||
175..186 '{ loop {} }': T
|
175..186 '{ loop {} }': T
|
||||||
@ -1086,8 +1074,7 @@ fn argument_impl_trait_type_args_2() {
|
|||||||
F::<u32>.foo(S);
|
F::<u32>.foo(S);
|
||||||
F::<u32>.foo::<i32>(S);
|
F::<u32>.foo::<i32>(S);
|
||||||
F::<u32>.foo::<i32, u32>(S); // extraneous argument should be ignored
|
F::<u32>.foo::<i32, u32>(S); // extraneous argument should be ignored
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
87..91 'self': F<T>
|
87..91 'self': F<T>
|
||||||
93..94 'x': impl Trait
|
93..94 'x': impl Trait
|
||||||
@ -1122,8 +1109,7 @@ fn argument_impl_trait_to_fn_pointer() {
|
|||||||
|
|
||||||
fn test() {
|
fn test() {
|
||||||
let f: fn(S) -> () = foo;
|
let f: fn(S) -> () = foo;
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
22..23 'x': impl Trait
|
22..23 'x': impl Trait
|
||||||
37..48 '{ loop {} }': ()
|
37..48 '{ loop {} }': ()
|
||||||
@ -1156,8 +1142,7 @@ fn impl_trait() {
|
|||||||
x.foo2();
|
x.foo2();
|
||||||
y.foo2();
|
y.foo2();
|
||||||
z.foo2();
|
z.foo2();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
29..33 'self': &Self
|
29..33 'self': &Self
|
||||||
54..58 'self': &Self
|
54..58 'self': &Self
|
||||||
@ -1199,8 +1184,7 @@ fn simple_return_pos_impl_trait() {
|
|||||||
fn test() {
|
fn test() {
|
||||||
let a = bar();
|
let a = bar();
|
||||||
a.foo();
|
a.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
29..33 'self': &Self
|
29..33 'self': &Self
|
||||||
71..82 '{ loop {} }': !
|
71..82 '{ loop {} }': !
|
||||||
@ -1237,8 +1221,7 @@ fn more_return_pos_impl_trait() {
|
|||||||
let (c, d) = baz(1u128);
|
let (c, d) = baz(1u128);
|
||||||
c.next().foo();
|
c.next().foo();
|
||||||
d.foo();
|
d.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
49..53 'self': &mut Self
|
49..53 'self': &mut Self
|
||||||
101..105 'self': &Self
|
101..105 'self': &Self
|
||||||
@ -1295,8 +1278,7 @@ fn dyn_trait() {
|
|||||||
x.foo2();
|
x.foo2();
|
||||||
y.foo2();
|
y.foo2();
|
||||||
z.foo2();
|
z.foo2();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
29..33 'self': &Self
|
29..33 'self': &Self
|
||||||
54..58 'self': &Self
|
54..58 'self': &Self
|
||||||
@ -1343,8 +1325,7 @@ fn dyn_trait_in_impl() {
|
|||||||
|
|
||||||
fn test(s: S<u32, i32>) {
|
fn test(s: S<u32, i32>) {
|
||||||
s.bar().baz();
|
s.bar().baz();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
32..36 'self': &Self
|
32..36 'self': &Self
|
||||||
102..106 'self': &S<T, U>
|
102..106 'self': &S<T, U>
|
||||||
@ -1377,8 +1358,7 @@ fn dyn_trait_bare() {
|
|||||||
x.foo();
|
x.foo();
|
||||||
y.foo();
|
y.foo();
|
||||||
z.foo();
|
z.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
26..30 'self': &Self
|
26..30 'self': &Self
|
||||||
60..62 '{}': ()
|
60..62 '{}': ()
|
||||||
@ -1405,16 +1385,23 @@ fn weird_bounds() {
|
|||||||
check_infer(
|
check_infer(
|
||||||
r#"
|
r#"
|
||||||
trait Trait {}
|
trait Trait {}
|
||||||
fn test(a: impl Trait + 'lifetime, b: impl 'lifetime, c: impl (Trait), d: impl ('lifetime), e: impl ?Sized, f: impl Trait + ?Sized) {}
|
fn test(
|
||||||
|
a: impl Trait + 'lifetime,
|
||||||
|
b: impl 'lifetime,
|
||||||
|
c: impl (Trait),
|
||||||
|
d: impl ('lifetime),
|
||||||
|
e: impl ?Sized,
|
||||||
|
f: impl Trait + ?Sized
|
||||||
|
) {}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
23..24 'a': impl Trait
|
28..29 'a': impl Trait
|
||||||
50..51 'b': impl
|
59..60 'b': impl
|
||||||
69..70 'c': impl Trait
|
82..83 'c': impl Trait
|
||||||
86..87 'd': impl
|
103..104 'd': impl
|
||||||
107..108 'e': impl
|
128..129 'e': impl
|
||||||
123..124 'f': impl Trait
|
148..149 'f': impl Trait
|
||||||
147..149 '{}': ()
|
173..175 '{}': ()
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1458,8 +1445,7 @@ fn assoc_type_bindings() {
|
|||||||
get(set(S));
|
get(set(S));
|
||||||
get2(set(S));
|
get2(set(S));
|
||||||
get2(S::<str>);
|
get2(S::<str>);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
49..50 't': T
|
49..50 't': T
|
||||||
77..79 '{}': ()
|
77..79 '{}': ()
|
||||||
@ -1556,8 +1542,7 @@ fn projection_eq_within_chalk() {
|
|||||||
|
|
||||||
fn test<T: Trait1<Type = u32>>(x: T) {
|
fn test<T: Trait1<Type = u32>>(x: T) {
|
||||||
x.foo();
|
x.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
61..65 'self': Self
|
61..65 'self': Self
|
||||||
163..164 'x': T
|
163..164 'x': T
|
||||||
@ -1600,8 +1585,7 @@ fn super_trait_method_resolution() {
|
|||||||
fn test<T: Trait1, U: Trait2>(x: T, y: U) {
|
fn test<T: Trait1, U: Trait2>(x: T, y: U) {
|
||||||
x.foo();
|
x.foo();
|
||||||
y.foo();
|
y.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
49..53 'self': &Self
|
49..53 'self': &Self
|
||||||
62..64 '{}': ()
|
62..64 '{}': ()
|
||||||
@ -1629,8 +1613,7 @@ fn super_trait_impl_trait_method_resolution() {
|
|||||||
|
|
||||||
fn test(x: &impl Trait1) {
|
fn test(x: &impl Trait1) {
|
||||||
x.foo();
|
x.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
49..53 'self': &Self
|
49..53 'self': &Self
|
||||||
62..64 '{}': ()
|
62..64 '{}': ()
|
||||||
@ -1679,8 +1662,7 @@ fn super_trait_assoc_type_bounds() {
|
|||||||
|
|
||||||
fn test() {
|
fn test() {
|
||||||
get2(set(S));
|
get2(set(S));
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
102..103 't': T
|
102..103 't': T
|
||||||
113..115 '{}': ()
|
113..115 '{}': ()
|
||||||
@ -1709,8 +1691,7 @@ fn fn_trait() {
|
|||||||
|
|
||||||
fn test<F: FnOnce(u32, u64) -> u128>(f: F) {
|
fn test<F: FnOnce(u32, u64) -> u128>(f: F) {
|
||||||
f.call_once((1, 2));
|
f.call_once((1, 2));
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
56..60 'self': Self
|
56..60 'self': Self
|
||||||
62..66 'args': Args
|
62..66 'args': Args
|
||||||
@ -1758,8 +1739,7 @@ fn fn_ptr_and_item() {
|
|||||||
let opt: Opt<u8>;
|
let opt: Opt<u8>;
|
||||||
let f: fn(u8) -> u32;
|
let f: fn(u8) -> u32;
|
||||||
opt.map(f);
|
opt.map(f);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
74..78 'self': Self
|
74..78 'self': Self
|
||||||
80..84 'args': Args
|
80..84 'args': Args
|
||||||
@ -1828,8 +1808,7 @@ fn fn_trait_deref_with_ty_default() {
|
|||||||
let make_foo_fn_ptr: fn() -> Foo = make_foo_fn;
|
let make_foo_fn_ptr: fn() -> Foo = make_foo_fn;
|
||||||
let lazy2: Lazy<Foo, _> = Lazy::new(make_foo_fn_ptr);
|
let lazy2: Lazy<Foo, _> = Lazy::new(make_foo_fn_ptr);
|
||||||
let r2 = lazy2.foo();
|
let r2 = lazy2.foo();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
64..68 'self': &Self
|
64..68 'self': &Self
|
||||||
165..169 'self': Self
|
165..169 'self': Self
|
||||||
@ -1880,8 +1859,7 @@ fn closure_1() {
|
|||||||
x.map(|v| v + 1);
|
x.map(|v| v + 1);
|
||||||
x.map(|_v| 1u64);
|
x.map(|_v| 1u64);
|
||||||
let y: Option<i64> = x.map(|_v| 1);
|
let y: Option<i64> = x.map(|_v| 1);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
147..151 'self': Option<T>
|
147..151 'self': Option<T>
|
||||||
153..154 'f': F
|
153..154 'f': F
|
||||||
@ -1944,8 +1922,7 @@ fn closure_2() {
|
|||||||
let g = |v| v + 1;
|
let g = |v| v + 1;
|
||||||
g(1u64);
|
g(1u64);
|
||||||
let h = |v| 1u128 + v;
|
let h = |v| 1u128 + v;
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
72..76 'self': Self
|
72..76 'self': Self
|
||||||
78..81 'rhs': Rhs
|
78..81 'rhs': Rhs
|
||||||
@ -2006,8 +1983,7 @@ fn closure_as_argument_inference_order() {
|
|||||||
let x2 = foo2(|s| s.method(), S);
|
let x2 = foo2(|s| s.method(), S);
|
||||||
let x3 = S.foo1(S, |s| s.method());
|
let x3 = S.foo1(S, |s| s.method());
|
||||||
let x4 = S.foo2(|s| s.method(), S);
|
let x4 = S.foo2(|s| s.method(), S);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
94..95 'x': T
|
94..95 'x': T
|
||||||
100..101 'f': F
|
100..101 'f': F
|
||||||
@ -2155,8 +2131,7 @@ fn unselected_projection_on_impl_self() {
|
|||||||
impl Trait for S2 {
|
impl Trait for S2 {
|
||||||
type Item = i32;
|
type Item = i32;
|
||||||
fn f(&self, x: <Self>::Item) { let y = x; }
|
fn f(&self, x: <Self>::Item) { let y = x; }
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
40..44 'self': &Self
|
40..44 'self': &Self
|
||||||
46..47 'x': Trait::Item<Self>
|
46..47 'x': Trait::Item<Self>
|
||||||
@ -2442,8 +2417,7 @@ fn proc_macro_server_types() {
|
|||||||
let group: Self::Group = make();
|
let group: Self::Group = make();
|
||||||
make()
|
make()
|
||||||
}
|
}
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
1061..1072 '{ loop {} }': T
|
1061..1072 '{ loop {} }': T
|
||||||
1063..1070 'loop {}': !
|
1063..1070 'loop {}': !
|
||||||
@ -2477,8 +2451,7 @@ fn unify_impl_trait() {
|
|||||||
foo(s1);
|
foo(s1);
|
||||||
let x: i32 = bar(S(default()));
|
let x: i32 = bar(S(default()));
|
||||||
S(default())
|
S(default())
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
26..27 'x': impl Trait<u32>
|
26..27 'x': impl Trait<u32>
|
||||||
46..57 '{ loop {} }': ()
|
46..57 '{ loop {} }': ()
|
||||||
@ -2541,8 +2514,7 @@ fn assoc_types_from_bounds() {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
f::<(), _>(|z| { z; });
|
f::<(), _>(|z| { z; });
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
133..135 '_v': F
|
133..135 '_v': F
|
||||||
178..181 '{ }': ()
|
178..181 '{ }': ()
|
||||||
@ -2696,8 +2668,7 @@ fn iterator_chain() {
|
|||||||
Vec::<i32>::new().into_iter()
|
Vec::<i32>::new().into_iter()
|
||||||
.filter_map(|x| if x > 0 { Some(x as u32) } else { None })
|
.filter_map(|x| if x > 0 { Some(x as u32) } else { None })
|
||||||
.for_each(|y| { y; });
|
.for_each(|y| { y; });
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
226..230 'self': Self
|
226..230 'self': Self
|
||||||
232..233 'f': F
|
232..233 'f': F
|
||||||
@ -2785,8 +2756,7 @@ fn trait_object_no_coercion() {
|
|||||||
|
|
||||||
fn test(x: &dyn Foo) {
|
fn test(x: &dyn Foo) {
|
||||||
foo(x);
|
foo(x);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
21..22 'x': &dyn Foo
|
21..22 'x': &dyn Foo
|
||||||
34..36 '{}': ()
|
34..36 '{}': ()
|
||||||
@ -2818,8 +2788,7 @@ fn builtin_copy() {
|
|||||||
NotCopy.test();
|
NotCopy.test();
|
||||||
(IsCopy, IsCopy).test();
|
(IsCopy, IsCopy).test();
|
||||||
(IsCopy, NotCopy).test();
|
(IsCopy, NotCopy).test();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
110..114 'self': &Self
|
110..114 'self': &Self
|
||||||
166..267 '{ ...t(); }': ()
|
166..267 '{ ...t(); }': ()
|
||||||
@ -2859,8 +2828,7 @@ fn builtin_fn_def_copy() {
|
|||||||
bar.test();
|
bar.test();
|
||||||
Struct.test();
|
Struct.test();
|
||||||
Enum::Variant.test();
|
Enum::Variant.test();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
41..43 '{}': ()
|
41..43 '{}': ()
|
||||||
60..61 'T': {unknown}
|
60..61 'T': {unknown}
|
||||||
@ -2894,8 +2862,7 @@ fn builtin_fn_ptr_copy() {
|
|||||||
f1.test();
|
f1.test();
|
||||||
f2.test();
|
f2.test();
|
||||||
f3.test();
|
f3.test();
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
54..58 'self': &Self
|
54..58 'self': &Self
|
||||||
108..110 'f1': fn()
|
108..110 'f1': fn()
|
||||||
@ -2927,8 +2894,7 @@ fn builtin_sized() {
|
|||||||
(*"foo").test(); // not Sized
|
(*"foo").test(); // not Sized
|
||||||
(1u8, 1u8).test();
|
(1u8, 1u8).test();
|
||||||
(1u8, *"foo").test(); // not Sized
|
(1u8, *"foo").test(); // not Sized
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
56..60 'self': &Self
|
56..60 'self': &Self
|
||||||
113..228 '{ ...ized }': ()
|
113..228 '{ ...ized }': ()
|
||||||
@ -3009,8 +2975,7 @@ fn infer_closure_arg() {
|
|||||||
let s = Option::None;
|
let s = Option::None;
|
||||||
let f = |x: Option<i32>| {};
|
let f = |x: Option<i32>| {};
|
||||||
(&f)(s)
|
(&f)(s)
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
52..126 '{ ...)(s) }': ()
|
52..126 '{ ...)(s) }': ()
|
||||||
62..63 's': Option<i32>
|
62..63 's': Option<i32>
|
||||||
@ -3117,8 +3082,7 @@ fn infer_box_fn_arg() {
|
|||||||
let s = Option::None;
|
let s = Option::None;
|
||||||
let f: Box<dyn FnOnce(&Option<i32>)> = box (|ps| {});
|
let f: Box<dyn FnOnce(&Option<i32>)> = box (|ps| {});
|
||||||
f(&s);
|
f(&s);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
100..104 'self': Self
|
100..104 'self': Self
|
||||||
106..110 'args': Args
|
106..110 'args': Args
|
||||||
@ -3284,8 +3248,7 @@ fn f() {
|
|||||||
().method();
|
().method();
|
||||||
//^^^^^^^^^^^ u8
|
//^^^^^^^^^^^ u8
|
||||||
}
|
}
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
46..50 'self': &Self
|
46..50 'self': &Self
|
||||||
58..63 '{ 0 }': u8
|
58..63 '{ 0 }': u8
|
||||||
@ -3339,8 +3302,7 @@ fn f() {
|
|||||||
fn inner() -> S {
|
fn inner() -> S {
|
||||||
let s = inner();
|
let s = inner();
|
||||||
}
|
}
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
17..73 '{ ... } }': ()
|
17..73 '{ ... } }': ()
|
||||||
39..71 '{ ... }': ()
|
39..71 '{ ... }': ()
|
||||||
@ -3375,8 +3337,7 @@ fn test() {
|
|||||||
let x = A;
|
let x = A;
|
||||||
let y = A;
|
let y = A;
|
||||||
let r = x.do_op(y);
|
let r = x.do_op(y);
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
63..67 'self': Self
|
63..67 'self': Self
|
||||||
69..72 'rhs': RHS
|
69..72 'rhs': RHS
|
||||||
@ -3425,9 +3386,7 @@ impl foo::Bar for F {
|
|||||||
fn foo() {
|
fn foo() {
|
||||||
use foo::Bar;
|
use foo::Bar;
|
||||||
let x = <F as Bar>::boo();
|
let x = <F as Bar>::boo();
|
||||||
}
|
}"#,
|
||||||
|
|
||||||
"#,
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
132..163 '{ ... }': Bar::Output<Self>
|
132..163 '{ ... }': Bar::Output<Self>
|
||||||
146..153 'loop {}': !
|
146..153 'loop {}': !
|
||||||
@ -3465,8 +3424,7 @@ fn foo() {
|
|||||||
|
|
||||||
pub trait Deserialize {
|
pub trait Deserialize {
|
||||||
fn deserialize() -> u8;
|
fn deserialize() -> u8;
|
||||||
}
|
}"#,
|
||||||
"#,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user