Complete desugared and resugared async fn in trait impls

This commit is contained in:
Lukas Wirth 2024-09-01 11:04:45 +02:00
parent 18feb726be
commit eb64cc8c35
5 changed files with 267 additions and 87 deletions

View file

@ -1162,7 +1162,7 @@ pub mod tokens {
pub(super) static SOURCE_FILE: LazyLock<Parse<SourceFile>> = LazyLock::new(|| {
SourceFile::parse(
"const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, { let _ @ [] })\n;\n\nimpl A for B where: {}", Edition::CURRENT,
"const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, async { let _ @ [] })\n;\n\nimpl A for B where: {}", Edition::CURRENT,
)
});

View file

@ -147,6 +147,11 @@ pub fn append_child_raw(node: &(impl Into<SyntaxNode> + Clone), child: impl Elem
insert_raw(position, child);
}
pub fn prepend_child(node: &(impl Into<SyntaxNode> + Clone), child: impl Element) {
let position = Position::first_child_of(node);
insert(position, child);
}
fn ws_before(position: &Position, new: &SyntaxElement) -> Option<SyntaxToken> {
let prev = match &position.repr {
PositionRepr::FirstChild(_) => return None,