Skip to content

Commit 7bb082d

Browse files
committed
libsyntax => 2018
1 parent 2596bc1 commit 7bb082d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+617
-574
lines changed

src/libsyntax/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "syntax"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "syntax"

src/libsyntax/ast.rs

+32-30
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
// The Rust abstract syntax tree.
22

3-
pub use self::GenericArgs::*;
4-
pub use self::UnsafeSource::*;
5-
pub use symbol::{Ident, Symbol as Name};
6-
pub use util::parser::ExprPrecedence;
7-
8-
use ext::hygiene::{Mark, SyntaxContext};
9-
use print::pprust;
10-
use ptr::P;
3+
pub use GenericArgs::*;
4+
pub use UnsafeSource::*;
5+
pub use crate::symbol::{Ident, Symbol as Name};
6+
pub use crate::util::parser::ExprPrecedence;
7+
8+
use crate::ext::hygiene::{Mark, SyntaxContext};
9+
use crate::print::pprust;
10+
use crate::ptr::P;
11+
use crate::source_map::{dummy_spanned, respan, Spanned};
12+
use crate::symbol::{keywords, Symbol};
13+
use crate::tokenstream::TokenStream;
14+
use crate::ThinVec;
15+
1116
use rustc_data_structures::indexed_vec::Idx;
1217
#[cfg(target_arch = "x86_64")]
1318
use rustc_data_structures::static_assert;
1419
use rustc_target::spec::abi::Abi;
15-
use source_map::{dummy_spanned, respan, Spanned};
16-
use symbol::{keywords, Symbol};
1720
use syntax_pos::{Span, DUMMY_SP};
18-
use tokenstream::TokenStream;
19-
use ThinVec;
2021

2122
use rustc_data_structures::fx::FxHashSet;
2223
use rustc_data_structures::sync::Lrc;
@@ -31,7 +32,7 @@ pub struct Label {
3132
}
3233

3334
impl fmt::Debug for Label {
34-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
35+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3536
write!(f, "label({:?})", self.ident)
3637
}
3738
}
@@ -43,7 +44,7 @@ pub struct Lifetime {
4344
}
4445

4546
impl fmt::Debug for Lifetime {
46-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
47+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4748
write!(
4849
f,
4950
"lifetime({}: {})",
@@ -74,13 +75,13 @@ impl<'a> PartialEq<&'a str> for Path {
7475
}
7576

7677
impl fmt::Debug for Path {
77-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
78+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7879
write!(f, "path({})", pprust::path_to_string(self))
7980
}
8081
}
8182

8283
impl fmt::Display for Path {
83-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
84+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8485
write!(f, "{}", pprust::path_to_string(self))
8586
}
8687
}
@@ -219,6 +220,7 @@ impl ParenthesizedArgs {
219220
// hack to ensure that we don't try to access the private parts of `NodeId` in this module
220221
mod node_id_inner {
221222
use rustc_data_structures::indexed_vec::Idx;
223+
use rustc_data_structures::newtype_index;
222224
newtype_index! {
223225
pub struct NodeId {
224226
ENCODABLE = custom
@@ -227,7 +229,7 @@ mod node_id_inner {
227229
}
228230
}
229231

230-
pub use self::node_id_inner::NodeId;
232+
pub use node_id_inner::NodeId;
231233

232234
impl NodeId {
233235
pub fn placeholder_from_mark(mark: Mark) -> Self {
@@ -240,7 +242,7 @@ impl NodeId {
240242
}
241243

242244
impl fmt::Display for NodeId {
243-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
245+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
244246
fmt::Display::fmt(&self.as_u32(), f)
245247
}
246248
}
@@ -478,7 +480,7 @@ pub struct Pat {
478480
}
479481

480482
impl fmt::Debug for Pat {
481-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
483+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
482484
write!(f, "pat({}: {})", self.id, pprust::pat_to_string(self))
483485
}
484486
}
@@ -676,7 +678,7 @@ pub enum BinOpKind {
676678

677679
impl BinOpKind {
678680
pub fn to_string(&self) -> &'static str {
679-
use self::BinOpKind::*;
681+
use BinOpKind::*;
680682
match *self {
681683
Add => "+",
682684
Sub => "-",
@@ -713,7 +715,7 @@ impl BinOpKind {
713715
}
714716

715717
pub fn is_comparison(&self) -> bool {
716-
use self::BinOpKind::*;
718+
use BinOpKind::*;
717719
match *self {
718720
Eq | Lt | Le | Ne | Gt | Ge => true,
719721
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
@@ -792,7 +794,7 @@ impl Stmt {
792794
}
793795

794796
impl fmt::Debug for Stmt {
795-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
797+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
796798
write!(
797799
f,
798800
"stmt({}: {})",
@@ -1030,7 +1032,7 @@ impl Expr {
10301032
}
10311033

10321034
impl fmt::Debug for Expr {
1033-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1035+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10341036
write!(f, "expr({}: {})", self.id, pprust::expr_to_string(self))
10351037
}
10361038
}
@@ -1438,13 +1440,13 @@ pub enum IntTy {
14381440
}
14391441

14401442
impl fmt::Debug for IntTy {
1441-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1443+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14421444
fmt::Display::fmt(self, f)
14431445
}
14441446
}
14451447

14461448
impl fmt::Display for IntTy {
1447-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1449+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14481450
write!(f, "{}", self.ty_to_string())
14491451
}
14501452
}
@@ -1519,13 +1521,13 @@ impl UintTy {
15191521
}
15201522

15211523
impl fmt::Debug for UintTy {
1522-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1524+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15231525
fmt::Display::fmt(self, f)
15241526
}
15251527
}
15261528

15271529
impl fmt::Display for UintTy {
1528-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1530+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15291531
write!(f, "{}", self.ty_to_string())
15301532
}
15311533
}
@@ -1547,7 +1549,7 @@ pub struct Ty {
15471549
}
15481550

15491551
impl fmt::Debug for Ty {
1550-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1552+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15511553
write!(f, "type({})", pprust::ty_to_string(self))
15521554
}
15531555
}
@@ -1832,7 +1834,7 @@ pub enum Defaultness {
18321834
}
18331835

18341836
impl fmt::Display for Unsafety {
1835-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1837+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18361838
fmt::Display::fmt(
18371839
match *self {
18381840
Unsafety::Normal => "normal",
@@ -1852,7 +1854,7 @@ pub enum ImplPolarity {
18521854
}
18531855

18541856
impl fmt::Debug for ImplPolarity {
1855-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1857+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18561858
match *self {
18571859
ImplPolarity::Positive => "positive".fmt(f),
18581860
ImplPolarity::Negative => "negative".fmt(f),

src/libsyntax/attr/builtin.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! Parsing and validation of builtin attributes
22
3-
use ast::{self, Attribute, MetaItem, Name, NestedMetaItemKind};
4-
use errors::{Applicability, Handler};
5-
use feature_gate::{Features, GatedCfg};
6-
use parse::ParseSess;
3+
use crate::ast::{self, Attribute, MetaItem, Name, NestedMetaItemKind};
4+
use crate::errors::{Applicability, Handler};
5+
use crate::feature_gate::{Features, GatedCfg};
6+
use crate::parse::ParseSess;
7+
78
use syntax_pos::{symbol::Symbol, Span};
89

910
use super::{list_contains_name, mark_used, MetaItemKind};
@@ -188,7 +189,7 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
188189
-> Option<Stability>
189190
where I: Iterator<Item = &'a Attribute>
190191
{
191-
use self::StabilityLevel::*;
192+
use StabilityLevel::*;
192193

193194
let mut stab: Option<Stability> = None;
194195
let mut rustc_depr: Option<RustcDeprecation> = None;
@@ -694,7 +695,7 @@ pub enum IntType {
694695
impl IntType {
695696
#[inline]
696697
pub fn is_signed(self) -> bool {
697-
use self::IntType::*;
698+
use IntType::*;
698699

699700
match self {
700701
SignedInt(..) => true,
@@ -711,7 +712,7 @@ impl IntType {
711712
/// structure layout, `packed` to remove padding, and `transparent` to elegate representation
712713
/// concerns to the only non-ZST field.
713714
pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
714-
use self::ReprAttr::*;
715+
use ReprAttr::*;
715716

716717
let mut acc = Vec::new();
717718
let diagnostic = &sess.span_diagnostic;
@@ -831,7 +832,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
831832
}
832833

833834
fn int_type_of_word(s: &str) -> Option<IntType> {
834-
use self::IntType::*;
835+
use IntType::*;
835836

836837
match s {
837838
"i8" => Some(SignedInt(ast::IntTy::I8)),

src/libsyntax/attr/mod.rs

+22-20
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22
33
mod builtin;
44

5-
pub use self::builtin::{
5+
pub use builtin::{
66
cfg_matches, contains_feature_attr, eval_condition, find_crate_name, find_deprecation,
77
find_repr_attrs, find_stability, find_unwind_attr, Deprecation, InlineAttr, OptimizeAttr,
88
IntType, ReprAttr, RustcDeprecation, Stability, StabilityLevel, UnwindAttr,
99
};
10-
pub use self::IntType::*;
11-
pub use self::ReprAttr::*;
12-
pub use self::StabilityLevel::*;
13-
14-
use ast;
15-
use ast::{AttrId, Attribute, AttrStyle, Name, Ident, Path, PathSegment};
16-
use ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
17-
use ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind, GenericParam};
18-
use mut_visit::visit_clobber;
19-
use source_map::{BytePos, Spanned, respan, dummy_spanned};
10+
pub use IntType::*;
11+
pub use ReprAttr::*;
12+
pub use StabilityLevel::*;
13+
14+
use crate::ast;
15+
use crate::ast::{AttrId, Attribute, AttrStyle, Name, Ident, Path, PathSegment};
16+
use crate::ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
17+
use crate::ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind, GenericParam};
18+
use crate::mut_visit::visit_clobber;
19+
use crate::source_map::{BytePos, Spanned, respan, dummy_spanned};
20+
use crate::parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
21+
use crate::parse::parser::Parser;
22+
use crate::parse::{self, ParseSess, PResult};
23+
use crate::parse::token::{self, Token};
24+
use crate::ptr::P;
25+
use crate::symbol::Symbol;
26+
use crate::ThinVec;
27+
use crate::tokenstream::{TokenStream, TokenTree, DelimSpan};
28+
use crate::GLOBALS;
29+
30+
use log::debug;
2031
use syntax_pos::{FileName, Span};
21-
use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
22-
use parse::parser::Parser;
23-
use parse::{self, ParseSess, PResult};
24-
use parse::token::{self, Token};
25-
use ptr::P;
26-
use symbol::Symbol;
27-
use ThinVec;
28-
use tokenstream::{TokenStream, TokenTree, DelimSpan};
29-
use GLOBALS;
3032

3133
use std::iter;
3234
use std::ops::DerefMut;

src/libsyntax/config.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
use attr::HasAttrs;
2-
use feature_gate::{
1+
use crate::attr::HasAttrs;
2+
use crate::feature_gate::{
33
feature_err,
44
EXPLAIN_STMT_ATTR_SYNTAX,
55
Features,
66
get_features,
77
GateIssue,
88
};
9-
use attr;
10-
use ast;
11-
use edition::Edition;
12-
use errors::Applicability;
13-
use mut_visit::*;
14-
use parse::{token, ParseSess};
15-
use ptr::P;
9+
use crate::attr;
10+
use crate::ast;
11+
use crate::edition::Edition;
12+
use crate::errors::Applicability;
13+
use crate::mut_visit::*;
14+
use crate::parse::{token, ParseSess};
15+
use crate::ptr::P;
16+
use crate::util::map_in_place::MapInPlace;
17+
1618
use smallvec::SmallVec;
17-
use util::map_in_place::MapInPlace;
1819

1920
/// A folder that strips out items that do not belong in the current configuration.
2021
pub struct StripUnconfigured<'a> {

src/libsyntax/diagnostics/metadata.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ use std::error::Error;
1212
use rustc_serialize::json::as_json;
1313

1414
use syntax_pos::{Span, FileName};
15-
use ext::base::ExtCtxt;
16-
use diagnostics::plugin::{ErrorMap, ErrorInfo};
15+
16+
use crate::ext::base::ExtCtxt;
17+
use crate::diagnostics::plugin::{ErrorMap, ErrorInfo};
1718

1819
/// JSON encodable/decodable version of `ErrorInfo`.
1920
#[derive(PartialEq, RustcDecodable, RustcEncodable)]
@@ -34,7 +35,7 @@ pub struct ErrorLocation {
3435

3536
impl ErrorLocation {
3637
/// Create an error location from a span.
37-
pub fn from_span(ecx: &ExtCtxt, sp: Span) -> ErrorLocation {
38+
pub fn from_span(ecx: &ExtCtxt<'_>, sp: Span) -> ErrorLocation {
3839
let loc = ecx.source_map().lookup_char_pos_adj(sp.lo());
3940
ErrorLocation {
4041
filename: loc.filename,
@@ -62,7 +63,7 @@ fn get_metadata_path(directory: PathBuf, name: &str) -> PathBuf {
6263
///
6364
/// For our current purposes the prefix is the target architecture and the name is a crate name.
6465
/// If an error occurs steps will be taken to ensure that no file is created.
65-
pub fn output_metadata(ecx: &ExtCtxt, prefix: &str, name: &str, err_map: &ErrorMap)
66+
pub fn output_metadata(ecx: &ExtCtxt<'_>, prefix: &str, name: &str, err_map: &ErrorMap)
6667
-> Result<(), Box<dyn Error>>
6768
{
6869
// Create the directory to place the file in.

0 commit comments

Comments
 (0)