Update hir-ty test outputs

This commit is contained in:
Lukas Wirth 2022-07-01 15:04:58 +02:00
parent 531e152390
commit 9165e3b381
4 changed files with 20 additions and 14 deletions

View File

@ -631,7 +631,6 @@ impl ExprCollector<'_> {
let mac_call = mac.macro_call()?; let mac_call = mac.macro_call()?;
let syntax_ptr = AstPtr::new(expr); let syntax_ptr = AstPtr::new(expr);
let macro_ptr = AstPtr::new(&mac_call); let macro_ptr = AstPtr::new(&mac_call);
// let prev_stmt = self.statements_in_scope.len();
let stmt = self.collect_macro_call( let stmt = self.collect_macro_call(
mac_call, mac_call,
macro_ptr, macro_ptr,

View File

@ -175,6 +175,9 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
scopes.set_scope(expr, *scope); scopes.set_scope(expr, *scope);
match &body[expr] { match &body[expr] {
Expr::MacroStmts { statements, tail } => {
compute_block_scopes(statements, *tail, body, scopes, *scope);
}
Expr::Block { statements, tail, id, label } => { Expr::Block { statements, tail, id, label } => {
let scope = scopes.new_block_scope(*scope, *id, make_label(label)); let scope = scopes.new_block_scope(*scope, *id, make_label(label));
// Overwrite the old scope for the block expr, so that every block scope can be found // Overwrite the old scope for the block expr, so that every block scope can be found

View File

@ -191,6 +191,8 @@ fn expr_macro_def_expanded_in_various_places() {
!0..6 '1isize': isize !0..6 '1isize': isize
!0..6 '1isize': isize !0..6 '1isize': isize
!0..6 '1isize': isize !0..6 '1isize': isize
!0..6 '1isize': isize
!0..6 '1isize': isize
39..442 '{ ...!(); }': () 39..442 '{ ...!(); }': ()
73..94 'spam!(...am!())': {unknown} 73..94 'spam!(...am!())': {unknown}
100..119 'for _ ...!() {}': () 100..119 'for _ ...!() {}': ()
@ -272,6 +274,8 @@ fn expr_macro_rules_expanded_in_various_places() {
!0..6 '1isize': isize !0..6 '1isize': isize
!0..6 '1isize': isize !0..6 '1isize': isize
!0..6 '1isize': isize !0..6 '1isize': isize
!0..6 '1isize': isize
!0..6 '1isize': isize
53..456 '{ ...!(); }': () 53..456 '{ ...!(); }': ()
87..108 'spam!(...am!())': {unknown} 87..108 'spam!(...am!())': {unknown}
114..133 'for _ ...!() {}': () 114..133 'for _ ...!() {}': ()
@ -306,7 +310,6 @@ fn expr_macro_expanded_in_stmts() {
} }
"#, "#,
expect![[r#" expect![[r#"
!0..8 'leta=();': ()
!0..8 'leta=();': () !0..8 'leta=();': ()
!3..4 'a': () !3..4 'a': ()
!5..7 '()': () !5..7 '()': ()
@ -335,16 +338,16 @@ fn recurisve_macro_expanded_in_stmts() {
} }
"#, "#,
expect![[r#" expect![[r#"
!0..7 'leta=3;': {unknown} !0..7 'leta=3;': ()
!0..7 'leta=3;': {unknown} !0..13 'ng!{[leta=3]}': ()
!0..13 'ng!{[leta=3]}': {unknown} !0..13 'ng!{[leta=]3}': ()
!0..13 'ng!{[leta=]3}': {unknown} !0..13 'ng!{[leta]=3}': ()
!0..13 'ng!{[leta]=3}': {unknown} !0..13 'ng!{[let]a=3}': ()
!3..4 'a': i32 !3..4 'a': i32
!5..6 '3': i32 !5..6 '3': i32
196..237 '{ ...= a; }': () 196..237 '{ ...= a; }': ()
229..230 'b': i32 229..230 'b': {unknown}
233..234 'a': i32 233..234 'a': {unknown}
"#]], "#]],
); );
} }
@ -364,8 +367,8 @@ fn recursive_inner_item_macro_rules() {
"#, "#,
expect![[r#" expect![[r#"
!0..1 '1': i32 !0..1 '1': i32
!0..26 'macro_...>{1};}': {unknown} !0..7 'mac!($)': ()
!0..26 'macro_...>{1};}': {unknown} !0..26 'macro_...>{1};}': ()
107..143 '{ ...!(); }': () 107..143 '{ ...!(); }': ()
129..130 'a': i32 129..130 'a': i32
"#]], "#]],

View File

@ -573,6 +573,7 @@ fn issue_6811() {
} }
"#, "#,
expect![[r#" expect![[r#"
!0..16 'let_a=...t_b=1;': ()
!3..5 '_a': i32 !3..5 '_a': i32
!6..7 '1': i32 !6..7 '1': i32
!11..13 '_b': i32 !11..13 '_b': i32
@ -1012,17 +1013,17 @@ fn cfg_tail() {
"#, "#,
expect![[r#" expect![[r#"
14..53 '{ ...)] 9 }': () 14..53 '{ ...)] 9 }': ()
20..31 '{ "first" }': () 20..31 '{ "first" }': &str
22..29 '"first"': &str 22..29 '"first"': &str
72..190 '{ ...] 13 }': () 72..190 '{ ...] 13 }': ()
78..88 '{ "fake" }': &str 78..88 '{ "fake" }': &str
80..86 '"fake"': &str 80..86 '"fake"': &str
93..103 '{ "fake" }': &str 93..103 '{ "fake" }': &str
95..101 '"fake"': &str 95..101 '"fake"': &str
108..120 '{ "second" }': () 108..120 '{ "second" }': &str
110..118 '"second"': &str 110..118 '"second"': &str
210..273 '{ ... 15; }': () 210..273 '{ ... 15; }': ()
216..227 '{ "third" }': () 216..227 '{ "third" }': &str
218..225 '"third"': &str 218..225 '"third"': &str
293..357 '{ ...] 15 }': () 293..357 '{ ...] 15 }': ()
299..311 '{ "fourth" }': &str 299..311 '{ "fourth" }': &str