Skip to content

Commit 67a18c6

Browse files
committed
syntax::print -> new crate rustc_ast_pretty
1 parent 294c323 commit 67a18c6

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_errors",
@@ -3357,6 +3358,7 @@ version = "0.0.0"
33573358
dependencies = [
33583359
"log",
33593360
"rustc",
3361+
"rustc_ast_pretty",
33603362
"rustc_data_structures",
33613363
"rustc_errors",
33623364
"rustc_hir",
@@ -3373,6 +3375,7 @@ name = "rustc_ast_passes"
33733375
version = "0.0.0"
33743376
dependencies = [
33753377
"log",
3378+
"rustc_ast_pretty",
33763379
"rustc_attr",
33773380
"rustc_data_structures",
33783381
"rustc_errors",
@@ -3383,10 +3386,21 @@ dependencies = [
33833386
"syntax",
33843387
]
33853388

3389+
[[package]]
3390+
name = "rustc_ast_pretty"
3391+
version = "0.0.0"
3392+
dependencies = [
3393+
"log",
3394+
"rustc_data_structures",
3395+
"rustc_span",
3396+
"syntax",
3397+
]
3398+
33863399
[[package]]
33873400
name = "rustc_attr"
33883401
version = "0.0.0"
33893402
dependencies = [
3403+
"rustc_ast_pretty",
33903404
"rustc_data_structures",
33913405
"rustc_errors",
33923406
"rustc_feature",
@@ -3404,6 +3418,7 @@ version = "0.0.0"
34043418
dependencies = [
34053419
"fmt_macros",
34063420
"log",
3421+
"rustc_ast_pretty",
34073422
"rustc_attr",
34083423
"rustc_data_structures",
34093424
"rustc_errors",
@@ -3523,6 +3538,7 @@ dependencies = [
35233538
"lazy_static 1.3.0",
35243539
"log",
35253540
"rustc",
3541+
"rustc_ast_pretty",
35263542
"rustc_codegen_utils",
35273543
"rustc_data_structures",
35283544
"rustc_error_codes",
@@ -3569,6 +3585,7 @@ version = "0.0.0"
35693585
dependencies = [
35703586
"log",
35713587
"rustc_ast_passes",
3588+
"rustc_ast_pretty",
35723589
"rustc_attr",
35733590
"rustc_data_structures",
35743591
"rustc_errors",
@@ -3599,6 +3616,7 @@ version = "0.0.0"
35993616
name = "rustc_hir"
36003617
version = "0.0.0"
36013618
dependencies = [
3619+
"rustc_ast_pretty",
36023620
"rustc_data_structures",
36033621
"rustc_errors",
36043622
"rustc_index",
@@ -3690,6 +3708,7 @@ version = "0.0.0"
36903708
dependencies = [
36913709
"log",
36923710
"rustc",
3711+
"rustc_ast_pretty",
36933712
"rustc_attr",
36943713
"rustc_data_structures",
36953714
"rustc_errors",
@@ -3731,6 +3750,7 @@ dependencies = [
37313750
"log",
37323751
"memmap",
37333752
"rustc",
3753+
"rustc_ast_pretty",
37343754
"rustc_attr",
37353755
"rustc_data_structures",
37363756
"rustc_errors",
@@ -3759,6 +3779,7 @@ dependencies = [
37593779
"polonius-engine",
37603780
"rustc",
37613781
"rustc_apfloat",
3782+
"rustc_ast_pretty",
37623783
"rustc_attr",
37633784
"rustc_data_structures",
37643785
"rustc_errors",
@@ -3802,6 +3823,7 @@ version = "0.0.0"
38023823
dependencies = [
38033824
"bitflags",
38043825
"log",
3826+
"rustc_ast_pretty",
38053827
"rustc_attr",
38063828
"rustc_data_structures",
38073829
"rustc_errors",
@@ -3869,6 +3891,7 @@ dependencies = [
38693891
"log",
38703892
"rustc",
38713893
"rustc_ast_lowering",
3894+
"rustc_ast_pretty",
38723895
"rustc_attr",
38733896
"rustc_data_structures",
38743897
"rustc_errors",
@@ -3890,6 +3913,7 @@ dependencies = [
38903913
"rls-data",
38913914
"rls-span",
38923915
"rustc",
3916+
"rustc_ast_pretty",
38933917
"rustc_codegen_utils",
38943918
"rustc_data_structures",
38953919
"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)