Merge #1091
1091: Add -frust-edition flag and possible values r=CohenArthur a=CohenArthur Closes #1072 Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
This commit is contained in:
commit
1b8d4521db
|
@ -83,6 +83,22 @@ frust-cfg=
|
||||||
Rust Joined RejectNegative
|
Rust Joined RejectNegative
|
||||||
-frust-cfg=<name> Set a config expansion option
|
-frust-cfg=<name> Set a config expansion option
|
||||||
|
|
||||||
|
frust-edition=
|
||||||
|
Rust Joined RejectNegative Enum(frust_edition) Var(flag_rust_edition)
|
||||||
|
-frust-edition=[2015|2018|2021] Choose which edition to use when compiling rust code
|
||||||
|
|
||||||
|
Enum
|
||||||
|
Name(frust_edition) Type(int) UnknownError(unknown rust edition %qs)
|
||||||
|
|
||||||
|
EnumValue
|
||||||
|
Enum(frust_edition) String(2015) Value(0)
|
||||||
|
|
||||||
|
EnumValue
|
||||||
|
Enum(frust_edition) String(2018) Value(1)
|
||||||
|
|
||||||
|
EnumValue
|
||||||
|
Enum(frust_edition) String(2021) Value(2)
|
||||||
|
|
||||||
o
|
o
|
||||||
Rust Joined Separate
|
Rust Joined Separate
|
||||||
; Documented in common.opt
|
; Documented in common.opt
|
||||||
|
|
|
@ -373,6 +373,10 @@ Session::handle_option (
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case OPT_frust_edition_:
|
||||||
|
options.set_edition (flag_rust_edition);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,13 @@ struct CompileOptions
|
||||||
bool enable_test = false;
|
bool enable_test = false;
|
||||||
bool debug_assertions = false;
|
bool debug_assertions = false;
|
||||||
bool proc_macro = false;
|
bool proc_macro = false;
|
||||||
|
enum Edition
|
||||||
|
{
|
||||||
|
E2015 = 0,
|
||||||
|
E2018,
|
||||||
|
E2021,
|
||||||
|
} edition
|
||||||
|
= E2015;
|
||||||
|
|
||||||
bool dump_option_enabled (DumpOption option) const
|
bool dump_option_enabled (DumpOption option) const
|
||||||
{
|
{
|
||||||
|
@ -211,6 +218,11 @@ struct CompileOptions
|
||||||
crate_name = std::move (name);
|
crate_name = std::move (name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_edition (int raw_edition)
|
||||||
|
{
|
||||||
|
edition = static_cast<Edition> (raw_edition);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Defines a compiler session. This is for a single compiler invocation, so
|
/* Defines a compiler session. This is for a single compiler invocation, so
|
||||||
|
|
Loading…
Reference in New Issue