fix: column!()
and line!()
built-in macros return u32
This commit is contained in:
parent
a0a7860141
commit
34a9129333
@ -13,12 +13,12 @@ macro_rules! column {() => {}}
|
||||
|
||||
fn main() { column!(); }
|
||||
"#,
|
||||
expect![[r##"
|
||||
expect![[r#"
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! column {() => {}}
|
||||
|
||||
fn main() { 0; }
|
||||
"##]],
|
||||
fn main() { 0 as u32; }
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
@ -31,12 +31,12 @@ macro_rules! line {() => {}}
|
||||
|
||||
fn main() { line!() }
|
||||
"#,
|
||||
expect![[r##"
|
||||
expect![[r#"
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! line {() => {}}
|
||||
|
||||
fn main() { 0 }
|
||||
"##]],
|
||||
fn main() { 0 as u32 }
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -280,6 +280,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode, map: Option<&TokenMap>) -> Str
|
||||
let curr_kind = token.kind();
|
||||
let space = match (prev_kind, curr_kind) {
|
||||
_ if prev_kind.is_trivia() || curr_kind.is_trivia() => "",
|
||||
_ if prev_kind.is_literal() && !curr_kind.is_punct() => " ",
|
||||
(T!['{'], T!['}']) => "",
|
||||
(T![=], _) | (_, T![=]) => " ",
|
||||
(_, T!['{']) => " ",
|
||||
|
@ -135,9 +135,8 @@ fn line_expand(
|
||||
_tt: &tt::Subtree,
|
||||
) -> ExpandResult<tt::Subtree> {
|
||||
// dummy implementation for type-checking purposes
|
||||
let line_num = 0;
|
||||
let expanded = quote! {
|
||||
#line_num
|
||||
0 as u32
|
||||
};
|
||||
|
||||
ExpandResult::ok(expanded)
|
||||
@ -179,9 +178,8 @@ fn column_expand(
|
||||
_tt: &tt::Subtree,
|
||||
) -> ExpandResult<tt::Subtree> {
|
||||
// dummy implementation for type-checking purposes
|
||||
let col_num = 0;
|
||||
let expanded = quote! {
|
||||
#col_num
|
||||
0 as u32
|
||||
};
|
||||
|
||||
ExpandResult::ok(expanded)
|
||||
|
@ -661,8 +661,9 @@ fn main() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
!0..1 '0': i32
|
||||
!0..6 '0asu32': u32
|
||||
63..87 '{ ...!(); }': ()
|
||||
73..74 'x': i32
|
||||
73..74 'x': u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -699,8 +700,9 @@ fn main() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
!0..1 '0': i32
|
||||
!0..6 '0asu32': u32
|
||||
65..91 '{ ...!(); }': ()
|
||||
75..76 'x': i32
|
||||
75..76 'x': u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user