mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-24 00:10:15 +00:00
Rustc syntax crate has been renamed to rustc_ast
This commit is contained in:
parent
d9cb189070
commit
e1c8908603
@ -1,15 +1,11 @@
|
||||
extern crate rustc_ast;
|
||||
extern crate rustc_data_structures;
|
||||
extern crate rustc_span;
|
||||
extern crate rustc_target;
|
||||
extern crate syntax;
|
||||
|
||||
use std::mem;
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{sym, Span, Symbol, SyntaxContext, DUMMY_SP};
|
||||
use syntax::ast::{
|
||||
use rustc_ast::ast::{
|
||||
AngleBracketedArgs, AnonConst, Arm, AsmDialect, AssocItemKind, AssocTyConstraint,
|
||||
AssocTyConstraintKind, Async, AttrId, AttrItem, AttrKind, AttrStyle, Attribute, BareFnTy,
|
||||
BinOpKind, BindingMode, Block, BlockCheckMode, BorrowKind, CaptureBy, Const, Crate, CrateSugar,
|
||||
@ -24,10 +20,14 @@ use syntax::ast::{
|
||||
UseTreeKind, Variant, VariantData, VisibilityKind, WhereBoundPredicate, WhereClause,
|
||||
WhereEqPredicate, WherePredicate, WhereRegionPredicate,
|
||||
};
|
||||
use syntax::ptr::P;
|
||||
use syntax::token::{self, DelimToken, Token, TokenKind};
|
||||
use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree};
|
||||
use syntax::util::comments;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, DelimToken, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
|
||||
use rustc_ast::util::comments;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{sym, Span, Symbol, SyntaxContext, DUMMY_SP};
|
||||
|
||||
pub trait SpanlessEq {
|
||||
fn eq(&self, other: &Self) -> bool;
|
||||
|
@ -1,14 +1,14 @@
|
||||
extern crate rustc_ast;
|
||||
extern crate rustc_expand;
|
||||
extern crate rustc_parse as parse;
|
||||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
extern crate syntax;
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use rustc_span::FileName;
|
||||
use syntax::ast;
|
||||
use syntax::ptr::P;
|
||||
|
||||
use std::panic;
|
||||
|
||||
|
@ -14,18 +14,18 @@
|
||||
//! spans.
|
||||
//! 5. Compare the expressions with one another, if they are not equal fail.
|
||||
|
||||
extern crate rustc_ast;
|
||||
extern crate rustc_data_structures;
|
||||
extern crate rustc_span;
|
||||
extern crate syntax;
|
||||
|
||||
mod features;
|
||||
|
||||
use quote::quote;
|
||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||
use regex::Regex;
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_span::edition::Edition;
|
||||
use syntax::ast;
|
||||
use syntax::ptr::P;
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
|
||||
use std::fs::File;
|
||||
@ -165,7 +165,7 @@ fn test_expressions(exprs: Vec<syn::Expr>) -> (usize, usize) {
|
||||
let mut passed = 0;
|
||||
let mut failed = 0;
|
||||
|
||||
syntax::with_globals(Edition::Edition2018, || {
|
||||
rustc_ast::with_globals(Edition::Edition2018, || {
|
||||
for expr in exprs {
|
||||
let raw = quote!(#expr).to_string();
|
||||
|
||||
@ -208,12 +208,12 @@ fn libsyntax_parse_and_rewrite(input: &str) -> Option<P<ast::Expr>> {
|
||||
///
|
||||
/// This method operates on libsyntax objects.
|
||||
fn libsyntax_brackets(mut libsyntax_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
|
||||
use rustc_ast::ast::{Block, BorrowKind, Expr, ExprKind, Field, Mac, Pat, Stmt, StmtKind, Ty};
|
||||
use rustc_ast::mut_visit::MutVisitor;
|
||||
use rustc_ast::util::map_in_place::MapInPlace;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_span::DUMMY_SP;
|
||||
use std::mem;
|
||||
use syntax::ast::{Block, BorrowKind, Expr, ExprKind, Field, Mac, Pat, Stmt, StmtKind, Ty};
|
||||
use syntax::mut_visit::MutVisitor;
|
||||
use syntax::util::map_in_place::MapInPlace;
|
||||
|
||||
struct BracketsVisitor {
|
||||
failed: bool,
|
||||
@ -246,7 +246,7 @@ fn libsyntax_brackets(mut libsyntax_expr: P<ast::Expr>) -> Option<P<ast::Expr>>
|
||||
}
|
||||
|
||||
fn noop_visit_expr<T: MutVisitor>(e: &mut Expr, vis: &mut T) {
|
||||
use syntax::mut_visit::{noop_visit_expr, visit_opt, visit_thin_attrs};
|
||||
use rustc_ast::mut_visit::{noop_visit_expr, visit_opt, visit_thin_attrs};
|
||||
match &mut e.kind {
|
||||
ExprKind::AddrOf(BorrowKind::Raw, ..) => {}
|
||||
ExprKind::Struct(path, fields, expr) => {
|
||||
|
@ -2,23 +2,23 @@
|
||||
#![recursion_limit = "1024"]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
extern crate rustc_ast;
|
||||
extern crate rustc_errors;
|
||||
extern crate rustc_expand;
|
||||
extern crate rustc_parse as parse;
|
||||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
extern crate syntax;
|
||||
|
||||
mod features;
|
||||
|
||||
use quote::quote;
|
||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||
use rustc_ast::ast;
|
||||
use rustc_errors::PResult;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use rustc_span::FileName;
|
||||
use syntax::ast;
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
|
||||
use std::fs::File;
|
||||
@ -80,7 +80,7 @@ fn test_round_trip() {
|
||||
let back = quote!(#krate).to_string();
|
||||
|
||||
let equal = panic::catch_unwind(|| {
|
||||
syntax::with_globals(Edition::Edition2018, || {
|
||||
rustc_ast::with_globals(Edition::Edition2018, || {
|
||||
let sess = ParseSess::new(FilePathMapping::empty());
|
||||
let before = match libsyntax_parse(content, &sess) {
|
||||
Ok(before) => before,
|
||||
|
Loading…
Reference in New Issue
Block a user