Skip to content

Commit 2b9f414

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 aef3300 commit 2b9f414

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

+1-1
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ fn maybe_new_parser_from_source_file(
9595
}
9696

9797
pub fn source_str_to_stream(
98+
psess: &ParseSess,
9899
name: FileName,
99100
source: String,
100-
psess: &ParseSess,
101101
override_span: Option<Span>,
102102
) -> TokenStream {
103103
source_file_to_stream(psess, psess.source_map().new_source_file(name, source), override_span)
@@ -147,13 +147,13 @@ pub fn parse_in<'a, T>(
147147
pub fn fake_token_stream_for_item(psess: &ParseSess, item: &ast::Item) -> TokenStream {
148148
let source = pprust::item_to_string(item);
149149
let filename = FileName::macro_expansion_source_code(&source);
150-
source_str_to_stream(filename, source, psess, Some(item.span))
150+
source_str_to_stream(psess, filename, source, Some(item.span))
151151
}
152152

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

159159
pub fn parse_cfg_attr(

compiler/rustc_parse/src/parser/tests.rs

+1-1
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

+1-1
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)