Skip to content

Commit 9a6bfa1

Browse files
committed
Merge remote-tracking branch 'origin' into codebuild-update-docker
2 parents 96800e1 + 6de3a73 commit 9a6bfa1

File tree

365 files changed

+5736
-3794
lines changed

Some content is hidden

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

365 files changed

+5736
-3794
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ concurrency:
3434
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
3535
# We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which
3636
# are all triggered on the same branch, but which should be able to run concurrently.
37-
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}
37+
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try') && github.sha) || github.ref }}
3838
cancel-in-progress: true
3939
env:
4040
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
@@ -80,7 +80,7 @@ jobs:
8080
# access the environment.
8181
#
8282
# We only enable the environment for the rust-lang/rust repository, so that CI works on forks.
83-
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
83+
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
8484
env:
8585
CI_JOB_NAME: ${{ matrix.name }}
8686
CI_JOB_DOC_URL: ${{ matrix.doc_url }}

Cargo.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,6 +2171,7 @@ dependencies = [
21712171
name = "lint-docs"
21722172
version = "0.1.0"
21732173
dependencies = [
2174+
"rustc-literal-escaper",
21742175
"serde_json",
21752176
"tempfile",
21762177
"walkdir",
@@ -3445,6 +3446,7 @@ dependencies = [
34453446
"rustc_macros",
34463447
"rustc_parse",
34473448
"rustc_parse_format",
3449+
"rustc_proc_macro",
34483450
"rustc_session",
34493451
"rustc_span",
34503452
"rustc_target",
@@ -3734,6 +3736,7 @@ dependencies = [
37343736
"rustc_lint_defs",
37353737
"rustc_macros",
37363738
"rustc_parse",
3739+
"rustc_proc_macro",
37373740
"rustc_serialize",
37383741
"rustc_session",
37393742
"rustc_span",
@@ -4082,6 +4085,7 @@ dependencies = [
40824085
"rustc_index",
40834086
"rustc_macros",
40844087
"rustc_middle",
4088+
"rustc_proc_macro",
40854089
"rustc_serialize",
40864090
"rustc_session",
40874091
"rustc_span",
@@ -4338,6 +4342,13 @@ dependencies = [
43384342
"tracing",
43394343
]
43404344

4345+
[[package]]
4346+
name = "rustc_proc_macro"
4347+
version = "0.0.0"
4348+
dependencies = [
4349+
"rustc-literal-escaper",
4350+
]
4351+
43414352
[[package]]
43424353
name = "rustc_query_impl"
43434354
version = "0.0.0"

compiler/rustc_ast/src/ast.rs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_data_structures::tagged_ptr::Tag;
3232
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3333
pub use rustc_span::AttrId;
3434
use rustc_span::source_map::{Spanned, respan};
35-
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
35+
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
3636
use thin_vec::{ThinVec, thin_vec};
3737

3838
pub use crate::format::*;
@@ -1526,6 +1526,19 @@ impl Expr {
15261526
| ExprKind::Struct(_)
15271527
)
15281528
}
1529+
1530+
/// Creates a dummy `P<Expr>`.
1531+
///
1532+
/// Should only be used when it will be replaced afterwards or as a return value when an error was encountered.
1533+
pub fn dummy() -> P<Expr> {
1534+
P(Expr {
1535+
id: DUMMY_NODE_ID,
1536+
kind: ExprKind::Dummy,
1537+
span: DUMMY_SP,
1538+
attrs: ThinVec::new(),
1539+
tokens: None,
1540+
})
1541+
}
15291542
}
15301543

15311544
#[derive(Clone, Encodable, Decodable, Debug)]
@@ -3417,9 +3430,9 @@ impl Item {
34173430
ItemKind::Fn(i) => Some(&i.generics),
34183431
ItemKind::TyAlias(i) => Some(&i.generics),
34193432
ItemKind::TraitAlias(_, generics, _)
3420-
| ItemKind::Enum(_, _, generics)
3421-
| ItemKind::Struct(_, _, generics)
3422-
| ItemKind::Union(_, _, generics) => Some(&generics),
3433+
| ItemKind::Enum(_, generics, _)
3434+
| ItemKind::Struct(_, generics, _)
3435+
| ItemKind::Union(_, generics, _) => Some(&generics),
34233436
ItemKind::Trait(i) => Some(&i.generics),
34243437
ItemKind::Impl(i) => Some(&i.generics),
34253438
}
@@ -3663,15 +3676,15 @@ pub enum ItemKind {
36633676
/// An enum definition (`enum`).
36643677
///
36653678
/// E.g., `enum Foo<A, B> { C<A>, D<B> }`.
3666-
Enum(Ident, EnumDef, Generics),
3679+
Enum(Ident, Generics, EnumDef),
36673680
/// A struct definition (`struct`).
36683681
///
36693682
/// E.g., `struct Foo<A> { x: A }`.
3670-
Struct(Ident, VariantData, Generics),
3683+
Struct(Ident, Generics, VariantData),
36713684
/// A union definition (`union`).
36723685
///
36733686
/// E.g., `union Foo<A, B> { x: A, y: B }`.
3674-
Union(Ident, VariantData, Generics),
3687+
Union(Ident, Generics, VariantData),
36753688
/// A trait declaration (`trait`).
36763689
///
36773690
/// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`.
@@ -3688,10 +3701,8 @@ pub enum ItemKind {
36883701
///
36893702
/// E.g., `foo!(..)`.
36903703
MacCall(P<MacCall>),
3691-
36923704
/// A macro definition.
36933705
MacroDef(Ident, MacroDef),
3694-
36953706
/// A single delegation item (`reuse`).
36963707
///
36973708
/// E.g. `reuse <Type as Trait>::name { target_expr_template }`.
@@ -3767,9 +3778,9 @@ impl ItemKind {
37673778
Self::Fn(box Fn { generics, .. })
37683779
| Self::TyAlias(box TyAlias { generics, .. })
37693780
| Self::Const(box ConstItem { generics, .. })
3770-
| Self::Enum(_, _, generics)
3771-
| Self::Struct(_, _, generics)
3772-
| Self::Union(_, _, generics)
3781+
| Self::Enum(_, generics, _)
3782+
| Self::Struct(_, generics, _)
3783+
| Self::Union(_, generics, _)
37733784
| Self::Trait(box Trait { generics, .. })
37743785
| Self::TraitAlias(_, generics, _)
37753786
| Self::Impl(box Impl { generics, .. }) => Some(generics),

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ impl HasAttrs for Stmt {
304304
}
305305

306306
/// A newtype around an AST node that implements the traits above if the node implements them.
307+
#[repr(transparent)]
307308
pub struct AstNodeWrapper<Wrapped, Tag> {
308309
pub wrapped: Wrapped,
309310
pub tag: PhantomData<Tag>,
@@ -313,6 +314,11 @@ impl<Wrapped, Tag> AstNodeWrapper<Wrapped, Tag> {
313314
pub fn new(wrapped: Wrapped, _tag: Tag) -> AstNodeWrapper<Wrapped, Tag> {
314315
AstNodeWrapper { wrapped, tag: Default::default() }
315316
}
317+
318+
pub fn from_mut(wrapped: &mut Wrapped, _tag: Tag) -> &mut AstNodeWrapper<Wrapped, Tag> {
319+
// SAFETY: `AstNodeWrapper` is `repr(transparent)` w.r.t `Wrapped`
320+
unsafe { &mut *<*mut Wrapped>::cast(wrapped) }
321+
}
316322
}
317323

318324
impl<Wrapped: HasNodeId, Tag> HasNodeId for AstNodeWrapper<Wrapped, Tag> {

0 commit comments

Comments
 (0)