mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
move ty
This commit is contained in:
parent
5636bef2ec
commit
04ae18de29
3 changed files with 12 additions and 4 deletions
|
@ -692,7 +692,11 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen
|
||||||
let fragment = match kind {
|
let fragment = match kind {
|
||||||
"path" => ParserEntryPoint::Path,
|
"path" => ParserEntryPoint::Path,
|
||||||
"expr" => ParserEntryPoint::Expr,
|
"expr" => ParserEntryPoint::Expr,
|
||||||
"ty" => ParserEntryPoint::Type,
|
"ty" => {
|
||||||
|
return input
|
||||||
|
.expect_fragment2(parser::PrefixEntryPoint::Ty)
|
||||||
|
.map(|tt| tt.map(Fragment::Tokens));
|
||||||
|
}
|
||||||
// FIXME: These two should actually behave differently depending on the edition.
|
// FIXME: These two should actually behave differently depending on the edition.
|
||||||
//
|
//
|
||||||
// https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html
|
// https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html
|
||||||
|
|
|
@ -65,6 +65,10 @@ pub(crate) mod entry {
|
||||||
pub(crate) fn pat(p: &mut Parser) {
|
pub(crate) fn pat(p: &mut Parser) {
|
||||||
patterns::pattern_single(p);
|
patterns::pattern_single(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn ty(p: &mut Parser) {
|
||||||
|
types::type_(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +84,6 @@ pub(crate) mod entry_points {
|
||||||
|
|
||||||
pub(crate) use paths::type_path as path;
|
pub(crate) use paths::type_path as path;
|
||||||
|
|
||||||
pub(crate) use types::type_;
|
|
||||||
|
|
||||||
pub(crate) fn expr(p: &mut Parser) {
|
pub(crate) fn expr(p: &mut Parser) {
|
||||||
let _ = expressions::expr(p);
|
let _ = expressions::expr(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ pub enum PrefixEntryPoint {
|
||||||
Block,
|
Block,
|
||||||
Stmt,
|
Stmt,
|
||||||
Pat,
|
Pat,
|
||||||
|
Ty,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrefixEntryPoint {
|
impl PrefixEntryPoint {
|
||||||
|
@ -65,6 +66,7 @@ impl PrefixEntryPoint {
|
||||||
PrefixEntryPoint::Block => grammar::entry::prefix::block,
|
PrefixEntryPoint::Block => grammar::entry::prefix::block,
|
||||||
PrefixEntryPoint::Stmt => grammar::entry::prefix::stmt,
|
PrefixEntryPoint::Stmt => grammar::entry::prefix::stmt,
|
||||||
PrefixEntryPoint::Pat => grammar::entry::prefix::pat,
|
PrefixEntryPoint::Pat => grammar::entry::prefix::pat,
|
||||||
|
PrefixEntryPoint::Ty => grammar::entry::prefix::ty,
|
||||||
};
|
};
|
||||||
let mut p = parser::Parser::new(input);
|
let mut p = parser::Parser::new(input);
|
||||||
entry_point(&mut p);
|
entry_point(&mut p);
|
||||||
|
@ -110,7 +112,7 @@ pub fn parse(inp: &Input, entry_point: ParserEntryPoint) -> Output {
|
||||||
ParserEntryPoint::SourceFile => grammar::entry_points::source_file,
|
ParserEntryPoint::SourceFile => grammar::entry_points::source_file,
|
||||||
ParserEntryPoint::Path => grammar::entry_points::path,
|
ParserEntryPoint::Path => grammar::entry_points::path,
|
||||||
ParserEntryPoint::Expr => grammar::entry_points::expr,
|
ParserEntryPoint::Expr => grammar::entry_points::expr,
|
||||||
ParserEntryPoint::Type => grammar::entry_points::type_,
|
ParserEntryPoint::Type => grammar::entry::prefix::ty,
|
||||||
ParserEntryPoint::Pattern => grammar::entry::prefix::pat,
|
ParserEntryPoint::Pattern => grammar::entry::prefix::pat,
|
||||||
ParserEntryPoint::Item => grammar::entry_points::item,
|
ParserEntryPoint::Item => grammar::entry_points::item,
|
||||||
ParserEntryPoint::MetaItem => grammar::entry_points::meta_item,
|
ParserEntryPoint::MetaItem => grammar::entry_points::meta_item,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue