@@ -30,7 +30,7 @@ use middle::cstore;
3030
3131use syntax:: ast:: { self , IntTy , UintTy } ;
3232use syntax:: codemap:: { FileName , FilePathMapping } ;
33- use syntax:: edition:: { Edition , ALL_EDITIONS , DEFAULT_EDITION } ;
33+ use syntax:: edition:: { Edition , EDITION_NAME_LIST , DEFAULT_EDITION } ;
3434use syntax:: parse:: token;
3535use syntax:: parse;
3636use syntax:: symbol:: Symbol ;
@@ -412,7 +412,7 @@ top_level_options!(
412412
413413 // Remap source path prefixes in all output (messages, object files, debug, etc)
414414 remap_path_prefix: Vec <( PathBuf , PathBuf ) > [ UNTRACKED ] ,
415- edition: Edition [ UNTRACKED ] ,
415+ edition: Edition [ TRACKED ] ,
416416 }
417417) ;
418418
@@ -1643,7 +1643,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
16431643 "" ,
16441644 "edition" ,
16451645 "Specify which edition of the compiler to use when compiling code." ,
1646- & edition_name_list ( ) ,
1646+ EDITION_NAME_LIST ,
16471647 ) ,
16481648 opt:: multi_s(
16491649 "" ,
@@ -1712,14 +1712,26 @@ pub fn build_session_options_and_crate_config(
17121712 & format ! (
17131713 "argument for --edition must be one of: \
17141714 {}. (instead was `{}`)",
1715- edition_name_list ( ) ,
1715+ EDITION_NAME_LIST ,
17161716 arg
17171717 ) ,
17181718 ) ,
17191719 }
17201720 None => DEFAULT_EDITION ,
17211721 } ;
17221722
1723+ if !edition. is_stable ( ) && !nightly_options:: is_nightly_build ( ) {
1724+ early_error (
1725+ ErrorOutputType :: default ( ) ,
1726+ & format ! (
1727+ "Edition {} is unstable an only\
1728+ available for nightly builds of rustc.",
1729+ edition,
1730+ )
1731+ )
1732+ }
1733+
1734+
17231735 // We need the opts_present check because the driver will send us Matches
17241736 // with only stable options if no unstable options are used. Since error-format
17251737 // is unstable, it will not be present. We have to use opts_present not
@@ -2311,6 +2323,7 @@ mod dep_tracking {
23112323 use syntax:: feature_gate:: UnstableFeatures ;
23122324 use rustc_back:: { PanicStrategy , RelroLevel } ;
23132325 use rustc_back:: target:: TargetTriple ;
2326+ use syntax:: edition:: Edition ;
23142327
23152328 pub trait DepTrackingHash {
23162329 fn hash ( & self , hasher : & mut DefaultHasher , error_format : ErrorOutputType ) ;
@@ -2370,6 +2383,7 @@ mod dep_tracking {
23702383 impl_dep_tracking_hash_via_hash ! ( Sanitizer ) ;
23712384 impl_dep_tracking_hash_via_hash ! ( Option <Sanitizer >) ;
23722385 impl_dep_tracking_hash_via_hash ! ( TargetTriple ) ;
2386+ impl_dep_tracking_hash_via_hash ! ( Edition ) ;
23732387
23742388 impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
23752389 impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2427,11 +2441,6 @@ mod dep_tracking {
24272441 }
24282442}
24292443
2430- pub fn edition_name_list ( ) -> String {
2431- let names: Vec < String > = ALL_EDITIONS . iter ( ) . map ( |e| format ! ( "{}" , e) ) . collect ( ) ;
2432- names. join ( "|" )
2433- }
2434-
24352444#[ cfg( test) ]
24362445mod tests {
24372446 use errors;
0 commit comments