Split out rustc_lexer from rustc_dependencies

This commit is contained in:
Lukas Wirth 2024-01-08 15:24:46 +01:00
parent af40101841
commit b97ab00bd4
11 changed files with 22 additions and 28 deletions

5
Cargo.lock generated
View file

@ -1196,7 +1196,7 @@ dependencies = [
"drop_bomb", "drop_bomb",
"expect-test", "expect-test",
"limit", "limit",
"rustc-dependencies", "ra-ap-rustc_lexer",
"sourcegen", "sourcegen",
"stdx", "stdx",
] ]
@ -1605,7 +1605,6 @@ version = "0.0.0"
dependencies = [ dependencies = [
"ra-ap-rustc_abi", "ra-ap-rustc_abi",
"ra-ap-rustc_index", "ra-ap-rustc_index",
"ra-ap-rustc_lexer",
"ra-ap-rustc_parse_format", "ra-ap-rustc_parse_format",
] ]
@ -1808,9 +1807,9 @@ dependencies = [
"proc-macro2", "proc-macro2",
"profile", "profile",
"quote", "quote",
"ra-ap-rustc_lexer",
"rayon", "rayon",
"rowan", "rowan",
"rustc-dependencies",
"rustc-hash", "rustc-hash",
"smol_str", "smol_str",
"sourcegen", "sourcegen",

View file

@ -80,6 +80,8 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" } vfs = { path = "./crates/vfs", version = "0.0.0" }
rustc-dependencies = { path = "./crates/rustc-dependencies", version = "0.0.0" } rustc-dependencies = { path = "./crates/rustc-dependencies", version = "0.0.0" }
ra-ap-rustc_lexer = "0.21.0"
# local crates that aren't published to crates.io. These should not have versions. # local crates that aren't published to crates.io. These should not have versions.
sourcegen = { path = "./crates/sourcegen" } sourcegen = { path = "./crates/sourcegen" }
test-fixture = { path = "./crates/test-fixture" } test-fixture = { path = "./crates/test-fixture" }

View file

@ -13,8 +13,7 @@ doctest = false
[dependencies] [dependencies]
drop_bomb = "0.1.5" drop_bomb = "0.1.5"
rustc-dependencies.workspace = true ra-ap-rustc_lexer.workspace = true
limit.workspace = true limit.workspace = true
[dev-dependencies] [dev-dependencies]
@ -24,7 +23,7 @@ stdx.workspace = true
sourcegen.workspace = true sourcegen.workspace = true
[features] [features]
in-rust-tree = ["rustc-dependencies/in-rust-tree"] in-rust-tree = []
[lints] [lints]
workspace = true workspace = true

View file

@ -8,8 +8,6 @@
//! Note that these tokens, unlike the tokens we feed into the parser, do //! Note that these tokens, unlike the tokens we feed into the parser, do
//! include info about comments and whitespace. //! include info about comments and whitespace.
use rustc_dependencies::lexer as rustc_lexer;
use std::ops; use std::ops;
use rustc_lexer::unescape::{EscapeError, Mode}; use rustc_lexer::unescape::{EscapeError, Mode};

View file

@ -21,6 +21,11 @@
#![allow(rustdoc::private_intra_doc_links)] #![allow(rustdoc::private_intra_doc_links)]
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))] #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(not(feature = "in-rust-tree"))]
extern crate ra_ap_rustc_lexer as rustc_lexer;
#[cfg(feature = "in-rust-tree")]
extern crate rustc_lexer;
mod lexed_str; mod lexed_str;
mod token_set; mod token_set;
mod syntax_kind; mod syntax_kind;

View file

@ -11,7 +11,6 @@ authors.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
ra-ap-rustc_lexer = { version = "0.21.0" }
ra-ap-rustc_parse_format = { version = "0.21.0", default-features = false } ra-ap-rustc_parse_format = { version = "0.21.0", default-features = false }
ra-ap-rustc_index = { version = "0.21.0", default-features = false } ra-ap-rustc_index = { version = "0.21.0", default-features = false }
ra-ap-rustc_abi = { version = "0.21.0", default-features = false } ra-ap-rustc_abi = { version = "0.21.0", default-features = false }
@ -20,4 +19,4 @@ ra-ap-rustc_abi = { version = "0.21.0", default-features = false }
in-rust-tree = [] in-rust-tree = []
[lints] [lints]
workspace = true workspace = true

View file

@ -3,17 +3,6 @@
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))] #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#[cfg(feature = "in-rust-tree")]
extern crate rustc_lexer;
pub mod lexer {
#[cfg(not(feature = "in-rust-tree"))]
pub use ::ra_ap_rustc_lexer::*;
#[cfg(feature = "in-rust-tree")]
pub use ::rustc_lexer::*;
}
#[cfg(feature = "in-rust-tree")] #[cfg(feature = "in-rust-tree")]
extern crate rustc_parse_format; extern crate rustc_parse_format;

View file

@ -23,7 +23,7 @@ indexmap.workspace = true
smol_str.workspace = true smol_str.workspace = true
triomphe.workspace = true triomphe.workspace = true
rustc-dependencies.workspace = true ra-ap-rustc_lexer.workspace = true
parser.workspace = true parser.workspace = true
profile.workspace = true profile.workspace = true
@ -41,7 +41,7 @@ test-utils.workspace = true
sourcegen.workspace = true sourcegen.workspace = true
[features] [features]
in-rust-tree = ["rustc-dependencies/in-rust-tree"] in-rust-tree = []
[lints] [lints]
workspace = true workspace = true

View file

@ -2,8 +2,6 @@
use std::borrow::Cow; use std::borrow::Cow;
use rustc_dependencies::lexer as rustc_lexer;
use rustc_lexer::unescape::{ use rustc_lexer::unescape::{
unescape_byte, unescape_c_string, unescape_char, unescape_literal, CStrUnit, Mode, unescape_byte, unescape_c_string, unescape_char, unescape_literal, CStrUnit, Mode,
}; };

View file

@ -22,6 +22,11 @@
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))] #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
#![warn(rust_2018_idioms, unused_lifetimes)] #![warn(rust_2018_idioms, unused_lifetimes)]
#[cfg(not(feature = "in-rust-tree"))]
extern crate ra_ap_rustc_lexer as rustc_lexer;
#[cfg(feature = "in-rust-tree")]
extern crate rustc_lexer;
#[allow(unused)] #[allow(unused)]
macro_rules! eprintln { macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

View file

@ -5,7 +5,7 @@
mod block; mod block;
use rowan::Direction; use rowan::Direction;
use rustc_dependencies::lexer::unescape::{self, unescape_literal, Mode}; use rustc_lexer::unescape::{self, unescape_literal, Mode};
use crate::{ use crate::{
algo, algo,