Skip to content

Commit 2e66154

Browse files
committed
Reorder source_str_to_stream arguments.
It's the only one of these functions where `psess` isn't the first argument.
1 parent 2f215fa commit 2e66154

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,9 @@ impl server::TokenStream for Rustc<'_, '_> {
541541

542542
fn from_str(&mut self, src: &str) -> Self::TokenStream {
543543
source_str_to_stream(
544+
self.psess(),
544545
FileName::proc_macro_source_code(src),
545546
src.to_string(),
546-
self.psess(),
547547
Some(self.call_site),
548548
)
549549
}

compiler/rustc_parse/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ fn maybe_new_parser_from_source_file(
9494
}
9595

9696
pub fn source_str_to_stream(
97+
psess: &ParseSess,
9798
name: FileName,
9899
source: String,
99-
psess: &ParseSess,
100100
override_span: Option<Span>,
101101
) -> TokenStream {
102102
source_file_to_stream(psess, psess.source_map().new_source_file(name, source), override_span)
@@ -146,13 +146,13 @@ pub fn parse_in<'a, T>(
146146
pub fn fake_token_stream_for_item(psess: &ParseSess, item: &ast::Item) -> TokenStream {
147147
let source = pprust::item_to_string(item);
148148
let filename = FileName::macro_expansion_source_code(&source);
149-
source_str_to_stream(filename, source, psess, Some(item.span))
149+
source_str_to_stream(psess, filename, source, Some(item.span))
150150
}
151151

152152
pub fn fake_token_stream_for_crate(psess: &ParseSess, krate: &ast::Crate) -> TokenStream {
153153
let source = pprust::crate_to_string_for_macros(krate);
154154
let filename = FileName::macro_expansion_source_code(&source);
155-
source_str_to_stream(filename, source, psess, Some(krate.spans.inner_span))
155+
source_str_to_stream(psess, filename, source, Some(krate.spans.inner_span))
156156
}
157157

158158
pub fn parse_cfg_attr(

compiler/rustc_parse/src/parser/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ where
8282
/// Maps a string to tts, using a made-up filename.
8383
pub(crate) fn string_to_stream(source_str: String) -> TokenStream {
8484
let psess = psess();
85-
source_str_to_stream(PathBuf::from("bogofile").into(), source_str, &psess, None)
85+
source_str_to_stream(&psess, PathBuf::from("bogofile").into(), source_str, None)
8686
}
8787

8888
/// Parses a string, returns a crate.

src/librustdoc/passes/lint/check_code_block_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn check_rust_syntax(
5353
let span = DUMMY_SP.apply_mark(expn_id.to_expn_id(), Transparency::Transparent);
5454

5555
let is_empty = rustc_driver::catch_fatal_errors(|| {
56-
source_str_to_stream(FileName::Custom(String::from("doctest")), source, &psess, Some(span))
56+
source_str_to_stream(&psess, FileName::Custom(String::from("doctest")), source, Some(span))
5757
.is_empty()
5858
})
5959
.unwrap_or(false);

0 commit comments

Comments
 (0)