Skip to content

Commit 3ebe12e

Browse files
committed
Merge branch '49001_epoch' of https://github.com/klnusbaum/rust into rollup
2 parents 82bb41b + 11f1406 commit 3ebe12e

File tree

16 files changed

+95
-95
lines changed

16 files changed

+95
-95
lines changed

src/librustc/lint/context.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use util::nodemap::FxHashMap;
4141
use std::default::Default as StdDefault;
4242
use std::cell::{Ref, RefCell};
4343
use syntax::ast;
44-
use syntax::epoch;
44+
use syntax::edition;
4545
use syntax_pos::{MultiSpan, Span};
4646
use errors::DiagnosticBuilder;
4747
use hir;
@@ -103,9 +103,9 @@ pub struct FutureIncompatibleInfo {
103103
pub id: LintId,
104104
/// e.g., a URL for an issue/PR/RFC or error code
105105
pub reference: &'static str,
106-
/// If this is an epoch fixing lint, the epoch in which
106+
/// If this is an edition fixing lint, the edition in which
107107
/// this lint becomes obsolete
108-
pub epoch: Option<epoch::Epoch>,
108+
pub edition: Option<edition::Edition>,
109109
}
110110

111111
/// The target of the `by_name` map, which accounts for renaming/deprecation.
@@ -201,11 +201,11 @@ impl LintStore {
201201
sess: Option<&Session>,
202202
lints: Vec<FutureIncompatibleInfo>) {
203203

204-
for epoch in epoch::ALL_EPOCHS {
205-
let lints = lints.iter().filter(|f| f.epoch == Some(*epoch)).map(|f| f.id)
204+
for edition in edition::ALL_EDITIONS {
205+
let lints = lints.iter().filter(|f| f.edition == Some(*edition)).map(|f| f.id)
206206
.collect::<Vec<_>>();
207207
if !lints.is_empty() {
208-
self.register_group(sess, false, epoch.lint_name(), lints)
208+
self.register_group(sess, false, edition.lint_name(), lints)
209209
}
210210
}
211211

src/librustc/lint/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use session::{Session, DiagnosticMessageId};
4242
use std::hash;
4343
use syntax::ast;
4444
use syntax::codemap::MultiSpan;
45-
use syntax::epoch::Epoch;
45+
use syntax::edition::Edition;
4646
use syntax::symbol::Symbol;
4747
use syntax::visit as ast_visit;
4848
use syntax_pos::Span;
@@ -77,8 +77,8 @@ pub struct Lint {
7777
/// e.g. "imports that are never used"
7878
pub desc: &'static str,
7979

80-
/// Deny lint after this epoch
81-
pub epoch_deny: Option<Epoch>,
80+
/// Deny lint after this edition
81+
pub edition_deny: Option<Edition>,
8282
}
8383

8484
impl Lint {
@@ -88,8 +88,8 @@ impl Lint {
8888
}
8989

9090
pub fn default_level(&self, session: &Session) -> Level {
91-
if let Some(epoch_deny) = self.epoch_deny {
92-
if session.epoch() >= epoch_deny {
91+
if let Some(edition_deny) = self.edition_deny {
92+
if session.edition() >= edition_deny {
9393
return Level::Deny
9494
}
9595
}
@@ -100,20 +100,20 @@ impl Lint {
100100
/// Declare a static item of type `&'static Lint`.
101101
#[macro_export]
102102
macro_rules! declare_lint {
103-
($vis: vis $NAME: ident, $Level: ident, $desc: expr, $epoch: expr) => (
103+
($vis: vis $NAME: ident, $Level: ident, $desc: expr, $edition: expr) => (
104104
$vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
105105
name: stringify!($NAME),
106106
default_level: $crate::lint::$Level,
107107
desc: $desc,
108-
epoch_deny: Some($epoch)
108+
edition_deny: Some($edition)
109109
};
110110
);
111111
($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
112112
$vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
113113
name: stringify!($NAME),
114114
default_level: $crate::lint::$Level,
115115
desc: $desc,
116-
epoch_deny: None,
116+
edition_deny: None,
117117
};
118118
);
119119
}
@@ -499,8 +499,8 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
499499
// Check for future incompatibility lints and issue a stronger warning.
500500
let lints = sess.lint_store.borrow();
501501
if let Some(future_incompatible) = lints.future_incompatible(LintId::of(lint)) {
502-
let future = if let Some(epoch) = future_incompatible.epoch {
503-
format!("the {} epoch", epoch)
502+
let future = if let Some(edition) = future_incompatible.edition {
503+
format!("the {} edition", edition)
504504
} else {
505505
"a future release".to_owned()
506506
};

src/librustc/session/config.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use middle::cstore;
2828

2929
use syntax::ast::{self, IntTy, UintTy};
3030
use syntax::codemap::{FileName, FilePathMapping};
31-
use syntax::epoch::Epoch;
31+
use syntax::edition::Edition;
3232
use syntax::parse::token;
3333
use syntax::parse;
3434
use syntax::symbol::Symbol;
@@ -771,7 +771,7 @@ macro_rules! options {
771771
Some("`string` or `string=string`");
772772
pub const parse_lto: Option<&'static str> =
773773
Some("one of `thin`, `fat`, or omitted");
774-
pub const parse_epoch: Option<&'static str> =
774+
pub const parse_edition: Option<&'static str> =
775775
Some("one of: `2015`, `2018`");
776776
}
777777

@@ -780,7 +780,7 @@ macro_rules! options {
780780
use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer, Lto};
781781
use rustc_back::{LinkerFlavor, PanicStrategy, RelroLevel};
782782
use std::path::PathBuf;
783-
use syntax::epoch::Epoch;
783+
use syntax::edition::Edition;
784784

785785
$(
786786
pub fn $opt(cg: &mut $struct_name, v: Option<&str>) -> bool {
@@ -983,11 +983,11 @@ macro_rules! options {
983983
true
984984
}
985985

986-
fn parse_epoch(slot: &mut Epoch, v: Option<&str>) -> bool {
986+
fn parse_edition(slot: &mut Edition, v: Option<&str>) -> bool {
987987
match v {
988988
Some(s) => {
989-
let epoch = s.parse();
990-
if let Ok(parsed) = epoch {
989+
let edition = s.parse();
990+
if let Ok(parsed) = edition {
991991
*slot = parsed;
992992
true
993993
} else {
@@ -1280,10 +1280,10 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12801280
`everybody_loops` (all function bodies replaced with `loop {}`),
12811281
`hir` (the HIR), `hir,identified`, or
12821282
`hir,typed` (HIR with types for each node)."),
1283-
epoch: Epoch = (Epoch::Epoch2015, parse_epoch, [TRACKED],
1284-
"The epoch to build Rust with. Newer epochs may include features
1285-
that require breaking changes. The default epoch is 2015 (the first
1286-
epoch). Crates compiled with different epochs can be linked together."),
1283+
edition: Edition = (Edition::Edition2015, parse_edition, [TRACKED],
1284+
"The edition to build Rust with. Newer editions may include features
1285+
that require breaking changes. The default edition is 2015 (the first
1286+
edition). Crates compiled with different editions can be linked together."),
12871287
run_dsymutil: Option<bool> = (None, parse_opt_bool, [TRACKED],
12881288
"run `dsymutil` and delete intermediate object files"),
12891289
ui_testing: bool = (false, parse_bool, [UNTRACKED],
@@ -2258,7 +2258,7 @@ mod dep_tracking {
22582258
use std::hash::Hash;
22592259
use std::path::PathBuf;
22602260
use std::collections::hash_map::DefaultHasher;
2261-
use super::{CrateType, DebugInfoLevel, Epoch, ErrorOutputType, Lto, OptLevel, OutputTypes,
2261+
use super::{CrateType, DebugInfoLevel, Edition, ErrorOutputType, Lto, OptLevel, OutputTypes,
22622262
Passes, Sanitizer};
22632263
use syntax::feature_gate::UnstableFeatures;
22642264
use rustc_back::{PanicStrategy, RelroLevel};
@@ -2320,7 +2320,7 @@ mod dep_tracking {
23202320
impl_dep_tracking_hash_via_hash!(cstore::NativeLibraryKind);
23212321
impl_dep_tracking_hash_via_hash!(Sanitizer);
23222322
impl_dep_tracking_hash_via_hash!(Option<Sanitizer>);
2323-
impl_dep_tracking_hash_via_hash!(Epoch);
2323+
impl_dep_tracking_hash_via_hash!(Edition);
23242324

23252325
impl_dep_tracking_hash_for_sortable_vec_of!(String);
23262326
impl_dep_tracking_hash_for_sortable_vec_of!(PathBuf);

src/librustc/session/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_data_structures::sync::{Lrc, Lock};
3131
use syntax::ast::NodeId;
3232
use errors::{self, DiagnosticBuilder, DiagnosticId};
3333
use errors::emitter::{Emitter, EmitterWriter};
34-
use syntax::epoch::Epoch;
34+
use syntax::edition::Edition;
3535
use syntax::json::JsonEmitter;
3636
use syntax::feature_gate;
3737
use syntax::symbol::Symbol;
@@ -976,13 +976,13 @@ impl Session {
976976
self.opts.debugging_opts.teach && !self.parse_sess.span_diagnostic.code_emitted(code)
977977
}
978978

979-
/// Are we allowed to use features from the Rust 2018 epoch?
979+
/// Are we allowed to use features from the Rust 2018 edition?
980980
pub fn rust_2018(&self) -> bool {
981-
self.opts.debugging_opts.epoch >= Epoch::Epoch2018
981+
self.opts.debugging_opts.edition >= Edition::Edition2018
982982
}
983983

984-
pub fn epoch(&self) -> Epoch {
985-
self.opts.debugging_opts.epoch
984+
pub fn edition(&self) -> Edition {
985+
self.opts.debugging_opts.edition
986986
}
987987
}
988988

src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
648648
{
649649
let (mut krate, features) = syntax::config::features(krate, &sess.parse_sess,
650650
sess.opts.test,
651-
sess.opts.debugging_opts.epoch);
651+
sess.opts.debugging_opts.edition);
652652
// these need to be set "early" so that expansion sees `quote` if enabled.
653653
sess.init_features(features);
654654

src/librustc_lint/lib.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use rustc::session;
4848
use rustc::util;
4949

5050
use session::Session;
51-
use syntax::epoch::Epoch;
51+
use syntax::edition::Edition;
5252
use lint::LintId;
5353
use lint::FutureIncompatibleInfo;
5454

@@ -197,82 +197,82 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
197197
FutureIncompatibleInfo {
198198
id: LintId::of(PRIVATE_IN_PUBLIC),
199199
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
200-
epoch: None,
200+
edition: None,
201201
},
202202
FutureIncompatibleInfo {
203203
id: LintId::of(PUB_USE_OF_PRIVATE_EXTERN_CRATE),
204204
reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
205-
epoch: None,
205+
edition: None,
206206
},
207207
FutureIncompatibleInfo {
208208
id: LintId::of(PATTERNS_IN_FNS_WITHOUT_BODY),
209209
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
210-
epoch: None,
210+
edition: None,
211211
},
212212
FutureIncompatibleInfo {
213213
id: LintId::of(SAFE_EXTERN_STATICS),
214214
reference: "issue #36247 <https://github.com/rust-lang/rust/issues/36247>",
215-
epoch: None,
215+
edition: None,
216216
},
217217
FutureIncompatibleInfo {
218218
id: LintId::of(INVALID_TYPE_PARAM_DEFAULT),
219219
reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
220-
epoch: None,
220+
edition: None,
221221
},
222222
FutureIncompatibleInfo {
223223
id: LintId::of(LEGACY_DIRECTORY_OWNERSHIP),
224224
reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>",
225-
epoch: None,
225+
edition: None,
226226
},
227227
FutureIncompatibleInfo {
228228
id: LintId::of(LEGACY_IMPORTS),
229229
reference: "issue #38260 <https://github.com/rust-lang/rust/issues/38260>",
230-
epoch: None,
230+
edition: None,
231231
},
232232
FutureIncompatibleInfo {
233233
id: LintId::of(LEGACY_CONSTRUCTOR_VISIBILITY),
234234
reference: "issue #39207 <https://github.com/rust-lang/rust/issues/39207>",
235-
epoch: None,
235+
edition: None,
236236
},
237237
FutureIncompatibleInfo {
238238
id: LintId::of(MISSING_FRAGMENT_SPECIFIER),
239239
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
240-
epoch: None,
240+
edition: None,
241241
},
242242
FutureIncompatibleInfo {
243243
id: LintId::of(ILLEGAL_FLOATING_POINT_LITERAL_PATTERN),
244244
reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
245-
epoch: None,
245+
edition: None,
246246
},
247247
FutureIncompatibleInfo {
248248
id: LintId::of(ANONYMOUS_PARAMETERS),
249249
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
250-
epoch: None,
250+
edition: None,
251251
},
252252
FutureIncompatibleInfo {
253253
id: LintId::of(PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES),
254254
reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>",
255-
epoch: None,
255+
edition: None,
256256
},
257257
FutureIncompatibleInfo {
258258
id: LintId::of(LATE_BOUND_LIFETIME_ARGUMENTS),
259259
reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
260-
epoch: None,
260+
edition: None,
261261
},
262262
FutureIncompatibleInfo {
263263
id: LintId::of(SAFE_PACKED_BORROWS),
264264
reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
265-
epoch: None,
265+
edition: None,
266266
},
267267
FutureIncompatibleInfo {
268268
id: LintId::of(INCOHERENT_FUNDAMENTAL_IMPLS),
269269
reference: "issue #46205 <https://github.com/rust-lang/rust/issues/46205>",
270-
epoch: None,
270+
edition: None,
271271
},
272272
FutureIncompatibleInfo {
273273
id: LintId::of(TYVAR_BEHIND_RAW_POINTER),
274274
reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
275-
epoch: Some(Epoch::Epoch2018),
275+
edition: Some(Edition::Edition2018),
276276
}
277277
]);
278278

src/librustc_typeck/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
326326
if reached_raw_pointer
327327
&& !self.tcx.features().arbitrary_self_types {
328328
// this case used to be allowed by the compiler,
329-
// so we do a future-compat lint here for the 2015 epoch
329+
// so we do a future-compat lint here for the 2015 edition
330330
// (see https://github.com/rust-lang/rust/issues/46906)
331331
if self.tcx.sess.rust_2018() {
332332
span_err!(self.tcx.sess, span, E0908,

src/libsyntax/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use feature_gate::{feature_err, EXPLAIN_STMT_ATTR_SYNTAX, Features, get_features
1313
use {fold, attr};
1414
use ast;
1515
use codemap::Spanned;
16-
use epoch::Epoch;
16+
use edition::Edition;
1717
use parse::{token, ParseSess};
1818

1919
use ptr::P;
@@ -27,7 +27,7 @@ pub struct StripUnconfigured<'a> {
2727
}
2828

2929
// `cfg_attr`-process the crate's attributes and compute the crate's features.
30-
pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool, epoch: Epoch)
30+
pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool, edition: Edition)
3131
-> (ast::Crate, Features) {
3232
let features;
3333
{
@@ -47,7 +47,7 @@ pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool, epoc
4747
return (krate, Features::new());
4848
}
4949

50-
features = get_features(&sess.span_diagnostic, &krate.attrs, epoch);
50+
features = get_features(&sess.span_diagnostic, &krate.attrs, edition);
5151

5252
// Avoid reconfiguring malformed `cfg_attr`s
5353
if err_count == sess.span_diagnostic.err_count() {

0 commit comments

Comments
 (0)