Skip to content

Commit e233331

Browse files
committed
syntax::print -> new crate rustc_ast_pretty
1 parent 98fd6a5 commit e233331

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
@@ -3093,6 +3093,7 @@ dependencies = [
30933093
"rustc-rayon",
30943094
"rustc-rayon-core",
30953095
"rustc_apfloat",
3096+
"rustc_ast_pretty",
30963097
"rustc_attr",
30973098
"rustc_data_structures",
30983099
"rustc_errors",
@@ -3359,6 +3360,7 @@ version = "0.0.0"
33593360
dependencies = [
33603361
"log",
33613362
"rustc",
3363+
"rustc_ast_pretty",
33623364
"rustc_data_structures",
33633365
"rustc_errors",
33643366
"rustc_hir",
@@ -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_errors",
@@ -3385,10 +3388,21 @@ dependencies = [
33853388
"syntax",
33863389
]
33873390

3391+
[[package]]
3392+
name = "rustc_ast_pretty"
3393+
version = "0.0.0"
3394+
dependencies = [
3395+
"log",
3396+
"rustc_data_structures",
3397+
"rustc_span",
3398+
"syntax",
3399+
]
3400+
33883401
[[package]]
33893402
name = "rustc_attr"
33903403
version = "0.0.0"
33913404
dependencies = [
3405+
"rustc_ast_pretty",
33923406
"rustc_data_structures",
33933407
"rustc_errors",
33943408
"rustc_feature",
@@ -3406,6 +3420,7 @@ version = "0.0.0"
34063420
dependencies = [
34073421
"fmt_macros",
34083422
"log",
3423+
"rustc_ast_pretty",
34093424
"rustc_attr",
34103425
"rustc_data_structures",
34113426
"rustc_errors",
@@ -3526,6 +3541,7 @@ dependencies = [
35263541
"lazy_static 1.4.0",
35273542
"log",
35283543
"rustc",
3544+
"rustc_ast_pretty",
35293545
"rustc_codegen_utils",
35303546
"rustc_data_structures",
35313547
"rustc_error_codes",
@@ -3572,6 +3588,7 @@ version = "0.0.0"
35723588
dependencies = [
35733589
"log",
35743590
"rustc_ast_passes",
3591+
"rustc_ast_pretty",
35753592
"rustc_attr",
35763593
"rustc_data_structures",
35773594
"rustc_errors",
@@ -3602,6 +3619,7 @@ version = "0.0.0"
36023619
name = "rustc_hir"
36033620
version = "0.0.0"
36043621
dependencies = [
3622+
"rustc_ast_pretty",
36053623
"rustc_data_structures",
36063624
"rustc_errors",
36073625
"rustc_index",
@@ -3693,6 +3711,7 @@ version = "0.0.0"
36933711
dependencies = [
36943712
"log",
36953713
"rustc",
3714+
"rustc_ast_pretty",
36963715
"rustc_attr",
36973716
"rustc_data_structures",
36983717
"rustc_errors",
@@ -3734,6 +3753,7 @@ dependencies = [
37343753
"log",
37353754
"memmap",
37363755
"rustc",
3756+
"rustc_ast_pretty",
37373757
"rustc_attr",
37383758
"rustc_data_structures",
37393759
"rustc_errors",
@@ -3762,6 +3782,7 @@ dependencies = [
37623782
"polonius-engine",
37633783
"rustc",
37643784
"rustc_apfloat",
3785+
"rustc_ast_pretty",
37653786
"rustc_attr",
37663787
"rustc_data_structures",
37673788
"rustc_errors",
@@ -3805,6 +3826,7 @@ version = "0.0.0"
38053826
dependencies = [
38063827
"bitflags",
38073828
"log",
3829+
"rustc_ast_pretty",
38083830
"rustc_attr",
38093831
"rustc_data_structures",
38103832
"rustc_errors",
@@ -3872,6 +3894,7 @@ dependencies = [
38723894
"log",
38733895
"rustc",
38743896
"rustc_ast_lowering",
3897+
"rustc_ast_pretty",
38753898
"rustc_attr",
38763899
"rustc_data_structures",
38773900
"rustc_errors",
@@ -3893,6 +3916,7 @@ dependencies = [
38933916
"rls-data",
38943917
"rls-span",
38953918
"rustc",
3919+
"rustc_ast_pretty",
38963920
"rustc_codegen_utils",
38973921
"rustc_data_structures",
38983922
"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;
@@ -60,7 +61,6 @@ use syntax::ast;
6061
use syntax::ast::*;
6162
use syntax::attr;
6263
use syntax::node_id::NodeMap;
63-
use syntax::print::pprust;
6464
use syntax::token::{self, Nonterminal, Token};
6565
use syntax::tokenstream::{TokenStream, TokenTree};
6666
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)