Skip to content

Commit 9165e3b

Browse files
committed
Update hir-ty test outputs
1 parent 531e152 commit 9165e3b

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

crates/hir-def/src/body/lower.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,6 @@ impl ExprCollector<'_> {
631631
let mac_call = mac.macro_call()?;
632632
let syntax_ptr = AstPtr::new(expr);
633633
let macro_ptr = AstPtr::new(&mac_call);
634-
// let prev_stmt = self.statements_in_scope.len();
635634
let stmt = self.collect_macro_call(
636635
mac_call,
637636
macro_ptr,

crates/hir-def/src/body/scope.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
175175

176176
scopes.set_scope(expr, *scope);
177177
match &body[expr] {
178+
Expr::MacroStmts { statements, tail } => {
179+
compute_block_scopes(statements, *tail, body, scopes, *scope);
180+
}
178181
Expr::Block { statements, tail, id, label } => {
179182
let scope = scopes.new_block_scope(*scope, *id, make_label(label));
180183
// Overwrite the old scope for the block expr, so that every block scope can be found

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ fn expr_macro_def_expanded_in_various_places() {
191191
!0..6 '1isize': isize
192192
!0..6 '1isize': isize
193193
!0..6 '1isize': isize
194+
!0..6 '1isize': isize
195+
!0..6 '1isize': isize
194196
39..442 '{ ...!(); }': ()
195197
73..94 'spam!(...am!())': {unknown}
196198
100..119 'for _ ...!() {}': ()
@@ -272,6 +274,8 @@ fn expr_macro_rules_expanded_in_various_places() {
272274
!0..6 '1isize': isize
273275
!0..6 '1isize': isize
274276
!0..6 '1isize': isize
277+
!0..6 '1isize': isize
278+
!0..6 '1isize': isize
275279
53..456 '{ ...!(); }': ()
276280
87..108 'spam!(...am!())': {unknown}
277281
114..133 'for _ ...!() {}': ()
@@ -306,7 +310,6 @@ fn expr_macro_expanded_in_stmts() {
306310
}
307311
"#,
308312
expect![[r#"
309-
!0..8 'leta=();': ()
310313
!0..8 'leta=();': ()
311314
!3..4 'a': ()
312315
!5..7 '()': ()
@@ -335,16 +338,16 @@ fn recurisve_macro_expanded_in_stmts() {
335338
}
336339
"#,
337340
expect![[r#"
338-
!0..7 'leta=3;': {unknown}
339-
!0..7 'leta=3;': {unknown}
340-
!0..13 'ng!{[leta=3]}': {unknown}
341-
!0..13 'ng!{[leta=]3}': {unknown}
342-
!0..13 'ng!{[leta]=3}': {unknown}
341+
!0..7 'leta=3;': ()
342+
!0..13 'ng!{[leta=3]}': ()
343+
!0..13 'ng!{[leta=]3}': ()
344+
!0..13 'ng!{[leta]=3}': ()
345+
!0..13 'ng!{[let]a=3}': ()
343346
!3..4 'a': i32
344347
!5..6 '3': i32
345348
196..237 '{ ...= a; }': ()
346-
229..230 'b': i32
347-
233..234 'a': i32
349+
229..230 'b': {unknown}
350+
233..234 'a': {unknown}
348351
"#]],
349352
);
350353
}
@@ -364,8 +367,8 @@ fn recursive_inner_item_macro_rules() {
364367
"#,
365368
expect![[r#"
366369
!0..1 '1': i32
367-
!0..26 'macro_...>{1};}': {unknown}
368-
!0..26 'macro_...>{1};}': {unknown}
370+
!0..7 'mac!($)': ()
371+
!0..26 'macro_...>{1};}': ()
369372
107..143 '{ ...!(); }': ()
370373
129..130 'a': i32
371374
"#]],

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ fn issue_6811() {
573573
}
574574
"#,
575575
expect![[r#"
576+
!0..16 'let_a=...t_b=1;': ()
576577
!3..5 '_a': i32
577578
!6..7 '1': i32
578579
!11..13 '_b': i32
@@ -1012,17 +1013,17 @@ fn cfg_tail() {
10121013
"#,
10131014
expect![[r#"
10141015
14..53 '{ ...)] 9 }': ()
1015-
20..31 '{ "first" }': ()
1016+
20..31 '{ "first" }': &str
10161017
22..29 '"first"': &str
10171018
72..190 '{ ...] 13 }': ()
10181019
78..88 '{ "fake" }': &str
10191020
80..86 '"fake"': &str
10201021
93..103 '{ "fake" }': &str
10211022
95..101 '"fake"': &str
1022-
108..120 '{ "second" }': ()
1023+
108..120 '{ "second" }': &str
10231024
110..118 '"second"': &str
10241025
210..273 '{ ... 15; }': ()
1025-
216..227 '{ "third" }': ()
1026+
216..227 '{ "third" }': &str
10261027
218..225 '"third"': &str
10271028
293..357 '{ ...] 15 }': ()
10281029
299..311 '{ "fourth" }': &str

0 commit comments

Comments
 (0)