Skip to content

Commit 66c54d9

Browse files
authored
Merge pull request rust-lang#4182 from rust-lang/rustup-2025-02-07
Automatic Rustup
2 parents 0193a5a + 1a6fece commit 66c54d9

File tree

322 files changed

+4746
-2110
lines changed

Some content is hidden

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

322 files changed

+4746
-2110
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,6 +4064,7 @@ name = "rustc_lexer"
40644064
version = "0.0.0"
40654065
dependencies = [
40664066
"expect-test",
4067+
"memchr",
40674068
"unicode-properties",
40684069
"unicode-xid",
40694070
]

compiler/rustc_ast/src/ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
//! - [`UnOp`], [`BinOp`], and [`BinOpKind`]: Unary and binary operators.
2020
2121
use std::borrow::Cow;
22+
use std::sync::Arc;
2223
use std::{cmp, fmt};
2324

2425
pub use GenericArgs::*;
@@ -27,7 +28,6 @@ pub use rustc_ast_ir::{Movability, Mutability, Pinnedness};
2728
use rustc_data_structures::packed::Pu128;
2829
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2930
use rustc_data_structures::stack::ensure_sufficient_stack;
30-
use rustc_data_structures::sync::Lrc;
3131
use rustc_data_structures::tagged_ptr::Tag;
3232
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3333
pub use rustc_span::AttrId;
@@ -1611,7 +1611,7 @@ pub enum ExprKind {
16111611
/// Added for optimization purposes to avoid the need to escape
16121612
/// large binary blobs - should always behave like [`ExprKind::Lit`]
16131613
/// with a `ByteStr` literal.
1614-
IncludedBytes(Lrc<[u8]>),
1614+
IncludedBytes(Arc<[u8]>),
16151615

16161616
/// A `format_args!()` expression.
16171617
FormatArgs(P<FormatArgs>),
@@ -1904,9 +1904,9 @@ pub enum LitKind {
19041904
Str(Symbol, StrStyle),
19051905
/// A byte string (`b"foo"`). Not stored as a symbol because it might be
19061906
/// non-utf8, and symbols only allow utf8 strings.
1907-
ByteStr(Lrc<[u8]>, StrStyle),
1907+
ByteStr(Arc<[u8]>, StrStyle),
19081908
/// A C String (`c"foo"`). Guaranteed to only have `\0` at the end.
1909-
CStr(Lrc<[u8]>, StrStyle),
1909+
CStr(Arc<[u8]>, StrStyle),
19101910
/// A byte char (`b'f'`).
19111911
Byte(u8),
19121912
/// A character literal (`'a'`).

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
1010
use std::ops::DerefMut;
1111
use std::panic;
12+
use std::sync::Arc;
1213

1314
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1415
use rustc_data_structures::stack::ensure_sufficient_stack;
15-
use rustc_data_structures::sync::Lrc;
1616
use rustc_span::source_map::Spanned;
1717
use rustc_span::{Ident, Span};
1818
use smallvec::{Array, SmallVec, smallvec};
@@ -793,14 +793,14 @@ fn visit_tt<T: MutVisitor>(vis: &mut T, tt: &mut TokenTree) {
793793
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
794794
fn visit_tts<T: MutVisitor>(vis: &mut T, TokenStream(tts): &mut TokenStream) {
795795
if T::VISIT_TOKENS && !tts.is_empty() {
796-
let tts = Lrc::make_mut(tts);
796+
let tts = Arc::make_mut(tts);
797797
visit_vec(tts, |tree| visit_tt(vis, tree));
798798
}
799799
}
800800

801801
fn visit_attr_tts<T: MutVisitor>(vis: &mut T, AttrTokenStream(tts): &mut AttrTokenStream) {
802802
if T::VISIT_TOKENS && !tts.is_empty() {
803-
let tts = Lrc::make_mut(tts);
803+
let tts = Arc::make_mut(tts);
804804
visit_vec(tts, |tree| visit_attr_tt(vis, tree));
805805
}
806806
}
@@ -840,7 +840,7 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
840840
vis.visit_ident(ident);
841841
}
842842
token::Interpolated(nt) => {
843-
let nt = Lrc::make_mut(nt);
843+
let nt = Arc::make_mut(nt);
844844
visit_nonterminal(vis, nt);
845845
}
846846
_ => {}

compiler/rustc_ast/src/token.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::borrow::Cow;
22
use std::fmt;
3+
use std::sync::Arc;
34

45
pub use BinOpToken::*;
56
pub use LitKind::*;
@@ -8,7 +9,6 @@ pub use NtExprKind::*;
89
pub use NtPatKind::*;
910
pub use TokenKind::*;
1011
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
11-
use rustc_data_structures::sync::Lrc;
1212
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1313
use rustc_span::edition::Edition;
1414
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym};
@@ -451,7 +451,7 @@ pub enum TokenKind {
451451
/// The span in the surrounding `Token` is that of the metavariable in the
452452
/// macro's RHS. The span within the Nonterminal is that of the fragment
453453
/// passed to the macro at the call site.
454-
Interpolated(Lrc<Nonterminal>),
454+
Interpolated(Arc<Nonterminal>),
455455

456456
/// A doc comment token.
457457
/// `Symbol` is the doc comment's data excluding its "quotes" (`///`, `/**`, etc)
@@ -469,7 +469,7 @@ impl Clone for TokenKind {
469469
// a copy. This is faster than the `derive(Clone)` version which has a
470470
// separate path for every variant.
471471
match self {
472-
Interpolated(nt) => Interpolated(Lrc::clone(nt)),
472+
Interpolated(nt) => Interpolated(Arc::clone(nt)),
473473
_ => unsafe { std::ptr::read(self) },
474474
}
475475
}

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
//! ownership of the original.
1515
1616
use std::borrow::Cow;
17+
use std::sync::Arc;
1718
use std::{cmp, fmt, iter};
1819

1920
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
20-
use rustc_data_structures::sync::{self, Lrc};
21+
use rustc_data_structures::sync;
2122
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
2223
use rustc_serialize::{Decodable, Encodable};
2324
use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym};
@@ -119,11 +120,11 @@ impl ToAttrTokenStream for AttrTokenStream {
119120
/// of an actual `TokenStream` until it is needed.
120121
/// `Box` is here only to reduce the structure size.
121122
#[derive(Clone)]
122-
pub struct LazyAttrTokenStream(Lrc<Box<dyn ToAttrTokenStream>>);
123+
pub struct LazyAttrTokenStream(Arc<Box<dyn ToAttrTokenStream>>);
123124

124125
impl LazyAttrTokenStream {
125126
pub fn new(inner: impl ToAttrTokenStream + 'static) -> LazyAttrTokenStream {
126-
LazyAttrTokenStream(Lrc::new(Box::new(inner)))
127+
LazyAttrTokenStream(Arc::new(Box::new(inner)))
127128
}
128129

129130
pub fn to_attr_token_stream(&self) -> AttrTokenStream {
@@ -160,7 +161,7 @@ impl<CTX> HashStable<CTX> for LazyAttrTokenStream {
160161
/// during expansion to perform early cfg-expansion, and to process attributes
161162
/// during proc-macro invocations.
162163
#[derive(Clone, Debug, Default, Encodable, Decodable)]
163-
pub struct AttrTokenStream(pub Lrc<Vec<AttrTokenTree>>);
164+
pub struct AttrTokenStream(pub Arc<Vec<AttrTokenTree>>);
164165

165166
/// Like `TokenTree`, but for `AttrTokenStream`.
166167
#[derive(Clone, Debug, Encodable, Decodable)]
@@ -175,7 +176,7 @@ pub enum AttrTokenTree {
175176

176177
impl AttrTokenStream {
177178
pub fn new(tokens: Vec<AttrTokenTree>) -> AttrTokenStream {
178-
AttrTokenStream(Lrc::new(tokens))
179+
AttrTokenStream(Arc::new(tokens))
179180
}
180181

181182
/// Converts this `AttrTokenStream` to a plain `Vec<TokenTree>`. During
@@ -293,7 +294,7 @@ pub struct AttrsTarget {
293294
/// Today's `TokenTree`s can still contain AST via `token::Interpolated` for
294295
/// backwards compatibility.
295296
#[derive(Clone, Debug, Default, Encodable, Decodable)]
296-
pub struct TokenStream(pub(crate) Lrc<Vec<TokenTree>>);
297+
pub struct TokenStream(pub(crate) Arc<Vec<TokenTree>>);
297298

298299
/// Indicates whether a token can join with the following token to form a
299300
/// compound token. Used for conversions to `proc_macro::Spacing`. Also used to
@@ -412,7 +413,7 @@ impl PartialEq<TokenStream> for TokenStream {
412413

413414
impl TokenStream {
414415
pub fn new(tts: Vec<TokenTree>) -> TokenStream {
415-
TokenStream(Lrc::new(tts))
416+
TokenStream(Arc::new(tts))
416417
}
417418

418419
pub fn is_empty(&self) -> bool {
@@ -544,7 +545,7 @@ impl TokenStream {
544545
/// Push `tt` onto the end of the stream, possibly gluing it to the last
545546
/// token. Uses `make_mut` to maximize efficiency.
546547
pub fn push_tree(&mut self, tt: TokenTree) {
547-
let vec_mut = Lrc::make_mut(&mut self.0);
548+
let vec_mut = Arc::make_mut(&mut self.0);
548549

549550
if Self::try_glue_to_last(vec_mut, &tt) {
550551
// nothing else to do
@@ -557,7 +558,7 @@ impl TokenStream {
557558
/// token tree to the last token. (No other token trees will be glued.)
558559
/// Uses `make_mut` to maximize efficiency.
559560
pub fn push_stream(&mut self, stream: TokenStream) {
560-
let vec_mut = Lrc::make_mut(&mut self.0);
561+
let vec_mut = Arc::make_mut(&mut self.0);
561562

562563
let stream_iter = stream.0.iter().cloned();
563564

@@ -577,7 +578,7 @@ impl TokenStream {
577578
}
578579

579580
/// Desugar doc comments like `/// foo` in the stream into `#[doc =
580-
/// r"foo"]`. Modifies the `TokenStream` via `Lrc::make_mut`, but as little
581+
/// r"foo"]`. Modifies the `TokenStream` via `Arc::make_mut`, but as little
581582
/// as possible.
582583
pub fn desugar_doc_comments(&mut self) {
583584
if let Some(desugared_stream) = desugar_inner(self.clone()) {
@@ -596,7 +597,7 @@ impl TokenStream {
596597
) => {
597598
let desugared = desugared_tts(attr_style, data, span);
598599
let desugared_len = desugared.len();
599-
Lrc::make_mut(&mut stream.0).splice(i..i + 1, desugared);
600+
Arc::make_mut(&mut stream.0).splice(i..i + 1, desugared);
600601
modified = true;
601602
i += desugared_len;
602603
}
@@ -607,7 +608,7 @@ impl TokenStream {
607608
if let Some(desugared_delim_stream) = desugar_inner(delim_stream.clone()) {
608609
let new_tt =
609610
TokenTree::Delimited(sp, spacing, delim, desugared_delim_stream);
610-
Lrc::make_mut(&mut stream.0)[i] = new_tt;
611+
Arc::make_mut(&mut stream.0)[i] = new_tt;
611612
modified = true;
612613
}
613614
i += 1;

compiler/rustc_ast/src/util/literal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl LitKind {
121121
}
122122
token::ByteStrRaw(n) => {
123123
// Raw strings have no escapes so we can convert the symbol
124-
// directly to a `Lrc<u8>`.
124+
// directly to a `Arc<u8>`.
125125
let buf = symbol.as_str().to_owned().into_bytes();
126126
LitKind::ByteStr(buf.into(), StrStyle::Raw(n))
127127
}
@@ -142,7 +142,7 @@ impl LitKind {
142142
}
143143
token::CStrRaw(n) => {
144144
// Raw strings have no escapes so we can convert the symbol
145-
// directly to a `Lrc<u8>` after appending the terminating NUL
145+
// directly to a `Arc<u8>` after appending the terminating NUL
146146
// char.
147147
let mut buf = symbol.as_str().to_owned().into_bytes();
148148
buf.push(0);

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::assert_matches::assert_matches;
22
use std::ops::ControlFlow;
3+
use std::sync::Arc;
34

45
use rustc_ast::ptr::P as AstP;
56
use rustc_ast::*;
67
use rustc_ast_pretty::pprust::expr_to_string;
78
use rustc_data_structures::stack::ensure_sufficient_stack;
8-
use rustc_data_structures::sync::Lrc;
99
use rustc_hir as hir;
1010
use rustc_hir::HirId;
1111
use rustc_hir::def::{DefKind, Res};
@@ -147,7 +147,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
147147
ExprKind::IncludedBytes(bytes) => {
148148
let lit = self.arena.alloc(respan(
149149
self.lower_span(e.span),
150-
LitKind::ByteStr(Lrc::clone(bytes), StrStyle::Cooked),
150+
LitKind::ByteStr(Arc::clone(bytes), StrStyle::Cooked),
151151
));
152152
hir::ExprKind::Lit(lit)
153153
}
@@ -625,15 +625,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
625625
this.mark_span_with_reason(
626626
DesugaringKind::TryBlock,
627627
expr.span,
628-
Some(Lrc::clone(&this.allow_try_trait)),
628+
Some(Arc::clone(&this.allow_try_trait)),
629629
),
630630
expr,
631631
)
632632
} else {
633633
let try_span = this.mark_span_with_reason(
634634
DesugaringKind::TryBlock,
635635
this.tcx.sess.source_map().end_point(body.span),
636-
Some(Lrc::clone(&this.allow_try_trait)),
636+
Some(Arc::clone(&this.allow_try_trait)),
637637
);
638638

639639
(try_span, this.expr_unit(try_span))
@@ -742,7 +742,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
742742
let unstable_span = self.mark_span_with_reason(
743743
DesugaringKind::Async,
744744
self.lower_span(span),
745-
Some(Lrc::clone(&self.allow_gen_future)),
745+
Some(Arc::clone(&self.allow_gen_future)),
746746
);
747747
let resume_ty =
748748
self.make_lang_item_qpath(hir::LangItem::ResumeTy, unstable_span, None);
@@ -826,7 +826,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
826826
let unstable_span = self.mark_span_with_reason(
827827
DesugaringKind::Async,
828828
span,
829-
Some(Lrc::clone(&self.allow_gen_future)),
829+
Some(Arc::clone(&self.allow_gen_future)),
830830
);
831831
self.lower_attrs(inner_hir_id, &[Attribute {
832832
kind: AttrKind::Normal(ptr::P(NormalAttr::from_ident(Ident::new(
@@ -902,13 +902,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
902902

903903
let features = match await_kind {
904904
FutureKind::Future => None,
905-
FutureKind::AsyncIterator => Some(Lrc::clone(&self.allow_for_await)),
905+
FutureKind::AsyncIterator => Some(Arc::clone(&self.allow_for_await)),
906906
};
907907
let span = self.mark_span_with_reason(DesugaringKind::Await, await_kw_span, features);
908908
let gen_future_span = self.mark_span_with_reason(
909909
DesugaringKind::Await,
910910
full_span,
911-
Some(Lrc::clone(&self.allow_gen_future)),
911+
Some(Arc::clone(&self.allow_gen_future)),
912912
);
913913
let expr_hir_id = expr.hir_id;
914914

@@ -1952,13 +1952,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
19521952
let unstable_span = self.mark_span_with_reason(
19531953
DesugaringKind::QuestionMark,
19541954
span,
1955-
Some(Lrc::clone(&self.allow_try_trait)),
1955+
Some(Arc::clone(&self.allow_try_trait)),
19561956
);
19571957
let try_span = self.tcx.sess.source_map().end_point(span);
19581958
let try_span = self.mark_span_with_reason(
19591959
DesugaringKind::QuestionMark,
19601960
try_span,
1961-
Some(Lrc::clone(&self.allow_try_trait)),
1961+
Some(Arc::clone(&self.allow_try_trait)),
19621962
);
19631963

19641964
// `Try::branch(<expr>)`
@@ -2053,7 +2053,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
20532053
let unstable_span = self.mark_span_with_reason(
20542054
DesugaringKind::YeetExpr,
20552055
span,
2056-
Some(Lrc::clone(&self.allow_try_trait)),
2056+
Some(Arc::clone(&self.allow_try_trait)),
20572057
);
20582058

20592059
let from_yeet_expr = self.wrap_in_try_constructor(

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
#![warn(unreachable_pub)]
4242
// tidy-alphabetical-end
4343

44+
use std::sync::Arc;
45+
4446
use rustc_ast::node_id::NodeMap;
4547
use rustc_ast::{self as ast, *};
4648
use rustc_data_structures::captures::Captures;
4749
use rustc_data_structures::fingerprint::Fingerprint;
4850
use rustc_data_structures::sorted_map::SortedMap;
4951
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
50-
use rustc_data_structures::sync::Lrc;
5152
use rustc_data_structures::tagged_ptr::TaggedRef;
5253
use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey};
5354
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
@@ -144,11 +145,11 @@ struct LoweringContext<'a, 'hir> {
144145
#[cfg(debug_assertions)]
145146
node_id_to_local_id: NodeMap<hir::ItemLocalId>,
146147

147-
allow_try_trait: Lrc<[Symbol]>,
148-
allow_gen_future: Lrc<[Symbol]>,
149-
allow_async_iterator: Lrc<[Symbol]>,
150-
allow_for_await: Lrc<[Symbol]>,
151-
allow_async_fn_traits: Lrc<[Symbol]>,
148+
allow_try_trait: Arc<[Symbol]>,
149+
allow_gen_future: Arc<[Symbol]>,
150+
allow_async_iterator: Arc<[Symbol]>,
151+
allow_for_await: Arc<[Symbol]>,
152+
allow_async_fn_traits: Arc<[Symbol]>,
152153
}
153154

154155
impl<'a, 'hir> LoweringContext<'a, 'hir> {
@@ -738,7 +739,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
738739
&self,
739740
reason: DesugaringKind,
740741
span: Span,
741-
allow_internal_unstable: Option<Lrc<[Symbol]>>,
742+
allow_internal_unstable: Option<Arc<[Symbol]>>,
742743
) -> Span {
743744
self.tcx.with_stable_hashing_context(|hcx| {
744745
span.mark_with_reason(allow_internal_unstable, reason, span.edition(), hcx)
@@ -1686,7 +1687,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16861687
CoroutineKind::Async { return_impl_trait_id, .. } => (return_impl_trait_id, None),
16871688
CoroutineKind::Gen { return_impl_trait_id, .. } => (return_impl_trait_id, None),
16881689
CoroutineKind::AsyncGen { return_impl_trait_id, .. } => {
1689-
(return_impl_trait_id, Some(Lrc::clone(&self.allow_async_iterator)))
1690+
(return_impl_trait_id, Some(Arc::clone(&self.allow_async_iterator)))
16901691
}
16911692
};
16921693

0 commit comments

Comments
 (0)