Skip to content

Commit

Permalink
remove parser fluent from rustc_expand
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Nov 14, 2023
1 parent bf3b14d commit 728a864
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_expand/src/parse/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ use rustc_span::{BytePos, FileName, Pos, Span};
use std::path::PathBuf;

fn sess() -> ParseSess {
ParseSess::new(
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
FilePathMapping::empty(),
)
ParseSess::new(vec![crate::DEFAULT_LOCALE_RESOURCE], FilePathMapping::empty())
}

/// Parses an item.
Expand Down
16 changes: 4 additions & 12 deletions compiler/rustc_expand/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ fn string_to_parser(ps: &ParseSess, source_str: String) -> Parser<'_> {
fn create_test_handler() -> (Handler, Lrc<SourceMap>, Arc<Mutex<Vec<u8>>>) {
let output = Arc::new(Mutex::new(Vec::new()));
let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let fallback_bundle = rustc_errors::fallback_fluent_bundle(
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
false,
);
let fallback_bundle =
rustc_errors::fallback_fluent_bundle(vec![crate::DEFAULT_LOCALE_RESOURCE], false);
let emitter = EmitterWriter::new(Box::new(Shared { data: output.clone() }), fallback_bundle)
.sm(Some(source_map.clone()))
.diagnostic_width(Some(140));
Expand Down Expand Up @@ -72,10 +70,7 @@ where

/// Maps a string to tts, using a made-up filename.
pub(crate) fn string_to_stream(source_str: String) -> TokenStream {
let ps = ParseSess::new(
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
FilePathMapping::empty(),
);
let ps = ParseSess::new(vec![crate::DEFAULT_LOCALE_RESOURCE], FilePathMapping::empty());
source_file_to_stream(
&ps,
ps.source_map().new_source_file(PathBuf::from("bogofile").into(), source_str),
Expand All @@ -85,10 +80,7 @@ pub(crate) fn string_to_stream(source_str: String) -> TokenStream {

/// Parses a string, returns a crate.
pub(crate) fn string_to_crate(source_str: String) -> ast::Crate {
let ps = ParseSess::new(
vec![crate::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE],
FilePathMapping::empty(),
);
let ps = ParseSess::new(vec![crate::DEFAULT_LOCALE_RESOURCE], FilePathMapping::empty());
with_error_checking_parse(source_str, &ps, |p| p.parse_crate_mod())
}

Expand Down

0 comments on commit 728a864

Please sign in to comment.