Skip to content

Commit 06a014c

Browse files
committed
fix: tests updated for lifetime ellision
1 parent 7dfa685 commit 06a014c

25 files changed

Lines changed: 647 additions & 655 deletions

File tree

crates/hir-def/src/expr_store/tests/signatures.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const async unsafe extern "C" fn a() {}
109109
fn ret_impl_trait() -> impl Trait {}
110110
"#,
111111
expect![[r#"
112-
fn foo<'a, const C: usize = 314235, T = B>(&Struct, (), u32) -> &'a dyn Fn::<(), Output = i32>
112+
fn foo<'a, '_, const C: usize = 314235, T = B>(&'_ Struct, (), u32) -> &'a dyn Fn::<(), Output = i32>
113113
where
114114
T: Trait::<Item = A>,
115115
(): Default
@@ -169,15 +169,15 @@ fn allowed3(baz: impl Baz<Assoc = Qux<impl Foo>>) {}
169169
{...}
170170
fn not_allowed2<Param[0]>(Param[0])
171171
where
172-
Param[0]: Fn::<(&{error}), Output = ()>
172+
Param[0]: for<'_> Fn::<(&'_ {error}), Output = ()>
173173
{...}
174174
fn not_allowed3<Param[0]>(Param[0])
175175
where
176176
Param[0]: Bar::<{error}>
177177
{...}
178-
fn not_allowed4<Param[0]>(Param[0])
178+
fn not_allowed4<'_, Param[0]>(Param[0])
179179
where
180-
Param[0]: Bar::<&{error}>
180+
Param[0]: Bar::<&'_ {error}>
181181
{...}
182182
fn allowed1<Param[0], Param[1]>(Param[1])
183183
where
@@ -207,7 +207,7 @@ type Alias<'a, 'b, T> = &'b T;
207207
fn f<T>(_: Alias<T>) {}
208208
"#,
209209
expect![[r#"
210-
fn f<T>(Alias::<T>) {...}
210+
fn f<'_, '_, T>(Alias::<'_, '_, T>) {...}
211211
"#]],
212212
);
213213
}

crates/hir-ty/src/tests/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn expr_macro_def_expanded_in_various_places() {
199199
100..119 'for _ ...!() {}': !
200200
100..119 'for _ ...!() {}': {unknown}
201201
100..119 'for _ ...!() {}': &'? mut {unknown}
202-
100..119 'for _ ...!() {}': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
202+
100..119 'for _ ...!() {}': fn next<{unknown}>(&'?0.0 mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
203203
100..119 'for _ ...!() {}': Option<<{unknown} as Iterator>::Item>
204204
100..119 'for _ ...!() {}': ()
205205
100..119 'for _ ...!() {}': ()
@@ -293,7 +293,7 @@ fn expr_macro_rules_expanded_in_various_places() {
293293
114..133 'for _ ...!() {}': !
294294
114..133 'for _ ...!() {}': {unknown}
295295
114..133 'for _ ...!() {}': &'? mut {unknown}
296-
114..133 'for _ ...!() {}': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
296+
114..133 'for _ ...!() {}': fn next<{unknown}>(&'?0.0 mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
297297
114..133 'for _ ...!() {}': Option<<{unknown} as Iterator>::Item>
298298
114..133 'for _ ...!() {}': ()
299299
114..133 'for _ ...!() {}': ()

crates/hir-ty/src/tests/method_resolution.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ fn infer_call_trait_method_on_generic_param_1() {
660660
}
661661
"#,
662662
expect![[r#"
663-
29..33 'self': &'? Self
663+
29..33 'self': &'_ Self
664664
63..64 't': T
665665
69..88 '{ ...d(); }': ()
666666
75..76 't': T
@@ -681,7 +681,7 @@ fn infer_call_trait_method_on_generic_param_2() {
681681
}
682682
"#,
683683
expect![[r#"
684-
32..36 'self': &'? Self
684+
32..36 'self': &'_ Self
685685
70..71 't': T
686686
76..95 '{ ...d(); }': ()
687687
82..83 't': T
@@ -1155,12 +1155,12 @@ fn dyn_trait_super_trait_not_in_scope() {
11551155
}
11561156
"#,
11571157
expect![[r#"
1158-
51..55 'self': &'? Self
1158+
51..55 'self': &'_ Self
11591159
64..69 '{ 0 }': u32
11601160
66..67 '0': u32
1161-
176..177 'd': &'? (dyn Trait + 'static)
1161+
176..177 'd': &'_ (dyn Trait + 'static)
11621162
191..207 '{ ...o(); }': ()
1163-
197..198 'd': &'? (dyn Trait + 'static)
1163+
197..198 'd': &'_ (dyn Trait + 'static)
11641164
197..204 'd.foo()': u32
11651165
"#]],
11661166
);
@@ -1187,7 +1187,7 @@ fn test() {
11871187
}
11881188
"#,
11891189
expect![[r#"
1190-
75..79 'self': &'? S
1190+
75..79 'self': &'_ S
11911191
89..109 '{ ... }': bool
11921192
99..103 'true': bool
11931193
123..167 '{ ...o(); }': ()

crates/hir-ty/src/tests/never_type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn diverging_expression_3_break() {
364364
151..172 'for a ...eak; }': !
365365
151..172 'for a ...eak; }': {unknown}
366366
151..172 'for a ...eak; }': &'? mut {unknown}
367-
151..172 'for a ...eak; }': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
367+
151..172 'for a ...eak; }': fn next<{unknown}>(&'?0.0 mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
368368
151..172 'for a ...eak; }': Option<<{unknown} as Iterator>::Item>
369369
151..172 'for a ...eak; }': ()
370370
151..172 'for a ...eak; }': ()
@@ -381,7 +381,7 @@ fn diverging_expression_3_break() {
381381
237..250 'for a in b {}': !
382382
237..250 'for a in b {}': {unknown}
383383
237..250 'for a in b {}': &'? mut {unknown}
384-
237..250 'for a in b {}': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
384+
237..250 'for a in b {}': fn next<{unknown}>(&'?0.0 mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
385385
237..250 'for a in b {}': Option<<{unknown} as Iterator>::Item>
386386
237..250 'for a in b {}': ()
387387
237..250 'for a in b {}': ()
@@ -397,7 +397,7 @@ fn diverging_expression_3_break() {
397397
315..337 'for a ...urn; }': !
398398
315..337 'for a ...urn; }': {unknown}
399399
315..337 'for a ...urn; }': &'? mut {unknown}
400-
315..337 'for a ...urn; }': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
400+
315..337 'for a ...urn; }': fn next<{unknown}>(&'?0.0 mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
401401
315..337 'for a ...urn; }': Option<<{unknown} as Iterator>::Item>
402402
315..337 'for a ...urn; }': ()
403403
315..337 'for a ...urn; }': ()

crates/hir-ty/src/tests/opaque_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl Miku {
204204
61..72 '{ loop {} }': Vec<T>
205205
63..70 'loop {}': !
206206
68..70 '{}': ()
207-
133..137 'self': &'? Miku
207+
133..137 'self': &'_ Miku
208208
152..220 '{ ... }': Miku
209209
162..214 'Miku {... }': Miku
210210
193..201 'Vec::new': fn new<{unknown}>() -> Vec<{unknown}>

crates/hir-ty/src/tests/patterns.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ fn infer_pattern() {
3232
}
3333
"#,
3434
expect![[r#"
35-
8..9 'x': &'? i32
35+
8..9 'x': &'_ i32
3636
17..399 '{ ...o_x; }': ()
3737
27..28 'y': &'? i32
38-
31..32 'x': &'? i32
38+
31..32 'x': &'_ i32
3939
42..44 '&z': &'? i32
4040
43..44 'z': i32
41-
47..48 'x': &'? i32
41+
47..48 'x': &'_ i32
4242
58..59 'a': i32
4343
62..63 'z': i32
4444
73..79 '(c, d)': (i32, &'? str)
@@ -50,7 +50,7 @@ fn infer_pattern() {
5050
101..150 'for (e... }': !
5151
101..150 'for (e... }': IntoIter<(i32, i32), 1>
5252
101..150 'for (e... }': &'? mut IntoIter<(i32, i32), 1>
53-
101..150 'for (e... }': fn next<IntoIter<(i32, i32), 1>>(&'? mut IntoIter<(i32, i32), 1>) -> Option<<IntoIter<(i32, i32), 1> as Iterator>::Item>
53+
101..150 'for (e... }': fn next<IntoIter<(i32, i32), 1>>(&'?0.0 mut IntoIter<(i32, i32), 1>) -> Option<<IntoIter<(i32, i32), 1> as Iterator>::Item>
5454
101..150 'for (e... }': Option<(i32, i32)>
5555
101..150 'for (e... }': ()
5656
101..150 'for (e... }': ()
@@ -95,14 +95,14 @@ fn infer_pattern() {
9595
276..281 'a + b': u64
9696
280..281 'b': u64
9797
283..284 'c': i32
98-
297..309 'ref ref_to_x': &'? &'? i32
99-
312..313 'x': &'? i32
98+
297..309 'ref ref_to_x': &'? &'_ i32
99+
312..313 'x': &'_ i32
100100
323..332 'mut mut_x': &'? i32
101-
335..336 'x': &'? i32
102-
346..366 'ref mu...f_to_x': &'? mut &'? i32
103-
369..370 'x': &'? i32
104-
380..381 'k': &'? mut &'? i32
105-
384..396 'mut_ref_to_x': &'? mut &'? i32
101+
335..336 'x': &'_ i32
102+
346..366 'ref mu...f_to_x': &'? mut &'_ i32
103+
369..370 'x': &'_ i32
104+
380..381 'k': &'? mut &'_ i32
105+
384..396 'mut_ref_to_x': &'? mut &'_ i32
106106
"#]],
107107
);
108108
}
@@ -127,7 +127,7 @@ fn infer_literal_pattern() {
127127
17..28 '{ loop {} }': T
128128
19..26 'loop {}': !
129129
24..26 '{}': ()
130-
37..38 'x': &'? i32
130+
37..38 'x': &'_ i32
131131
46..263 '{ ...) {} }': ()
132132
52..75 'if let...y() {}': ()
133133
55..72 'let "f... any()': bool
@@ -394,7 +394,7 @@ fn infer_pattern_match_byte_string_literal() {
394394
}
395395
"#,
396396
expect![[r#"
397-
105..109 'self': &'? [T; N]
397+
105..109 'self': &'_ [T; N]
398398
111..116 'index': RangeFull
399399
157..180 '{ ... }': &'? [u8]
400400
167..174 'loop {}': !
@@ -705,7 +705,7 @@ fn main() {
705705
}
706706
"#,
707707
expect![[r#"
708-
27..31 'self': &'? S
708+
27..31 'self': &'_ S
709709
41..50 '{ false }': bool
710710
43..48 'false': bool
711711
64..115 '{ ... } }': ()
@@ -777,10 +777,10 @@ fn slice_tail_pattern() {
777777
}
778778
"#,
779779
expect![[r#"
780-
7..13 'params': &'? [i32]
780+
7..13 'params': &'_ [i32]
781781
23..92 '{ ... } }': ()
782782
29..90 'match ... }': ()
783-
35..41 'params': &'? [i32]
783+
35..41 'params': &'_ [i32]
784784
52..69 '[head,... @ ..]': [i32]
785785
53..57 'head': &'? i32
786786
59..68 'tail @ ..': &'? [i32]
@@ -1338,23 +1338,23 @@ fn foo(v: &Box<Foo<i32>>) {
13381338
}
13391339
"#,
13401340
expect![[r#"
1341-
142..146 'self': &'? Box<T>
1341+
142..146 'self': &'_ Box<T>
13421342
165..188 '{ ... }': &'? T
13431343
175..182 'loop {}': !
13441344
180..182 '{}': ()
1345-
310..314 'self': &'? Foo<T>
1345+
310..314 'self': &'_ Foo<T>
13461346
333..356 '{ ... }': &'? [T]
13471347
343..350 'loop {}': !
13481348
348..350 '{}': ()
13491349
!0..20 'builti...inner)': Foo<i32>
13501350
!0..28 'builti...nner))': Box<Foo<i32>>
13511351
!14..19 'inner': &'? [i32]
1352-
399..400 'v': &'? Box<Foo<i32>>
1352+
399..400 'v': &'_ Box<Foo<i32>>
13531353
418..493 '{ ... } }': ()
13541354
424..491 'match ... }': ()
1355-
430..431 'v': &'? Box<Foo<i32>>
1355+
430..431 'v': &'_ Box<Foo<i32>>
13561356
467..469 '{}': ()
1357-
478..479 '_': &'? Box<Foo<i32>>
1357+
478..479 '_': &'_ Box<Foo<i32>>
13581358
483..485 '{}': ()
13591359
"#]],
13601360
);

0 commit comments

Comments
 (0)