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.
This commit is contained in:
parent
6b6a867ae9
commit
76adf05cfb
15 changed files with 20 additions and 17 deletions
|
@ -425,7 +425,9 @@ fn run_compiler(
|
||||||
return early_exit();
|
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();
|
return early_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -712,7 +712,7 @@ fn test_unstable_options_tracking_hash() {
|
||||||
untracked!(no_analysis, true);
|
untracked!(no_analysis, true);
|
||||||
untracked!(no_leak_check, true);
|
untracked!(no_leak_check, true);
|
||||||
untracked!(no_parallel_backend, 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`.
|
// `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!(pre_link_args, vec![String::from("abc"), String::from("def")]);
|
||||||
untracked!(print_codegen_stats, true);
|
untracked!(print_codegen_stats, true);
|
||||||
|
|
|
@ -1208,7 +1208,7 @@ impl Options {
|
||||||
|
|
||||||
/// Returns `true` if there will be an output file generated.
|
/// Returns `true` if there will be an output file generated.
|
||||||
pub fn will_create_output_file(&self) -> bool {
|
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
|
self.unstable_opts.ls.is_empty() // The file is just being queried
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1864,7 +1864,7 @@ fn parse_output_types(
|
||||||
matches: &getopts::Matches,
|
matches: &getopts::Matches,
|
||||||
) -> OutputTypes {
|
) -> OutputTypes {
|
||||||
let mut output_types = BTreeMap::new();
|
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 list in matches.opt_strs("emit") {
|
||||||
for output_type in list.split(',') {
|
for output_type in list.split(',') {
|
||||||
let (shorthand, path) = split_out_file_name(output_type);
|
let (shorthand, path) = split_out_file_name(output_type);
|
||||||
|
|
|
@ -1937,8 +1937,9 @@ options! {
|
||||||
"support compiling tests with panic=abort (default: no)"),
|
"support compiling tests with panic=abort (default: no)"),
|
||||||
panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED],
|
panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED],
|
||||||
"panic strategy for panics in drops"),
|
"panic strategy for panics in drops"),
|
||||||
parse_only: bool = (false, parse_bool, [UNTRACKED],
|
parse_crate_root_only: bool = (false, parse_bool, [UNTRACKED],
|
||||||
"parse only; do not compile, assemble, or link (default: no)"),
|
"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],
|
patchable_function_entry: PatchableFunctionEntry = (PatchableFunctionEntry::default(), parse_patchable_function_entry, [TRACKED],
|
||||||
"nop padding at function entry"),
|
"nop padding at function entry"),
|
||||||
plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
|
|
||||||
impl<T> Baz for T where T: Foo {
|
impl<T> Baz for T where T: Foo {
|
||||||
type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
|
type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
|
@ -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 + {} // OK
|
||||||
fn f() -> impl A + B {} // OK
|
fn f() -> impl A + B {} // OK
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// following lines below parse and must not fail
|
// following lines below parse and must not fail
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// see assoc-oddities-1 for explanation
|
// see assoc-oddities-1 for explanation
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
|
|
||||||
struct S<
|
struct S<
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
|
|
||||||
impl <*const u8>::AssocTy {} // OK
|
impl <*const u8>::AssocTy {} // OK
|
||||||
impl <Type as Trait>::AssocTy {} // OK
|
impl <Type as Trait>::AssocTy {} // OK
|
||||||
|
|
|
@ -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); //This is parsed as the new Fn* style parenthesis syntax.
|
||||||
struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well.
|
struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
|
|
||||||
#![feature(const_trait_bound_opt_out)]
|
#![feature(const_trait_bound_opt_out)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
|
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//@ compile-flags: -Z parse-only
|
//@ compile-flags: -Z parse-crate-root-only
|
||||||
|
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue