about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-05-31 14:33:56 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-06-05 10:38:02 +1000
commitab192a0c97cd0d03d24e402640576474cb62c972 (patch)
treea6519e8bfe84fa3929193f45128113d9236b1522
parent25972aec67e900aeefe4014deecf5ef853a4bab4 (diff)
downloadrust-ab192a0c97cd0d03d24e402640576474cb62c972.tar.gz
rust-ab192a0c97cd0d03d24e402640576474cb62c972.zip
Reorder `source_str_to_stream` arguments.
It's the only one of these functions where `psess` isn't the first
argument.
-rw-r--r--compiler/rustc_expand/src/proc_macro_server.rs2
-rw-r--r--compiler/rustc_parse/src/lib.rs6
-rw-r--r--compiler/rustc_parse/src/parser/tests.rs2
-rw-r--r--src/librustdoc/passes/lint/check_code_block_syntax.rs2
4 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs
index 9ae9f7c10c0..330a6c34770 100644
--- a/compiler/rustc_expand/src/proc_macro_server.rs
+++ b/compiler/rustc_expand/src/proc_macro_server.rs
@@ -540,9 +540,9 @@ impl server::TokenStream for Rustc<'_, '_> {
 
     fn from_str(&mut self, src: &str) -> Self::TokenStream {
         source_str_to_stream(
+            self.psess(),
             FileName::proc_macro_source_code(src),
             src.to_string(),
-            self.psess(),
             Some(self.call_site),
         )
     }
diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs
index b804e77e7a4..5ba6db3b262 100644
--- a/compiler/rustc_parse/src/lib.rs
+++ b/compiler/rustc_parse/src/lib.rs
@@ -95,9 +95,9 @@ fn maybe_new_parser_from_source_file(
 }
 
 pub fn source_str_to_stream(
+    psess: &ParseSess,
     name: FileName,
     source: String,
-    psess: &ParseSess,
     override_span: Option<Span>,
 ) -> TokenStream {
     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>(
 pub fn fake_token_stream_for_item(psess: &ParseSess, item: &ast::Item) -> TokenStream {
     let source = pprust::item_to_string(item);
     let filename = FileName::macro_expansion_source_code(&source);
-    source_str_to_stream(filename, source, psess, Some(item.span))
+    source_str_to_stream(psess, filename, source, Some(item.span))
 }
 
 pub fn fake_token_stream_for_crate(psess: &ParseSess, krate: &ast::Crate) -> TokenStream {
     let source = pprust::crate_to_string_for_macros(krate);
     let filename = FileName::macro_expansion_source_code(&source);
-    source_str_to_stream(filename, source, psess, Some(krate.spans.inner_span))
+    source_str_to_stream(psess, filename, source, Some(krate.spans.inner_span))
 }
 
 pub fn parse_cfg_attr(
diff --git a/compiler/rustc_parse/src/parser/tests.rs b/compiler/rustc_parse/src/parser/tests.rs
index b72cfd63d00..2900d44089e 100644
--- a/compiler/rustc_parse/src/parser/tests.rs
+++ b/compiler/rustc_parse/src/parser/tests.rs
@@ -82,7 +82,7 @@ where
 /// Maps a string to tts, using a made-up filename.
 pub(crate) fn string_to_stream(source_str: String) -> TokenStream {
     let psess = psess();
-    source_str_to_stream(PathBuf::from("bogofile").into(), source_str, &psess, None)
+    source_str_to_stream(&psess, PathBuf::from("bogofile").into(), source_str, None)
 }
 
 /// Parses a string, returns a crate.
diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs
index 4f044450df2..409546734cb 100644
--- a/src/librustdoc/passes/lint/check_code_block_syntax.rs
+++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs
@@ -51,7 +51,7 @@ fn check_rust_syntax(
     let span = DUMMY_SP.apply_mark(expn_id.to_expn_id(), Transparency::Transparent);
 
     let is_empty = rustc_driver::catch_fatal_errors(|| {
-        source_str_to_stream(FileName::Custom(String::from("doctest")), source, &psess, Some(span))
+        source_str_to_stream(&psess, FileName::Custom(String::from("doctest")), source, Some(span))
             .is_empty()
     })
     .unwrap_or(false);