@@ -30,7 +30,7 @@ use middle::cstore;
30
30
31
31
use syntax:: ast:: { self , IntTy , UintTy } ;
32
32
use syntax:: codemap:: { FileName , FilePathMapping } ;
33
- use syntax:: edition:: { Edition , ALL_EDITIONS , DEFAULT_EDITION } ;
33
+ use syntax:: edition:: { Edition , EDITION_NAME_LIST , DEFAULT_EDITION } ;
34
34
use syntax:: parse:: token;
35
35
use syntax:: parse;
36
36
use syntax:: symbol:: Symbol ;
@@ -412,7 +412,7 @@ top_level_options!(
412
412
413
413
// Remap source path prefixes in all output (messages, object files, debug, etc)
414
414
remap_path_prefix: Vec <( PathBuf , PathBuf ) > [ UNTRACKED ] ,
415
- edition: Edition [ UNTRACKED ] ,
415
+ edition: Edition [ TRACKED ] ,
416
416
}
417
417
) ;
418
418
@@ -1643,7 +1643,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1643
1643
"" ,
1644
1644
"edition" ,
1645
1645
"Specify which edition of the compiler to use when compiling code." ,
1646
- & edition_name_list ( ) ,
1646
+ EDITION_NAME_LIST ,
1647
1647
) ,
1648
1648
opt:: multi_s(
1649
1649
"" ,
@@ -1712,14 +1712,26 @@ pub fn build_session_options_and_crate_config(
1712
1712
& format ! (
1713
1713
"argument for --edition must be one of: \
1714
1714
{}. (instead was `{}`)",
1715
- edition_name_list ( ) ,
1715
+ EDITION_NAME_LIST ,
1716
1716
arg
1717
1717
) ,
1718
1718
) ,
1719
1719
}
1720
1720
None => DEFAULT_EDITION ,
1721
1721
} ;
1722
1722
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
+
1723
1735
// We need the opts_present check because the driver will send us Matches
1724
1736
// with only stable options if no unstable options are used. Since error-format
1725
1737
// is unstable, it will not be present. We have to use opts_present not
@@ -2311,6 +2323,7 @@ mod dep_tracking {
2311
2323
use syntax:: feature_gate:: UnstableFeatures ;
2312
2324
use rustc_back:: { PanicStrategy , RelroLevel } ;
2313
2325
use rustc_back:: target:: TargetTriple ;
2326
+ use syntax:: edition:: Edition ;
2314
2327
2315
2328
pub trait DepTrackingHash {
2316
2329
fn hash ( & self , hasher : & mut DefaultHasher , error_format : ErrorOutputType ) ;
@@ -2370,6 +2383,7 @@ mod dep_tracking {
2370
2383
impl_dep_tracking_hash_via_hash ! ( Sanitizer ) ;
2371
2384
impl_dep_tracking_hash_via_hash ! ( Option <Sanitizer >) ;
2372
2385
impl_dep_tracking_hash_via_hash ! ( TargetTriple ) ;
2386
+ impl_dep_tracking_hash_via_hash ! ( Edition ) ;
2373
2387
2374
2388
impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
2375
2389
impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2427,11 +2441,6 @@ mod dep_tracking {
2427
2441
}
2428
2442
}
2429
2443
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
-
2435
2444
#[ cfg( test) ]
2436
2445
mod tests {
2437
2446
use errors;
0 commit comments