Skip to content

Commit bd0b4f6

Browse files
committed
Auto merge of #65483 - Centril:rollup-txu60ss, r=Centril
Rollup of 8 pull requests Successful merges: - #65094 (Prefer statx on linux if available) - #65316 (make File::try_clone produce non-inheritable handles on Windows) - #65319 (InterpCx: make memory field public) - #65461 (Don't recommend ONCE_INIT in std::sync::Once) - #65465 (Move syntax::ext to a syntax_expand and refactor some attribute logic) - #65469 (Update libc to 0.2.64) - #65475 (add example for type_name) - #65478 (fmt::Write is about string slices, not byte slices) Failed merges: r? @ghost
2 parents c8fa82c + c10e5c4 commit bd0b4f6

File tree

133 files changed

+965
-638
lines changed

Some content is hidden

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

133 files changed

+965
-638
lines changed

Cargo.lock

+29-2
Original file line numberDiff line numberDiff line change
@@ -1713,9 +1713,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
17131713

17141714
[[package]]
17151715
name = "libc"
1716-
version = "0.2.62"
1716+
version = "0.2.64"
17171717
source = "registry+https://github.com/rust-lang/crates.io-index"
1718-
checksum = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
1718+
checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
17191719
dependencies = [
17201720
"rustc-std-workspace-core",
17211721
]
@@ -3112,6 +3112,7 @@ dependencies = [
31123112
"serialize",
31133113
"smallvec",
31143114
"syntax",
3115+
"syntax_expand",
31153116
"syntax_pos",
31163117
]
31173118

@@ -3427,6 +3428,7 @@ dependencies = [
34273428
"rustc_target",
34283429
"serialize",
34293430
"syntax",
3431+
"syntax_expand",
34303432
"syntax_pos",
34313433
"tempfile",
34323434
]
@@ -3559,6 +3561,7 @@ dependencies = [
35593561
"serialize",
35603562
"smallvec",
35613563
"syntax",
3564+
"syntax_expand",
35623565
"syntax_ext",
35633566
"syntax_pos",
35643567
"tempfile",
@@ -3630,6 +3633,7 @@ dependencies = [
36303633
"smallvec",
36313634
"stable_deref_trait",
36323635
"syntax",
3636+
"syntax_expand",
36333637
"syntax_pos",
36343638
]
36353639

@@ -3678,6 +3682,7 @@ dependencies = [
36783682
"rustc_index",
36793683
"rustc_target",
36803684
"syntax",
3685+
"syntax_expand",
36813686
"syntax_pos",
36823687
]
36833688

@@ -3695,6 +3700,7 @@ dependencies = [
36953700
"rustc",
36963701
"rustc_metadata",
36973702
"syntax",
3703+
"syntax_expand",
36983704
"syntax_pos",
36993705
]
37003706

@@ -3723,6 +3729,7 @@ dependencies = [
37233729
"rustc_metadata",
37243730
"smallvec",
37253731
"syntax",
3732+
"syntax_expand",
37263733
"syntax_pos",
37273734
]
37283735

@@ -4336,6 +4343,25 @@ dependencies = [
43364343
"syntax_pos",
43374344
]
43384345

4346+
[[package]]
4347+
name = "syntax_expand"
4348+
version = "0.0.0"
4349+
dependencies = [
4350+
"bitflags",
4351+
"lazy_static 1.3.0",
4352+
"log",
4353+
"rustc_data_structures",
4354+
"rustc_errors",
4355+
"rustc_index",
4356+
"rustc_lexer",
4357+
"rustc_target",
4358+
"scoped-tls",
4359+
"serialize",
4360+
"smallvec",
4361+
"syntax",
4362+
"syntax_pos",
4363+
]
4364+
43394365
[[package]]
43404366
name = "syntax_ext"
43414367
version = "0.0.0"
@@ -4347,6 +4373,7 @@ dependencies = [
43474373
"rustc_target",
43484374
"smallvec",
43494375
"syntax",
4376+
"syntax_expand",
43504377
"syntax_pos",
43514378
]
43524379

src/libcore/any.rs

+9
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,15 @@ impl TypeId {
445445
///
446446
/// The current implementation uses the same infrastructure as compiler
447447
/// diagnostics and debuginfo, but this is not guaranteed.
448+
///
449+
/// # Example
450+
///
451+
/// ```rust
452+
/// assert_eq!(
453+
/// std::any::type_name::<Option<String>>(),
454+
/// "core::option::Option<alloc::string::String>",
455+
/// );
456+
/// ```
448457
#[stable(feature = "type_name", since = "1.38.0")]
449458
#[rustc_const_unstable(feature = "const_type_name")]
450459
pub const fn type_name<T: ?Sized>() -> &'static str {

src/libcore/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ pub struct Error;
108108
/// [`io::Write`]: ../../std/io/trait.Write.html
109109
#[stable(feature = "rust1", since = "1.0.0")]
110110
pub trait Write {
111-
/// Writes a slice of bytes into this writer, returning whether the write
111+
/// Writes a string slice into this writer, returning whether the write
112112
/// succeeded.
113113
///
114-
/// This method can only succeed if the entire byte slice was successfully
114+
/// This method can only succeed if the entire string slice was successfully
115115
/// written, and this method will not return until all data has been
116116
/// written or an error occurs.
117117
///

src/librustc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ rustc_index = { path = "../librustc_index" }
2929
errors = { path = "../librustc_errors", package = "rustc_errors" }
3030
rustc_serialize = { path = "../libserialize", package = "serialize" }
3131
syntax = { path = "../libsyntax" }
32+
syntax_expand = { path = "../libsyntax_expand" }
3233
syntax_pos = { path = "../libsyntax_pos" }
3334
backtrace = "0.3.3"
3435
parking_lot = "0.9"

src/librustc/hir/def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::ty;
66
use crate::util::nodemap::DefIdMap;
77

88
use syntax::ast;
9-
use syntax::ext::base::MacroKind;
9+
use syntax_expand::base::MacroKind;
1010
use syntax::ast::NodeId;
1111
use syntax_pos::Span;
1212
use rustc_macros::HashStable;

src/librustc/hir/lowering.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ use syntax::ast;
6464
use syntax::ptr::P as AstP;
6565
use syntax::ast::*;
6666
use syntax::errors;
67-
use syntax::ext::base::SpecialDerives;
68-
use syntax::ext::hygiene::ExpnId;
67+
use syntax_expand::base::SpecialDerives;
6968
use syntax::print::pprust;
70-
use syntax::tokenstream::{TokenStream, TokenTree};
7169
use syntax::parse::token::{self, Nonterminal, Token};
70+
use syntax::tokenstream::{TokenStream, TokenTree};
7271
use syntax::sess::ParseSess;
7372
use syntax::source_map::{respan, ExpnData, ExpnKind, DesugaringKind, Spanned};
7473
use syntax::symbol::{kw, sym, Symbol};
7574
use syntax::visit::{self, Visitor};
75+
use syntax_pos::hygiene::ExpnId;
7676
use syntax_pos::Span;
7777

7878
const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;

src/librustc/hir/lowering/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use smallvec::SmallVec;
1818
use syntax::attr;
1919
use syntax::ast::*;
2020
use syntax::visit::{self, Visitor};
21-
use syntax::ext::base::SpecialDerives;
21+
use syntax_expand::base::SpecialDerives;
2222
use syntax::source_map::{respan, DesugaringKind, Spanned};
2323
use syntax::symbol::{kw, sym};
2424
use syntax_pos::Span;

src/librustc/hir/map/def_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::hir::map::definitions::*;
22
use crate::hir::def_id::DefIndex;
33

44
use syntax::ast::*;
5-
use syntax::ext::hygiene::ExpnId;
5+
use syntax_expand::hygiene::ExpnId;
66
use syntax::visit;
77
use syntax::symbol::{kw, sym};
88
use syntax::parse::token::{self, Token};

src/librustc/hir/map/definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::borrow::Borrow;
1717
use std::fmt::Write;
1818
use std::hash::Hash;
1919
use syntax::ast;
20-
use syntax::ext::hygiene::ExpnId;
20+
use syntax_expand::hygiene::ExpnId;
2121
use syntax::symbol::{Symbol, sym, InternedString};
2222
use syntax_pos::{Span, DUMMY_SP};
2323

src/librustc/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_data_structures::svh::Svh;
2020
use rustc_index::vec::IndexVec;
2121
use syntax::ast::{self, Name, NodeId};
2222
use syntax::source_map::Spanned;
23-
use syntax::ext::base::MacroKind;
23+
use syntax_expand::base::MacroKind;
2424
use syntax_pos::{Span, DUMMY_SP};
2525

2626
pub mod blocks;

src/librustc/ich/hcx.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::cell::RefCell;
1313

1414
use syntax::ast;
1515
use syntax::source_map::SourceMap;
16-
use syntax::ext::hygiene::SyntaxContext;
16+
use syntax_expand::hygiene::SyntaxContext;
1717
use syntax::symbol::Symbol;
1818
use syntax::tokenstream::DelimSpan;
1919
use syntax_pos::{Span, DUMMY_SP};

src/librustc/ich/impls_syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl_stable_hash_for!(enum ::syntax::ast::AsmDialect {
5959
Intel
6060
});
6161

62-
impl_stable_hash_for!(enum ::syntax::ext::base::MacroKind {
62+
impl_stable_hash_for!(enum ::syntax_expand::base::MacroKind {
6363
Bang,
6464
Attr,
6565
Derive,

src/librustc/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use syntax::ast;
3939
use syntax::source_map::{MultiSpan, ExpnKind, DesugaringKind};
4040
use syntax::early_buffered_lints::BufferedEarlyLintId;
4141
use syntax::edition::Edition;
42-
use syntax::ext::base::MacroKind;
42+
use syntax_expand::base::MacroKind;
4343
use syntax::symbol::{Symbol, sym};
4444
use syntax_pos::Span;
4545

src/librustc/session/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use errors::emitter::HumanReadableErrorType;
2424
use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter};
2525
use syntax::ast::{self, NodeId};
2626
use syntax::edition::Edition;
27-
use syntax::ext::allocator::AllocatorKind;
27+
use syntax_expand::allocator::AllocatorKind;
2828
use syntax::feature_gate::{self, AttributeType};
2929
use syntax::json::JsonEmitter;
3030
use syntax::source_map;

src/librustc/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use std::{mem, ptr};
4545
use std::ops::Range;
4646
use syntax::ast::{self, Name, Ident, NodeId};
4747
use syntax::attr;
48-
use syntax::ext::hygiene::ExpnId;
48+
use syntax_expand::hygiene::ExpnId;
4949
use syntax::symbol::{kw, sym, Symbol, InternedString};
5050
use syntax_pos::Span;
5151

src/librustc_codegen_llvm/allocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::ffi::CString;
33
use crate::attributes;
44
use libc::c_uint;
55
use rustc::ty::TyCtxt;
6-
use syntax::ext::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
6+
use syntax_expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
77

88
use crate::ModuleLlvm;
99
use crate::llvm::{self, False, True};

src/librustc_codegen_llvm/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extern crate rustc_driver as _;
3939

4040
#[macro_use] extern crate log;
4141
extern crate syntax;
42+
extern crate syntax_expand;
4243
extern crate syntax_pos;
4344
extern crate rustc_errors as errors;
4445

@@ -48,7 +49,7 @@ use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinModul
4849
use rustc_codegen_ssa::CompiledModule;
4950
use errors::{FatalError, Handler};
5051
use rustc::dep_graph::WorkProduct;
51-
use syntax::ext::allocator::AllocatorKind;
52+
use syntax_expand::allocator::AllocatorKind;
5253
use syntax_pos::symbol::InternedString;
5354
pub use llvm_util::target_features;
5455
use std::any::Any;

src/librustc_codegen_ssa/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tempfile = "3.1"
2121

2222
rustc_serialize = { path = "../libserialize", package = "serialize" }
2323
syntax = { path = "../libsyntax" }
24+
syntax_expand = { path = "../libsyntax_expand" }
2425
syntax_pos = { path = "../libsyntax_pos" }
2526
rustc = { path = "../librustc" }
2627
rustc_apfloat = { path = "../librustc_apfloat" }

src/librustc_codegen_ssa/back/symbol_export.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc::ty::query::Providers;
1414
use rustc::ty::subst::SubstsRef;
1515
use rustc::util::nodemap::{FxHashMap, DefIdMap};
1616
use rustc_index::vec::IndexVec;
17-
use syntax::ext::allocator::ALLOCATOR_METHODS;
17+
use syntax_expand::allocator::ALLOCATOR_METHODS;
1818

1919
pub type ExportedSymbols = FxHashMap<
2020
CrateNum,

src/librustc_codegen_ssa/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc_errors::{Handler, Level, FatalError, DiagnosticId, SourceMapperDyn};
2727
use rustc_errors::emitter::{Emitter};
2828
use rustc_target::spec::MergeFunctions;
2929
use syntax::attr;
30-
use syntax::ext::hygiene::ExpnId;
30+
use syntax_expand::hygiene::ExpnId;
3131
use syntax_pos::symbol::{Symbol, sym};
3232
use jobserver::{Client, Acquired};
3333

src/librustc_codegen_ssa/traits/backend.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc::ty::TyCtxt;
99
use rustc_codegen_utils::codegen_backend::CodegenBackend;
1010
use std::sync::Arc;
1111
use std::sync::mpsc;
12-
use syntax::ext::allocator::AllocatorKind;
12+
use syntax_expand::allocator::AllocatorKind;
1313
use syntax_pos::symbol::InternedString;
1414

1515
pub trait BackendTypes {

src/librustc_interface/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ rayon = { version = "0.3.0", package = "rustc-rayon" }
1515
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
1616
syntax = { path = "../libsyntax" }
1717
syntax_ext = { path = "../libsyntax_ext" }
18+
syntax_expand = { path = "../libsyntax_expand" }
1819
syntax_pos = { path = "../libsyntax_pos" }
1920
rustc_serialize = { path = "../libserialize", package = "serialize" }
2021
rustc = { path = "../librustc" }

src/librustc_interface/passes.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_traits;
3535
use rustc_typeck as typeck;
3636
use syntax::{self, ast, visit};
3737
use syntax::early_buffered_lints::BufferedEarlyLint;
38-
use syntax::ext::base::{NamedSyntaxExtension, ExtCtxt};
38+
use syntax_expand::base::{NamedSyntaxExtension, ExtCtxt};
3939
use syntax::mut_visit::MutVisitor;
4040
use syntax::parse::{self, PResult};
4141
use syntax::util::node_count::NodeCounter;
@@ -397,12 +397,12 @@ fn configure_and_expand_inner<'a>(
397397

398398
// Create the config for macro expansion
399399
let features = sess.features_untracked();
400-
let cfg = syntax::ext::expand::ExpansionConfig {
400+
let cfg = syntax_expand::expand::ExpansionConfig {
401401
features: Some(&features),
402402
recursion_limit: *sess.recursion_limit.get(),
403403
trace_mac: sess.opts.debugging_opts.trace_macros,
404404
should_test: sess.opts.test,
405-
..syntax::ext::expand::ExpansionConfig::default(crate_name.to_string())
405+
..syntax_expand::expand::ExpansionConfig::default(crate_name.to_string())
406406
};
407407

408408
let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver);
@@ -559,7 +559,7 @@ pub fn lower_to_hir(
559559

560560
// Discard hygiene data, which isn't required after lowering to HIR.
561561
if !sess.opts.debugging_opts.keep_hygiene_data {
562-
syntax::ext::hygiene::clear_syntax_context_map();
562+
syntax_expand::hygiene::clear_syntax_context_map();
563563
}
564564

565565
Ok(hir_forest)

src/librustc_metadata/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ rustc_index = { path = "../librustc_index" }
2222
rustc_serialize = { path = "../libserialize", package = "serialize" }
2323
stable_deref_trait = "1.0.0"
2424
syntax = { path = "../libsyntax" }
25+
syntax_expand = { path = "../libsyntax_expand" }
2526
syntax_pos = { path = "../libsyntax_pos" }

src/librustc_metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::{cmp, fs};
2626

2727
use syntax::ast;
2828
use syntax::attr;
29-
use syntax::ext::allocator::{global_allocator_spans, AllocatorKind};
29+
use syntax_expand::allocator::{global_allocator_spans, AllocatorKind};
3030
use syntax::symbol::{Symbol, sym};
3131
use syntax::{span_err, span_fatal};
3232
use syntax_pos::{Span, DUMMY_SP};

src/librustc_metadata/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_index::vec::IndexVec;
1111
use rustc::util::nodemap::FxHashMap;
1212
use rustc_data_structures::sync::{Lrc, RwLock, Lock, MetadataRef, AtomicCell};
1313
use syntax::ast;
14-
use syntax::ext::base::SyntaxExtension;
14+
use syntax_expand::base::SyntaxExtension;
1515
use syntax_pos;
1616
use proc_macro::bridge::client::ProcMacro;
1717

src/librustc_metadata/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ use syntax::attr;
3232
use syntax::ast::{self, Ident};
3333
use syntax::source_map::{self, respan, Spanned};
3434
use syntax::symbol::{Symbol, sym};
35-
use syntax::ext::base::{MacroKind, SyntaxExtensionKind, SyntaxExtension};
35+
use syntax_expand::base::{MacroKind, SyntaxExtensionKind, SyntaxExtension};
3636
use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, symbol::{InternedString}};
3737
use log::debug;
3838
use proc_macro::bridge::client::ProcMacro;
39-
use syntax::ext::proc_macro::{AttrProcMacro, ProcMacroDerive, BangProcMacro};
39+
use syntax_expand::proc_macro::{AttrProcMacro, ProcMacroDerive, BangProcMacro};
4040

4141
crate struct DecodeContext<'a, 'tcx> {
4242
opaque: opaque::Decoder<'a>,

src/librustc_metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_data_structures::sync::Lrc;
3131
use std::u32;
3232
use syntax::ast;
3333
use syntax::attr;
34-
use syntax::ext::proc_macro::is_proc_macro_attr;
34+
use syntax_expand::proc_macro::is_proc_macro_attr;
3535
use syntax::source_map::Spanned;
3636
use syntax::symbol::{kw, sym, Ident, Symbol};
3737
use syntax_pos::{self, FileName, SourceFile, Span};

0 commit comments

Comments
 (0)