about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-11-29 06:05:56 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-11-29 06:10:15 +1100
commit76adf05cfbffd78fc3f9e123634e992a70798e8f (patch)
tree4b336dfb181acee20f72f418175b9c37cb5f83bd
parent6b6a867ae9eac4e78d041ac4ee84be1072a48cf7 (diff)
downloadrust-76adf05cfbffd78fc3f9e123634e992a70798e8f.tar.gz
rust-76adf05cfbffd78fc3f9e123634e992a70798e8f.zip
Rename `-Zparse-only`.
I was surprised to find that running with `-Zparse-only` only parses the
crate root file. Other files aren't parsed because that happens later
during expansion.

This commit renames the option and updates the help message to make this
clearer.
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs4
-rw-r--r--compiler/rustc_interface/src/tests.rs2
-rw-r--r--compiler/rustc_session/src/config.rs4
-rw-r--r--compiler/rustc_session/src/options.rs5
-rw-r--r--tests/ui/generic-associated-types/parse/in-trait-impl.rs2
-rw-r--r--tests/ui/generic-associated-types/parse/in-trait.rs2
-rw-r--r--tests/ui/impl-trait/impl-trait-plus-priority.rs2
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-1.rs2
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-2.rs2
-rw-r--r--tests/ui/parser/bounds-type.rs2
-rw-r--r--tests/ui/parser/impl-qpath.rs2
-rw-r--r--tests/ui/parser/issues/issue-17904.rs2
-rw-r--r--tests/ui/traits/const-traits/syntax.rs2
-rw-r--r--tests/ui/traits/const-traits/tilde-const-syntax.rs2
-rw-r--r--tests/ui/traits/const-traits/tilde-twice.rs2
15 files changed, 20 insertions, 17 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 256266d2965..ee5a05a0b9d 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -425,7 +425,9 @@ fn run_compiler(
                 return early_exit();
             }
 
-            if sess.opts.unstable_opts.parse_only || sess.opts.unstable_opts.show_span.is_some() {
+            if sess.opts.unstable_opts.parse_crate_root_only
+                || sess.opts.unstable_opts.show_span.is_some()
+            {
                 return early_exit();
             }
 
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index 6beae14100d..c1b2d856252 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -712,7 +712,7 @@ fn test_unstable_options_tracking_hash() {
     untracked!(no_analysis, true);
     untracked!(no_leak_check, true);
     untracked!(no_parallel_backend, true);
-    untracked!(parse_only, true);
+    untracked!(parse_crate_root_only, true);
     // `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
     untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
     untracked!(print_codegen_stats, true);
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 0124397ea46..cb6d539cdf9 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1208,7 +1208,7 @@ impl Options {
 
     /// Returns `true` if there will be an output file generated.
     pub fn will_create_output_file(&self) -> bool {
-        !self.unstable_opts.parse_only && // The file is just being parsed
+        !self.unstable_opts.parse_crate_root_only && // The file is just being parsed
             self.unstable_opts.ls.is_empty() // The file is just being queried
     }
 
@@ -1864,7 +1864,7 @@ fn parse_output_types(
     matches: &getopts::Matches,
 ) -> OutputTypes {
     let mut output_types = BTreeMap::new();
-    if !unstable_opts.parse_only {
+    if !unstable_opts.parse_crate_root_only {
         for list in matches.opt_strs("emit") {
             for output_type in list.split(',') {
                 let (shorthand, path) = split_out_file_name(output_type);
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index a2d75917c82..47c191e67ba 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -1937,8 +1937,9 @@ options! {
         "support compiling tests with panic=abort (default: no)"),
     panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED],
         "panic strategy for panics in drops"),
-    parse_only: bool = (false, parse_bool, [UNTRACKED],
-        "parse only; do not compile, assemble, or link (default: no)"),
+    parse_crate_root_only: bool = (false, parse_bool, [UNTRACKED],
+        "parse the crate root file only; do not parse other files, compile, assemble, or link \
+        (default: no)"),
     patchable_function_entry: PatchableFunctionEntry = (PatchableFunctionEntry::default(), parse_patchable_function_entry, [TRACKED],
         "nop padding at function entry"),
     plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
diff --git a/tests/ui/generic-associated-types/parse/in-trait-impl.rs b/tests/ui/generic-associated-types/parse/in-trait-impl.rs
index 5ba42be3583..ef67fb18228 100644
--- a/tests/ui/generic-associated-types/parse/in-trait-impl.rs
+++ b/tests/ui/generic-associated-types/parse/in-trait-impl.rs
@@ -1,5 +1,5 @@
 //@ check-pass
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 impl<T> Baz for T where T: Foo {
     type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
diff --git a/tests/ui/generic-associated-types/parse/in-trait.rs b/tests/ui/generic-associated-types/parse/in-trait.rs
index 913eceec0da..2add908d727 100644
--- a/tests/ui/generic-associated-types/parse/in-trait.rs
+++ b/tests/ui/generic-associated-types/parse/in-trait.rs
@@ -1,5 +1,5 @@
 //@ check-pass
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 use std::ops::Deref;
 use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/impl-trait-plus-priority.rs b/tests/ui/impl-trait/impl-trait-plus-priority.rs
index 5441a015ac0..5575493a17d 100644
--- a/tests/ui/impl-trait/impl-trait-plus-priority.rs
+++ b/tests/ui/impl-trait/impl-trait-plus-priority.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 fn f() -> impl A + {} // OK
 fn f() -> impl A + B {} // OK
diff --git a/tests/ui/parser/assoc/assoc-oddities-1.rs b/tests/ui/parser/assoc/assoc-oddities-1.rs
index 246546ac034..c1b305a4eeb 100644
--- a/tests/ui/parser/assoc/assoc-oddities-1.rs
+++ b/tests/ui/parser/assoc/assoc-oddities-1.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 fn main() {
     // following lines below parse and must not fail
diff --git a/tests/ui/parser/assoc/assoc-oddities-2.rs b/tests/ui/parser/assoc/assoc-oddities-2.rs
index aee2af41d62..82cf7d79c0d 100644
--- a/tests/ui/parser/assoc/assoc-oddities-2.rs
+++ b/tests/ui/parser/assoc/assoc-oddities-2.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 fn main() {
     // see assoc-oddities-1 for explanation
diff --git a/tests/ui/parser/bounds-type.rs b/tests/ui/parser/bounds-type.rs
index 7cee6def32f..ec0e83c314e 100644
--- a/tests/ui/parser/bounds-type.rs
+++ b/tests/ui/parser/bounds-type.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 //@ edition: 2021
 
 struct S<
diff --git a/tests/ui/parser/impl-qpath.rs b/tests/ui/parser/impl-qpath.rs
index d7c4989b6e4..fed026792c9 100644
--- a/tests/ui/parser/impl-qpath.rs
+++ b/tests/ui/parser/impl-qpath.rs
@@ -1,5 +1,5 @@
 //@ check-pass
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 impl <*const u8>::AssocTy {} // OK
 impl <Type as Trait>::AssocTy {} // OK
diff --git a/tests/ui/parser/issues/issue-17904.rs b/tests/ui/parser/issues/issue-17904.rs
index 6f77d4bb086..99a3b139898 100644
--- a/tests/ui/parser/issues/issue-17904.rs
+++ b/tests/ui/parser/issues/issue-17904.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Zparse-only
+//@ compile-flags: -Zparse-crate-root-only
 
 struct Baz<U> where U: Eq(U); //This is parsed as the new Fn* style parenthesis syntax.
 struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well.
diff --git a/tests/ui/traits/const-traits/syntax.rs b/tests/ui/traits/const-traits/syntax.rs
index 1064713ac59..cfac6e0a93e 100644
--- a/tests/ui/traits/const-traits/syntax.rs
+++ b/tests/ui/traits/const-traits/syntax.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 //@ check-pass
 
 #![feature(const_trait_bound_opt_out)]
diff --git a/tests/ui/traits/const-traits/tilde-const-syntax.rs b/tests/ui/traits/const-traits/tilde-const-syntax.rs
index d65ecae3d06..f9944c426cc 100644
--- a/tests/ui/traits/const-traits/tilde-const-syntax.rs
+++ b/tests/ui/traits/const-traits/tilde-const-syntax.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 //@ check-pass
 
 #![feature(const_trait_impl)]
diff --git a/tests/ui/traits/const-traits/tilde-twice.rs b/tests/ui/traits/const-traits/tilde-twice.rs
index c3f9f8e6764..d341513b8a8 100644
--- a/tests/ui/traits/const-traits/tilde-twice.rs
+++ b/tests/ui/traits/const-traits/tilde-twice.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z parse-only
+//@ compile-flags: -Z parse-crate-root-only
 
 #![feature(const_trait_impl)]