mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
Reverse fixups
This commit is contained in:
parent
79ebf618ec
commit
c3601e9860
@ -76,7 +76,6 @@ fn foo() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn attribute_macro_syntax_completion_2() {
|
fn attribute_macro_syntax_completion_2() {
|
||||||
// common case of dot completion while typing
|
// common case of dot completion while typing
|
||||||
// right now not working
|
|
||||||
check(
|
check(
|
||||||
r#"
|
r#"
|
||||||
//- proc_macros: identity_when_valid
|
//- proc_macros: identity_when_valid
|
||||||
@ -88,7 +87,7 @@ fn foo() { bar.; blub }
|
|||||||
fn foo() { bar.; blub }
|
fn foo() { bar.; blub }
|
||||||
|
|
||||||
fn foo() {
|
fn foo() {
|
||||||
bar.;
|
bar. ;
|
||||||
blub
|
blub
|
||||||
}"##]],
|
}"##]],
|
||||||
);
|
);
|
||||||
|
@ -430,7 +430,7 @@ fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<Option<Ar
|
|||||||
// be reported at the definition site (when we construct a def map).
|
// be reported at the definition site (when we construct a def map).
|
||||||
Err(err) => return ExpandResult::str_err(format!("invalid macro definition: {}", err)),
|
Err(err) => return ExpandResult::str_err(format!("invalid macro definition: {}", err)),
|
||||||
};
|
};
|
||||||
let ExpandResult { value: tt, err } = expander.expand(db, id, ¯o_arg.0);
|
let ExpandResult { value: mut tt, err } = expander.expand(db, id, ¯o_arg.0);
|
||||||
// Set a hard limit for the expanded tt
|
// Set a hard limit for the expanded tt
|
||||||
let count = tt.count();
|
let count = tt.count();
|
||||||
// XXX: Make ExpandResult a real error and use .map_err instead?
|
// XXX: Make ExpandResult a real error and use .map_err instead?
|
||||||
@ -442,6 +442,8 @@ fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<Option<Ar
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixup::reverse_fixups(&mut tt);
|
||||||
|
|
||||||
ExpandResult { value: Some(Arc::new(tt)), err }
|
ExpandResult { value: Some(Arc::new(tt)), err }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Conversions between [`SyntaxNode`] and [`tt::TokenTree`].
|
//! Conversions between [`SyntaxNode`] and [`tt::TokenTree`].
|
||||||
|
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
use stdx::{non_empty_vec::NonEmptyVec, always};
|
use stdx::{always, non_empty_vec::NonEmptyVec};
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, make::tokens::doc_comment},
|
ast::{self, make::tokens::doc_comment},
|
||||||
AstToken, Parse, PreorderWithTokens, SmolStr, SyntaxElement, SyntaxKind,
|
AstToken, Parse, PreorderWithTokens, SmolStr, SyntaxElement, SyntaxKind,
|
||||||
|
Loading…
Reference in New Issue
Block a user