Skip to content

Commit e68df02

Browse files
committed
syntax::print -> new crate rustc_ast_pretty
1 parent 6a6f419 commit e68df02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+129
-81
lines changed

Cargo.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,7 @@ dependencies = [
30913091
"rustc-rayon",
30923092
"rustc-rayon-core",
30933093
"rustc_apfloat",
3094+
"rustc_ast_pretty",
30943095
"rustc_attr",
30953096
"rustc_data_structures",
30963097
"rustc_error_codes",
@@ -3358,6 +3359,7 @@ version = "0.0.0"
33583359
dependencies = [
33593360
"log",
33603361
"rustc",
3362+
"rustc_ast_pretty",
33613363
"rustc_data_structures",
33623364
"rustc_error_codes",
33633365
"rustc_errors",
@@ -3375,6 +3377,7 @@ name = "rustc_ast_passes"
33753377
version = "0.0.0"
33763378
dependencies = [
33773379
"log",
3380+
"rustc_ast_pretty",
33783381
"rustc_attr",
33793382
"rustc_data_structures",
33803383
"rustc_error_codes",
@@ -3386,10 +3389,21 @@ dependencies = [
33863389
"syntax",
33873390
]
33883391

3392+
[[package]]
3393+
name = "rustc_ast_pretty"
3394+
version = "0.0.0"
3395+
dependencies = [
3396+
"log",
3397+
"rustc_data_structures",
3398+
"rustc_span",
3399+
"syntax",
3400+
]
3401+
33893402
[[package]]
33903403
name = "rustc_attr"
33913404
version = "0.0.0"
33923405
dependencies = [
3406+
"rustc_ast_pretty",
33933407
"rustc_data_structures",
33943408
"rustc_error_codes",
33953409
"rustc_errors",
@@ -3408,6 +3422,7 @@ version = "0.0.0"
34083422
dependencies = [
34093423
"fmt_macros",
34103424
"log",
3425+
"rustc_ast_pretty",
34113426
"rustc_attr",
34123427
"rustc_data_structures",
34133428
"rustc_error_codes",
@@ -3529,6 +3544,7 @@ dependencies = [
35293544
"lazy_static 1.3.0",
35303545
"log",
35313546
"rustc",
3547+
"rustc_ast_pretty",
35323548
"rustc_codegen_utils",
35333549
"rustc_data_structures",
35343550
"rustc_error_codes",
@@ -3575,6 +3591,7 @@ version = "0.0.0"
35753591
dependencies = [
35763592
"log",
35773593
"rustc_ast_passes",
3594+
"rustc_ast_pretty",
35783595
"rustc_attr",
35793596
"rustc_data_structures",
35803597
"rustc_errors",
@@ -3605,6 +3622,7 @@ version = "0.0.0"
36053622
name = "rustc_hir"
36063623
version = "0.0.0"
36073624
dependencies = [
3625+
"rustc_ast_pretty",
36083626
"rustc_data_structures",
36093627
"rustc_errors",
36103628
"rustc_index",
@@ -3696,6 +3714,7 @@ version = "0.0.0"
36963714
dependencies = [
36973715
"log",
36983716
"rustc",
3717+
"rustc_ast_pretty",
36993718
"rustc_attr",
37003719
"rustc_data_structures",
37013720
"rustc_error_codes",
@@ -3738,6 +3757,7 @@ dependencies = [
37383757
"log",
37393758
"memmap",
37403759
"rustc",
3760+
"rustc_ast_pretty",
37413761
"rustc_attr",
37423762
"rustc_data_structures",
37433763
"rustc_error_codes",
@@ -3767,6 +3787,7 @@ dependencies = [
37673787
"polonius-engine",
37683788
"rustc",
37693789
"rustc_apfloat",
3790+
"rustc_ast_pretty",
37703791
"rustc_attr",
37713792
"rustc_data_structures",
37723793
"rustc_error_codes",
@@ -3811,6 +3832,7 @@ version = "0.0.0"
38113832
dependencies = [
38123833
"bitflags",
38133834
"log",
3835+
"rustc_ast_pretty",
38143836
"rustc_attr",
38153837
"rustc_data_structures",
38163838
"rustc_error_codes",
@@ -3882,6 +3904,7 @@ dependencies = [
38823904
"log",
38833905
"rustc",
38843906
"rustc_ast_lowering",
3907+
"rustc_ast_pretty",
38853908
"rustc_attr",
38863909
"rustc_data_structures",
38873910
"rustc_error_codes",
@@ -3904,6 +3927,7 @@ dependencies = [
39043927
"rls-data",
39053928
"rls-span",
39063929
"rustc",
3930+
"rustc_ast_pretty",
39073931
"rustc_codegen_utils",
39083932
"rustc_data_structures",
39093933
"rustc_hir",

src/librustc/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ rustc-rayon = "0.3.0"
2121
rustc-rayon-core = "0.3.0"
2222
polonius-engine = "0.11.0"
2323
rustc_apfloat = { path = "../librustc_apfloat" }
24+
# FIXME(Centril): remove this dependency when stuff is moved to rustc_lint.
25+
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
2426
rustc_attr = { path = "../librustc_attr" }
2527
rustc_feature = { path = "../librustc_feature" }
2628
rustc_hir = { path = "../librustc_hir" }

src/librustc_ast_lowering/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ doctest = false
1212
[dependencies]
1313
log = { version = "0.4", features = ["release_max_level_info", "std"] }
1414
rustc = { path = "../librustc" }
15+
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
1516
rustc_hir = { path = "../librustc_hir" }
1617
rustc_target = { path = "../librustc_target" }
1718
rustc_data_structures = { path = "../librustc_data_structures" }

src/librustc_ast_lowering/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use rustc::dep_graph::DepGraph;
3838
use rustc::hir::map::definitions::{DefKey, DefPathData, Definitions};
3939
use rustc::hir::map::Map;
4040
use rustc::{bug, span_bug};
41+
use rustc_ast_pretty::pprust;
4142
use rustc_data_structures::captures::Captures;
4243
use rustc_data_structures::fx::FxHashSet;
4344
use rustc_data_structures::sync::Lrc;
@@ -61,7 +62,6 @@ use syntax::ast;
6162
use syntax::ast::*;
6263
use syntax::attr;
6364
use syntax::node_id::NodeMap;
64-
use syntax::print::pprust;
6565
use syntax::token::{self, Nonterminal, Token};
6666
use syntax::tokenstream::{TokenStream, TokenTree};
6767
use syntax::visit::{self, Visitor};

src/librustc_ast_passes/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ path = "lib.rs"
1010

1111
[dependencies]
1212
log = "0.4"
13+
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
1314
rustc_attr = { path = "../librustc_attr" }
1415
rustc_data_structures = { path = "../librustc_data_structures" }
1516
rustc_errors = { path = "../librustc_errors" }

src/librustc_ast_passes/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// This pass is supposed to perform only simple checks not requiring name resolution
77
// or type checking or some other kind of complex analysis.
88

9+
use rustc_ast_pretty::pprust;
910
use rustc_data_structures::fx::FxHashMap;
1011
use rustc_errors::{struct_span_err, Applicability, FatalError};
1112
use rustc_parse::validate_attr;
@@ -19,7 +20,6 @@ use std::mem;
1920
use syntax::ast::*;
2021
use syntax::attr;
2122
use syntax::expand::is_proc_macro_attr;
22-
use syntax::print::pprust;
2323
use syntax::visit::{self, Visitor};
2424
use syntax::walk_list;
2525

src/librustc_ast_pretty/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
authors = ["The Rust Project Developers"]
3+
name = "rustc_ast_pretty"
4+
version = "0.0.0"
5+
edition = "2018"
6+
7+
[lib]
8+
name = "rustc_ast_pretty"
9+
path = "lib.rs"
10+
doctest = false
11+
12+
[dependencies]
13+
log = "0.4"
14+
rustc_span = { path = "../librustc_span" }
15+
rustc_data_structures = { path = "../librustc_data_structures" }
16+
syntax = { path = "../libsyntax" }

src/libsyntax/print/helpers.rs renamed to src/librustc_ast_pretty/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::print::pp::Printer;
1+
use crate::pp::Printer;
22
use std::borrow::Cow;
33

44
impl Printer {

src/librustc_ast_pretty/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(bool_to_option)]
2+
#![feature(crate_visibility_modifier)]
3+
4+
mod helpers;
5+
pub mod pp;
6+
pub mod pprust;
File renamed without changes.

0 commit comments

Comments
 (0)