Skip to content

Commit

Permalink
Auto merge of #2996 - rust-lang:rustup-2023-07-30, r=oli-obk
Browse files Browse the repository at this point in the history
Automatic sync from rustc
  • Loading branch information
bors committed Jul 30, 2023
2 parents 70757fb + a4bfcbe commit 2183cda
Show file tree
Hide file tree
Showing 653 changed files with 9,104 additions and 8,053 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: mingw-check-tidy
os: ubuntu-20.04-16core-64gb
env: {}
- name: x86_64-gnu-llvm-14
- name: x86_64-gnu-llvm-15
os: ubuntu-20.04-16core-64gb
env: {}
- name: x86_64-gnu-tools
Expand Down Expand Up @@ -293,10 +293,6 @@ jobs:
env:
RUST_BACKTRACE: 1
os: ubuntu-20.04-8core-32gb
- name: x86_64-gnu-llvm-14
env:
RUST_BACKTRACE: 1
os: ubuntu-20.04-8core-32gb
- name: x86_64-gnu-nopt
os: ubuntu-20.04-4core-16gb
env: {}
Expand Down
40 changes: 19 additions & 21 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -502,7 +502,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand All @@ -527,7 +527,7 @@ dependencies = [
"regex",
"rustc_tools_util",
"serde",
"syn 2.0.8",
"syn 2.0.27",
"tempfile",
"termize",
"tester",
Expand Down Expand Up @@ -842,7 +842,7 @@ version = "0.1.73"
dependencies = [
"itertools",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -943,7 +943,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -1309,7 +1309,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -2456,7 +2456,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -2643,7 +2643,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -3586,7 +3586,7 @@ dependencies = [
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"unic-langid",
]

Expand Down Expand Up @@ -3734,7 +3734,6 @@ dependencies = [
name = "rustc_interface"
version = "0.0.0"
dependencies = [
"atty",
"libloading",
"rustc-rayon",
"rustc-rayon-core",
Expand Down Expand Up @@ -3856,7 +3855,7 @@ version = "0.1.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"synstructure 0.13.0",
]

Expand Down Expand Up @@ -4198,7 +4197,6 @@ dependencies = [
name = "rustc_session"
version = "0.0.0"
dependencies = [
"atty",
"bitflags 1.3.2",
"getopts",
"libc",
Expand Down Expand Up @@ -4464,7 +4462,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -4631,7 +4629,7 @@ checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -4912,9 +4910,9 @@ dependencies = [

[[package]]
name = "syn"
version = "2.0.8"
version = "2.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9"
checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -4941,7 +4939,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"unicode-xid",
]

Expand Down Expand Up @@ -5091,7 +5089,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -5312,7 +5310,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -5742,7 +5740,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"wasm-bindgen-shared",
]

Expand Down Expand Up @@ -5776,7 +5774,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2947,6 +2947,7 @@ pub struct StaticItem {
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct ConstItem {
pub defaultness: Defaultness,
pub generics: Generics,
pub ty: P<Ty>,
pub expr: Option<P<Expr>>,
}
Expand Down Expand Up @@ -3058,6 +3059,7 @@ impl ItemKind {
match self {
Self::Fn(box Fn { generics, .. })
| Self::TyAlias(box TyAlias { generics, .. })
| Self::Const(box ConstItem { generics, .. })
| Self::Enum(_, generics)
| Self::Struct(_, generics)
| Self::Union(_, generics)
Expand Down
37 changes: 18 additions & 19 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,17 @@ impl MetaItem {
self.kind.value_str()
}

fn from_tokens<I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
fn from_tokens<'a, I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
where
I: Iterator<Item = TokenTree>,
I: Iterator<Item = &'a TokenTree>,
{
// FIXME: Share code with `parse_path`.
let path = match tokens.next().map(TokenTree::uninterpolate) {
Some(TokenTree::Token(
Token { kind: kind @ (token::Ident(..) | token::ModSep), span },
let path = match tokens.next().map(|tt| TokenTree::uninterpolate(tt)).as_deref() {
Some(&TokenTree::Token(
Token { kind: ref kind @ (token::Ident(..) | token::ModSep), span },
_,
)) => 'arm: {
let mut segments = if let token::Ident(name, _) = kind {
let mut segments = if let &token::Ident(name, _) = kind {
if let Some(TokenTree::Token(Token { kind: token::ModSep, .. }, _)) =
tokens.peek()
{
Expand All @@ -308,8 +308,8 @@ impl MetaItem {
thin_vec![PathSegment::path_root(span)]
};
loop {
if let Some(TokenTree::Token(Token { kind: token::Ident(name, _), span }, _)) =
tokens.next().map(TokenTree::uninterpolate)
if let Some(&TokenTree::Token(Token { kind: token::Ident(name, _), span }, _)) =
tokens.next().map(|tt| TokenTree::uninterpolate(tt)).as_deref()
{
segments.push(PathSegment::from_ident(Ident::new(name, span)));
} else {
Expand All @@ -326,7 +326,7 @@ impl MetaItem {
let span = span.with_hi(segments.last().unwrap().ident.span.hi());
Path { span, segments, tokens: None }
}
Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. }, _)) => match &*nt {
Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. }, _)) => match &**nt {
token::Nonterminal::NtMeta(item) => return item.meta(item.path.span),
token::Nonterminal::NtPath(path) => (**path).clone(),
_ => return None,
Expand Down Expand Up @@ -354,7 +354,7 @@ impl MetaItemKind {
}

fn list_from_tokens(tokens: TokenStream) -> Option<ThinVec<NestedMetaItem>> {
let mut tokens = tokens.into_trees().peekable();
let mut tokens = tokens.trees().peekable();
let mut result = ThinVec::new();
while tokens.peek().is_some() {
let item = NestedMetaItem::from_tokens(&mut tokens)?;
Expand All @@ -367,12 +367,12 @@ impl MetaItemKind {
Some(result)
}

fn name_value_from_tokens(
tokens: &mut impl Iterator<Item = TokenTree>,
fn name_value_from_tokens<'a>(
tokens: &mut impl Iterator<Item = &'a TokenTree>,
) -> Option<MetaItemKind> {
match tokens.next() {
Some(TokenTree::Delimited(_, Delimiter::Invisible, inner_tokens)) => {
MetaItemKind::name_value_from_tokens(&mut inner_tokens.into_trees())
MetaItemKind::name_value_from_tokens(&mut inner_tokens.trees())
}
Some(TokenTree::Token(token, _)) => {
MetaItemLit::from_token(&token).map(MetaItemKind::NameValue)
Expand All @@ -381,8 +381,8 @@ impl MetaItemKind {
}
}

fn from_tokens(
tokens: &mut iter::Peekable<impl Iterator<Item = TokenTree>>,
fn from_tokens<'a>(
tokens: &mut iter::Peekable<impl Iterator<Item = &'a TokenTree>>,
) -> Option<MetaItemKind> {
match tokens.peek() {
Some(TokenTree::Delimited(_, Delimiter::Parenthesis, inner_tokens)) => {
Expand Down Expand Up @@ -501,9 +501,9 @@ impl NestedMetaItem {
self.meta_item().is_some()
}

fn from_tokens<I>(tokens: &mut iter::Peekable<I>) -> Option<NestedMetaItem>
fn from_tokens<'a, I>(tokens: &mut iter::Peekable<I>) -> Option<NestedMetaItem>
where
I: Iterator<Item = TokenTree>,
I: Iterator<Item = &'a TokenTree>,
{
match tokens.peek() {
Some(TokenTree::Token(token, _))
Expand All @@ -513,9 +513,8 @@ impl NestedMetaItem {
return Some(NestedMetaItem::Lit(lit));
}
Some(TokenTree::Delimited(_, Delimiter::Invisible, inner_tokens)) => {
let inner_tokens = inner_tokens.clone();
tokens.next();
return NestedMetaItem::from_tokens(&mut inner_tokens.into_trees().peekable());
return NestedMetaItem::from_tokens(&mut inner_tokens.trees().peekable());
}
_ => {}
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast/src/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,10 +1149,11 @@ pub fn noop_flat_map_assoc_item<T: MutVisitor>(
}

fn visit_const_item<T: MutVisitor>(
ConstItem { defaultness, ty, expr }: &mut ConstItem,
ConstItem { defaultness, generics, ty, expr }: &mut ConstItem,
visitor: &mut T,
) {
visit_defaultness(defaultness, visitor);
visitor.visit_generics(generics);
visitor.visit_ty(ty);
visit_opt(expr, |expr| visitor.visit_expr(expr));
}
Expand Down
17 changes: 16 additions & 1 deletion compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ fn ident_can_begin_type(name: Symbol, span: Span, is_raw: bool) -> bool {
.contains(&name)
}

#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
// SAFETY: due to the `Clone` impl below, all fields of all variants other than
// `Interpolated` must impl `Copy`.
#[derive(PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
pub enum TokenKind {
/* Expression-operator symbols. */
Eq,
Expand Down Expand Up @@ -299,6 +301,19 @@ pub enum TokenKind {
Eof,
}

impl Clone for TokenKind {
fn clone(&self) -> Self {
// `TokenKind` would impl `Copy` if it weren't for `Interpolated`. So
// for all other variants, this implementation of `clone` is just like
// a copy. This is faster than the `derive(Clone)` version which has a
// separate path for every variant.
match self {
Interpolated(nt) => Interpolated(nt.clone()),
_ => unsafe { std::ptr::read(self) },
}
}
}

#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
pub struct Token {
pub kind: TokenKind,
Expand Down
Loading

0 comments on commit 2183cda

Please sign in to comment.