Skip to content

Commit dd17220

Browse files
committed
Re-export more rustc_span::symbol things from rustc_span.
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
1 parent 1d35638 commit dd17220

File tree

329 files changed

+365
-609
lines changed

Some content is hidden

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

329 files changed

+365
-609
lines changed

compiler/rustc_abi/src/extern_abi/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::fmt;
22

33
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4-
use rustc_span::symbol::sym;
5-
use rustc_span::{Span, Symbol};
4+
use rustc_span::{Span, Symbol, sym};
65

76
#[cfg(test)]
87
mod tests;

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ use rustc_data_structures::sync::Lrc;
3131
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3232
pub use rustc_span::AttrId;
3333
use rustc_span::source_map::{Spanned, respan};
34-
use rustc_span::symbol::{Ident, Symbol, kw, sym};
35-
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
34+
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
3635
use thin_vec::{ThinVec, thin_vec};
3736

3837
pub use crate::format::*;

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use std::iter;
55
use std::sync::atomic::{AtomicU32, Ordering};
66

77
use rustc_index::bit_set::GrowableBitSet;
8-
use rustc_span::Span;
9-
use rustc_span::symbol::{Ident, Symbol, sym};
8+
use rustc_span::{Ident, Span, Symbol, sym};
109
use smallvec::{SmallVec, smallvec};
1110
use thin_vec::{ThinVec, thin_vec};
1211

compiler/rustc_ast/src/entry.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use rustc_span::Symbol;
2-
use rustc_span::symbol::sym;
1+
use rustc_span::{Symbol, sym};
32

43
use crate::attr::{self, AttributeExt};
54

compiler/rustc_ast/src/expand/allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_macros::HashStable_Generic;
2-
use rustc_span::symbol::{Symbol, sym};
2+
use rustc_span::{Symbol, sym};
33

44
#[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable_Generic)]
55
pub enum AllocatorKind {

compiler/rustc_ast/src/expand/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
22
33
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4+
use rustc_span::Ident;
45
use rustc_span::def_id::DefId;
5-
use rustc_span::symbol::Ident;
66

77
use crate::MetaItem;
88

compiler/rustc_ast/src/format.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use rustc_data_structures::fx::FxHashMap;
22
use rustc_macros::{Decodable, Encodable};
3-
use rustc_span::Span;
4-
use rustc_span::symbol::{Ident, Symbol};
3+
use rustc_span::{Ident, Span, Symbol};
54

65
use crate::Expr;
76
use crate::ptr::P;

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ use std::panic;
1313
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1414
use rustc_data_structures::stack::ensure_sufficient_stack;
1515
use rustc_data_structures::sync::Lrc;
16-
use rustc_span::Span;
1716
use rustc_span::source_map::Spanned;
18-
use rustc_span::symbol::Ident;
17+
use rustc_span::{Ident, Span};
1918
use smallvec::{Array, SmallVec, smallvec};
2019
use thin_vec::ThinVec;
2120

compiler/rustc_ast/src/token.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1111
use rustc_data_structures::sync::Lrc;
1212
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1313
use rustc_span::edition::Edition;
14+
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym};
1415
#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
1516
#[allow(hidden_glob_reexports)]
16-
use rustc_span::symbol::{Ident, Symbol};
17-
use rustc_span::symbol::{kw, sym};
18-
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
17+
use rustc_span::{Ident, Symbol};
1918

2019
use crate::ast;
2120
use crate::ptr::P;

compiler/rustc_ast/src/util/literal.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use std::{ascii, fmt, str};
55
use rustc_lexer::unescape::{
66
MixedUnit, Mode, byte_from_char, unescape_byte, unescape_char, unescape_mixed, unescape_unicode,
77
};
8-
use rustc_span::Span;
9-
use rustc_span::symbol::{Symbol, kw, sym};
8+
use rustc_span::{Span, Symbol, kw, sym};
109
use tracing::debug;
1110

1211
use crate::ast::{self, LitKind, MetaItemLit, StrStyle};

0 commit comments

Comments
 (0)