Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for parsing with rust-analyzer instead of librustc_parse #70745

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 126 additions & 21 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ dependencies = [
"nodrop",
]

[[package]]
name = "arrayvec"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"

[[package]]
name = "atty"
version = "0.2.11"
Expand Down Expand Up @@ -181,7 +187,7 @@ version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400"
dependencies = [
"arrayvec",
"arrayvec 0.4.7",
"constant_time_eq",
]

Expand Down Expand Up @@ -731,7 +737,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
dependencies = [
"arrayvec",
"arrayvec 0.4.7",
"cfg-if",
"crossbeam-utils 0.6.5",
"lazy_static 1.4.0",
Expand Down Expand Up @@ -948,6 +954,12 @@ dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "drop_bomb"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69b26e475fd29098530e709294e94e661974c851aed42512793f120fed4e199f"

[[package]]
name = "dtoa"
version = "0.4.4"
Expand Down Expand Up @@ -1107,7 +1119,7 @@ dependencies = [
name = "fmt_macros"
version = "0.0.0"
dependencies = [
"rustc_lexer",
"rustc_lexer 0.1.0",
"rustc_span",
]

Expand Down Expand Up @@ -2247,9 +2259,9 @@ dependencies = [

[[package]]
name = "once_cell"
version = "1.1.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6a04cb71e910d0034815600180f62a95bf6e67942d7ab52a166a68c7d7e9cd0"
checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b"

[[package]]
name = "open"
Expand Down Expand Up @@ -2692,6 +2704,37 @@ dependencies = [
"proc-macro2 1.0.3",
]

[[package]]
name = "ra_parser"
version = "0.1.0"
dependencies = [
"drop_bomb",
]

[[package]]
name = "ra_syntax"
version = "0.1.0"
dependencies = [
"arrayvec 0.5.1",
"itertools 0.9.0",
"once_cell",
"ra_parser",
"ra_text_edit",
"rowan",
"rustc-hash",
"rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde",
"smol_str",
"stdx",
]

[[package]]
name = "ra_text_edit"
version = "0.1.0"
dependencies = [
"text_unit",
]

[[package]]
name = "racer"
version = "2.1.31"
Expand Down Expand Up @@ -3120,6 +3163,18 @@ dependencies = [
"rls-span",
]

[[package]]
name = "rowan"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ea7cadf87a9d8432e85cb4eb86bd2e765ace60c24ef86e79084dcae5d1c5a19"
dependencies = [
"rustc-hash",
"smol_str",
"text_unit",
"thin-dst",
]

[[package]]
name = "rustbook"
version = "0.1.0"
Expand Down Expand Up @@ -3417,12 +3472,9 @@ dependencies = [

[[package]]
name = "rustc-hash"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
dependencies = [
"byteorder",
]
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"

[[package]]
name = "rustc-main"
Expand Down Expand Up @@ -3507,7 +3559,7 @@ dependencies = [
"log",
"rustc_data_structures",
"rustc_index",
"rustc_lexer",
"rustc_lexer 0.1.0",
"rustc_macros",
"rustc_span",
"scoped-tls",
Expand Down Expand Up @@ -3742,7 +3794,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_lexer",
"rustc_lexer 0.1.0",
"rustc_parse",
"rustc_session",
"rustc_span",
Expand Down Expand Up @@ -3861,6 +3913,7 @@ dependencies = [
"rustc_mir",
"rustc_mir_build",
"rustc_parse",
"rustc_parse_ra",
"rustc_passes",
"rustc_plugin_impl",
"rustc_privacy",
Expand All @@ -3886,6 +3939,15 @@ dependencies = [
"unicode-xid 0.2.0",
]

[[package]]
name = "rustc_lexer"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c86aae0c77166108c01305ee1a36a1e77289d7dc6ca0a3cd91ff4992de2d16a5"
dependencies = [
"unicode-xid 0.2.0",
]

[[package]]
name = "rustc_lint"
version = "0.0.0"
Expand Down Expand Up @@ -3972,7 +4034,7 @@ dependencies = [
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_lexer",
"rustc_lexer 0.1.0",
"rustc_macros",
"rustc_session",
"rustc_span",
Expand Down Expand Up @@ -4018,7 +4080,25 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_lexer",
"rustc_lexer 0.1.0",
"rustc_session",
"rustc_span",
"smallvec 1.0.0",
"unicode-normalization",
]

[[package]]
name = "rustc_parse_ra"
version = "0.0.0"
dependencies = [
"bitflags",
"log",
"ra_syntax",
"rustc_ast",
"rustc_ast_pretty",
"rustc_data_structures",
"rustc_errors",
"rustc_parse",
"rustc_session",
"rustc_span",
"smallvec 1.0.0",
Expand Down Expand Up @@ -4466,22 +4546,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"

[[package]]
name = "serde"
version = "1.0.99"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff"
dependencies = [
"serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.81"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "477b13b646f5b5b56fc95bedfc3b550d12141ce84f466f6c44b9a17589923885"
checksum = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -4603,6 +4683,15 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86"

[[package]]
name = "smol_str"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34836c9a295c62c2ce3514471117c5cb269891e8421b2aafdd910050576c4d8b"
dependencies = [
"serde",
]

[[package]]
name = "socket2"
version = "0.3.11"
Expand Down Expand Up @@ -4643,6 +4732,10 @@ dependencies = [
"wasi",
]

[[package]]
name = "stdx"
version = "0.1.0"

[[package]]
name = "string"
version = "0.2.1"
Expand Down Expand Up @@ -4899,6 +4992,12 @@ dependencies = [
"term 0.6.0",
]

[[package]]
name = "text_unit"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20431e104bfecc1a40872578dbc390e10290a0e9c35fffe3ce6f73c15a9dbfc2"

[[package]]
name = "textwrap"
version = "0.11.0"
Expand All @@ -4908,6 +5007,12 @@ dependencies = [
"unicode-width",
]

[[package]]
name = "thin-dst"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c46be180f1af9673ebb27bc1235396f61ef6965b3fe0dbb2e624deb604f0e"

[[package]]
name = "thiserror"
version = "1.0.5"
Expand Down
4 changes: 4 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@
# override the default allocator for rustc and LLVM.
#jemalloc = false

# Enable experimental features that depend on rust-analyzer. Assumes that you
# have a rust-analyzer directory in the same directory as the rustc directory
#rust-analyzer = false

# Run tests in various test suites with the "nll compare mode" in addition to
# running the tests in normal mode. Largely only used on CI and during local
# development of NLL
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub struct Config {
pub targets: Vec<Interned<String>>,
pub local_rebuild: bool,
pub jemalloc: bool,
pub rust_analyzer: bool,
pub control_flow_guard: bool,

// dist misc
Expand Down Expand Up @@ -341,6 +342,7 @@ struct Rust {
thin_lto_import_instr_limit: Option<u32>,
remap_debuginfo: Option<bool>,
jemalloc: Option<bool>,
rust_analyzer: Option<bool>,
test_compare_mode: Option<bool>,
llvm_libunwind: Option<bool>,
control_flow_guard: Option<bool>,
Expand Down Expand Up @@ -569,6 +571,7 @@ impl Config {
set(&mut config.codegen_tests, rust.codegen_tests);
set(&mut config.rust_rpath, rust.rpath);
set(&mut config.jemalloc, rust.jemalloc);
set(&mut config.rust_analyzer, rust.rust_analyzer);
set(&mut config.test_compare_mode, rust.test_compare_mode);
set(&mut config.llvm_libunwind, rust.llvm_libunwind);
set(&mut config.backtrace, rust.backtrace);
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ impl Build {
if self.config.jemalloc {
features.push_str("jemalloc");
}
if self.config.rust_analyzer {
features.push_str("rust_analyzer");
}
if self.config.llvm_enabled() {
features.push_str(" llvm");
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ winapi = { version = "0.3", features = ["consoleapi", "debugapi", "processenv"]

[features]
llvm = ['rustc_interface/llvm']
rust_analyzer = ['rustc_interface/rust_analyzer']
2 changes: 2 additions & 0 deletions src/librustc_interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rustc_attr = { path = "../librustc_attr" }
rustc_builtin_macros = { path = "../librustc_builtin_macros" }
rustc_expand = { path = "../librustc_expand" }
rustc_parse = { path = "../librustc_parse" }
rustc_parse_ra = { path = "../librustc_parse_ra", optional = true }
rustc_session = { path = "../librustc_session" }
rustc_span = { path = "../librustc_span" }
rustc_serialize = { path = "../libserialize", package = "serialize" }
Expand Down Expand Up @@ -55,3 +56,4 @@ rustc_target = { path = "../librustc_target" }

[features]
llvm = ['rustc_codegen_llvm']
rust_analyzer = ['rustc_parse_ra']
Loading