Skip to content

Commit 495203b

Browse files
committed
Auto merge of rust-lang#119211 - rust-lang:pa-master-1.77, r=Mark-Simulacrum
Bump stage0 to 1.76 beta r? `@Mark-Simulacrum`
2 parents 467d1d9 + f9f5840 commit 495203b

File tree

27 files changed

+455
-885
lines changed

27 files changed

+455
-885
lines changed

Diff for: compiler/rustc_codegen_cranelift/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#![cfg_attr(all(doc, not(bootstrap)), allow(internal_features))]
2-
#![cfg_attr(all(doc, not(bootstrap)), feature(rustdoc_internals))]
3-
#![cfg_attr(all(doc, not(bootstrap)), doc(rust_logo))]
1+
#![cfg_attr(doc, allow(internal_features))]
2+
#![cfg_attr(doc, feature(rustdoc_internals))]
3+
#![cfg_attr(doc, doc(rust_logo))]
44
#![feature(rustc_private)]
55
// Note: please avoid adding other feature gates where possible
66
#![warn(rust_2018_idioms)]

Diff for: compiler/rustc_codegen_llvm/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![feature(rustdoc_internals)]
99
#![doc(rust_logo)]
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
11-
#![cfg_attr(bootstrap, feature(c_str_literals))]
1211
#![feature(exact_size_is_empty)]
1312
#![feature(extern_types)]
1413
#![feature(hash_raw_entry)]

Diff for: compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs

-144
Original file line numberDiff line numberDiff line change
@@ -81,150 +81,6 @@
8181
/// E::A,
8282
/// }
8383
/// ```
84-
#[cfg(bootstrap)]
85-
#[macro_export]
86-
macro_rules! impl_tag {
87-
(
88-
impl Tag for $Self:ty;
89-
$(
90-
$($path:ident)::* $( { $( $fields:tt )* })?,
91-
)*
92-
) => {
93-
// Safety:
94-
// `bits_for_tags` is called on the same `${index()}`-es as
95-
// `into_usize` returns, thus `BITS` constant is correct.
96-
unsafe impl $crate::tagged_ptr::Tag for $Self {
97-
const BITS: u32 = $crate::tagged_ptr::bits_for_tags(&[
98-
$(
99-
${index()},
100-
$( ${ignore(path)} )*
101-
)*
102-
]);
103-
104-
#[inline]
105-
fn into_usize(self) -> usize {
106-
// This forbids use of repeating patterns (`Enum::V`&`Enum::V`, etc)
107-
// (or at least it should, see <https://github.com/rust-lang/rust/issues/110613>)
108-
#[forbid(unreachable_patterns)]
109-
match self {
110-
// `match` is doing heavy lifting here, by requiring exhaustiveness
111-
$(
112-
$($path)::* $( { $( $fields )* } )? => ${index()},
113-
)*
114-
}
115-
}
116-
117-
#[inline]
118-
unsafe fn from_usize(tag: usize) -> Self {
119-
match tag {
120-
$(
121-
${index()} => $($path)::* $( { $( $fields )* } )?,
122-
)*
123-
124-
// Safety:
125-
// `into_usize` only returns `${index()}` of the same
126-
// repetition as we are filtering above, thus if this is
127-
// reached, the safety contract of this function was
128-
// already breached.
129-
_ => unsafe {
130-
debug_assert!(
131-
false,
132-
"invalid tag: {tag}\
133-
(this is a bug in the caller of `from_usize`)"
134-
);
135-
std::hint::unreachable_unchecked()
136-
},
137-
}
138-
}
139-
140-
}
141-
};
142-
}
143-
144-
/// Implements [`Tag`] for a given type.
145-
///
146-
/// You can use `impl_tag` on structs and enums.
147-
/// You need to specify the type and all its possible values,
148-
/// which can only be paths with optional fields.
149-
///
150-
/// [`Tag`]: crate::tagged_ptr::Tag
151-
///
152-
/// # Examples
153-
///
154-
/// Basic usage:
155-
///
156-
/// ```
157-
/// #![feature(macro_metavar_expr)]
158-
/// use rustc_data_structures::{impl_tag, tagged_ptr::Tag};
159-
///
160-
/// #[derive(Copy, Clone, PartialEq, Debug)]
161-
/// enum SomeTag {
162-
/// A,
163-
/// B,
164-
/// X { v: bool },
165-
/// Y(bool, bool),
166-
/// }
167-
///
168-
/// impl_tag! {
169-
/// // The type for which the `Tag` will be implemented
170-
/// impl Tag for SomeTag;
171-
/// // You need to specify all possible tag values:
172-
/// SomeTag::A, // 0
173-
/// SomeTag::B, // 1
174-
/// // For variants with fields, you need to specify the fields:
175-
/// SomeTag::X { v: true }, // 2
176-
/// SomeTag::X { v: false }, // 3
177-
/// // For tuple variants use named syntax:
178-
/// SomeTag::Y { 0: true, 1: true }, // 4
179-
/// SomeTag::Y { 0: false, 1: true }, // 5
180-
/// SomeTag::Y { 0: true, 1: false }, // 6
181-
/// SomeTag::Y { 0: false, 1: false }, // 7
182-
/// }
183-
///
184-
/// // Tag values are assigned in order:
185-
/// assert_eq!(SomeTag::A.into_usize(), 0);
186-
/// assert_eq!(SomeTag::X { v: false }.into_usize(), 3);
187-
/// assert_eq!(SomeTag::Y(false, true).into_usize(), 5);
188-
///
189-
/// assert_eq!(unsafe { SomeTag::from_usize(1) }, SomeTag::B);
190-
/// assert_eq!(unsafe { SomeTag::from_usize(2) }, SomeTag::X { v: true });
191-
/// assert_eq!(unsafe { SomeTag::from_usize(7) }, SomeTag::Y(false, false));
192-
/// ```
193-
///
194-
/// Structs are supported:
195-
///
196-
/// ```
197-
/// #![feature(macro_metavar_expr)]
198-
/// # use rustc_data_structures::impl_tag;
199-
/// #[derive(Copy, Clone)]
200-
/// struct Flags { a: bool, b: bool }
201-
///
202-
/// impl_tag! {
203-
/// impl Tag for Flags;
204-
/// Flags { a: true, b: true },
205-
/// Flags { a: false, b: true },
206-
/// Flags { a: true, b: false },
207-
/// Flags { a: false, b: false },
208-
/// }
209-
/// ```
210-
///
211-
/// Not specifying all values results in a compile error:
212-
///
213-
/// ```compile_fail,E0004
214-
/// #![feature(macro_metavar_expr)]
215-
/// # use rustc_data_structures::impl_tag;
216-
/// #[derive(Copy, Clone)]
217-
/// enum E {
218-
/// A,
219-
/// B,
220-
/// }
221-
///
222-
/// impl_tag! {
223-
/// impl Tag for E;
224-
/// E::A,
225-
/// }
226-
/// ```
227-
#[cfg(not(bootstrap))]
22884
#[macro_export]
22985
macro_rules! impl_tag {
23086
(

Diff for: compiler/rustc_expand/src/expand.rs

-126
Original file line numberDiff line numberDiff line change
@@ -41,132 +41,6 @@ use std::path::PathBuf;
4141
use std::rc::Rc;
4242
use std::{iter, mem};
4343

44-
#[cfg(bootstrap)]
45-
macro_rules! ast_fragments {
46-
(
47-
$($Kind:ident($AstTy:ty) {
48-
$kind_name:expr;
49-
$(one fn $mut_visit_ast:ident; fn $visit_ast:ident;)?
50-
$(many fn $flat_map_ast_elt:ident; fn $visit_ast_elt:ident($($args:tt)*);)?
51-
fn $make_ast:ident;
52-
})*
53-
) => {
54-
/// A fragment of AST that can be produced by a single macro expansion.
55-
/// Can also serve as an input and intermediate result for macro expansion operations.
56-
pub enum AstFragment {
57-
OptExpr(Option<P<ast::Expr>>),
58-
MethodReceiverExpr(P<ast::Expr>),
59-
$($Kind($AstTy),)*
60-
}
61-
62-
/// "Discriminant" of an AST fragment.
63-
#[derive(Copy, Clone, PartialEq, Eq)]
64-
pub enum AstFragmentKind {
65-
OptExpr,
66-
MethodReceiverExpr,
67-
$($Kind,)*
68-
}
69-
70-
impl AstFragmentKind {
71-
pub fn name(self) -> &'static str {
72-
match self {
73-
AstFragmentKind::OptExpr => "expression",
74-
AstFragmentKind::MethodReceiverExpr => "expression",
75-
$(AstFragmentKind::$Kind => $kind_name,)*
76-
}
77-
}
78-
79-
fn make_from<'a>(self, result: Box<dyn MacResult + 'a>) -> Option<AstFragment> {
80-
match self {
81-
AstFragmentKind::OptExpr =>
82-
result.make_expr().map(Some).map(AstFragment::OptExpr),
83-
AstFragmentKind::MethodReceiverExpr =>
84-
result.make_expr().map(AstFragment::MethodReceiverExpr),
85-
$(AstFragmentKind::$Kind => result.$make_ast().map(AstFragment::$Kind),)*
86-
}
87-
}
88-
}
89-
90-
impl AstFragment {
91-
pub fn add_placeholders(&mut self, placeholders: &[NodeId]) {
92-
if placeholders.is_empty() {
93-
return;
94-
}
95-
match self {
96-
$($(AstFragment::$Kind(ast) => ast.extend(placeholders.iter().flat_map(|id| {
97-
${ignore(flat_map_ast_elt)}
98-
placeholder(AstFragmentKind::$Kind, *id, None).$make_ast()
99-
})),)?)*
100-
_ => panic!("unexpected AST fragment kind")
101-
}
102-
}
103-
104-
pub fn make_opt_expr(self) -> Option<P<ast::Expr>> {
105-
match self {
106-
AstFragment::OptExpr(expr) => expr,
107-
_ => panic!("AstFragment::make_* called on the wrong kind of fragment"),
108-
}
109-
}
110-
111-
pub fn make_method_receiver_expr(self) -> P<ast::Expr> {
112-
match self {
113-
AstFragment::MethodReceiverExpr(expr) => expr,
114-
_ => panic!("AstFragment::make_* called on the wrong kind of fragment"),
115-
}
116-
}
117-
118-
$(pub fn $make_ast(self) -> $AstTy {
119-
match self {
120-
AstFragment::$Kind(ast) => ast,
121-
_ => panic!("AstFragment::make_* called on the wrong kind of fragment"),
122-
}
123-
})*
124-
125-
fn make_ast<T: InvocationCollectorNode>(self) -> T::OutputTy {
126-
T::fragment_to_output(self)
127-
}
128-
129-
pub fn mut_visit_with<F: MutVisitor>(&mut self, vis: &mut F) {
130-
match self {
131-
AstFragment::OptExpr(opt_expr) => {
132-
visit_clobber(opt_expr, |opt_expr| {
133-
if let Some(expr) = opt_expr {
134-
vis.filter_map_expr(expr)
135-
} else {
136-
None
137-
}
138-
});
139-
}
140-
AstFragment::MethodReceiverExpr(expr) => vis.visit_method_receiver_expr(expr),
141-
$($(AstFragment::$Kind(ast) => vis.$mut_visit_ast(ast),)?)*
142-
$($(AstFragment::$Kind(ast) =>
143-
ast.flat_map_in_place(|ast| vis.$flat_map_ast_elt(ast)),)?)*
144-
}
145-
}
146-
147-
pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) {
148-
match self {
149-
AstFragment::OptExpr(Some(expr)) => visitor.visit_expr(expr),
150-
AstFragment::OptExpr(None) => {}
151-
AstFragment::MethodReceiverExpr(expr) => visitor.visit_method_receiver_expr(expr),
152-
$($(AstFragment::$Kind(ast) => visitor.$visit_ast(ast),)?)*
153-
$($(AstFragment::$Kind(ast) => for ast_elt in &ast[..] {
154-
visitor.$visit_ast_elt(ast_elt, $($args)*);
155-
})?)*
156-
}
157-
}
158-
}
159-
160-
impl<'a> MacResult for crate::mbe::macro_rules::ParserAnyMacro<'a> {
161-
$(fn $make_ast(self: Box<crate::mbe::macro_rules::ParserAnyMacro<'a>>)
162-
-> Option<$AstTy> {
163-
Some(self.make(AstFragmentKind::$Kind).$make_ast())
164-
})*
165-
}
166-
}
167-
}
168-
169-
#[cfg(not(bootstrap))]
17044
macro_rules! ast_fragments {
17145
(
17246
$($Kind:ident($AstTy:ty) {

Diff for: compiler/rustc_feature/src/accepted.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ declare_features! (
7777
/// Allows empty structs and enum variants with braces.
7878
(accepted, braced_empty_structs, "1.8.0", Some(29720)),
7979
/// Allows `c"foo"` literals.
80-
(accepted, c_str_literals, "CURRENT_RUSTC_VERSION", Some(105723)),
80+
(accepted, c_str_literals, "1.76.0", Some(105723)),
8181
/// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`.
8282
(accepted, cfg_attr_multi, "1.33.0", Some(54881)),
8383
/// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
@@ -341,7 +341,7 @@ declare_features! (
341341
(accepted, track_caller, "1.46.0", Some(47809)),
342342
/// Allows dyn upcasting trait objects via supertraits.
343343
/// Dyn upcasting is casting, e.g., `dyn Foo -> dyn Bar` where `Foo: Bar`.
344-
(accepted, trait_upcasting, "CURRENT_RUSTC_VERSION", Some(65991)),
344+
(accepted, trait_upcasting, "1.76.0", Some(65991)),
345345
/// Allows #[repr(transparent)] on univariant enums (RFC 2645).
346346
(accepted, transparent_enums, "1.42.0", Some(60405)),
347347
/// Allows indexing tuples.

Diff for: compiler/rustc_feature/src/removed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ declare_features! (
177177
/// Allows using the `#[register_attr]` attribute.
178178
(removed, register_attr, "1.65.0", Some(66080),
179179
Some("removed in favor of `#![register_tool]`")),
180-
(removed, rust_2018_preview, "CURRENT_RUSTC_VERSION", None,
180+
(removed, rust_2018_preview, "1.76.0", None,
181181
Some("2018 Edition preview is no longer relevant")),
182182
/// Allows using the macros:
183183
/// + `__diagnostic_used`

Diff for: compiler/rustc_feature/src/unstable.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ declare_features! (
204204
/// Allows using `#[lang = ".."]` attribute for linking items to special compiler logic.
205205
(internal, lang_items, "1.0.0", None),
206206
/// Changes `impl Trait` to capture all lifetimes in scope.
207-
(unstable, lifetime_capture_rules_2024, "CURRENT_RUSTC_VERSION", None),
207+
(unstable, lifetime_capture_rules_2024, "1.76.0", None),
208208
/// Allows `#[link(..., cfg(..))]`; perma-unstable per #37406
209209
(unstable, link_cfg, "1.14.0", None),
210210
/// Allows the `multiple_supertrait_upcastable` lint.
@@ -470,7 +470,7 @@ declare_features! (
470470
/// Allows using `#[repr(align(...))]` on function items
471471
(unstable, fn_align, "1.53.0", Some(82232)),
472472
/// Support delegating implementation of functions to other already implemented functions.
473-
(incomplete, fn_delegation, "CURRENT_RUSTC_VERSION", Some(118212)),
473+
(incomplete, fn_delegation, "1.76.0", Some(118212)),
474474
/// Allows defining gen blocks and `gen fn`.
475475
(unstable, gen_blocks, "1.75.0", Some(117078)),
476476
/// Infer generic args for both consts and types.
@@ -507,7 +507,7 @@ declare_features! (
507507
(unstable, let_chains, "1.37.0", Some(53667)),
508508
/// Allows using `#[link(kind = "link-arg", name = "...")]`
509509
/// to pass custom arguments to the linker.
510-
(unstable, link_arg_attribute, "CURRENT_RUSTC_VERSION", Some(99427)),
510+
(unstable, link_arg_attribute, "1.76.0", Some(99427)),
511511
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
512512
(unstable, lint_reasons, "1.31.0", Some(54503)),
513513
/// Give access to additional metadata about declarative macro meta-variables.
@@ -529,7 +529,7 @@ declare_features! (
529529
/// Allow negative trait implementations.
530530
(unstable, negative_impls, "1.44.0", Some(68318)),
531531
/// Allows the `!` pattern.
532-
(incomplete, never_patterns, "CURRENT_RUSTC_VERSION", Some(118155)),
532+
(incomplete, never_patterns, "1.76.0", Some(118155)),
533533
/// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
534534
(unstable, never_type, "1.13.0", Some(35121)),
535535
/// Allows diverging expressions to fall back to `!` rather than `()`.

Diff for: compiler/rustc_lint/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#![feature(min_specialization)]
4040
#![feature(never_type)]
4141
#![feature(rustc_attrs)]
42-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
4342
#![recursion_limit = "256"]
4443
#![deny(rustc::untranslatable_diagnostic)]
4544
#![deny(rustc::diagnostic_outside_of_impl)]

Diff for: compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#![feature(associated_type_bounds)]
5050
#![feature(rustc_attrs)]
5151
#![feature(control_flow_enum)]
52-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
5352
#![feature(trusted_step)]
5453
#![feature(try_blocks)]
5554
#![feature(try_reserve_kind)]

Diff for: library/alloc/src/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ impl<T: Clone, A: Allocator + Clone> Rc<T, A> {
17681768
/// assert!(ptr::eq(ptr, inner.as_ptr()));
17691769
/// ```
17701770
#[inline]
1771-
#[stable(feature = "arc_unwrap_or_clone", since = "CURRENT_RUSTC_VERSION")]
1771+
#[stable(feature = "arc_unwrap_or_clone", since = "1.76.0")]
17721772
pub fn unwrap_or_clone(this: Self) -> T {
17731773
Rc::try_unwrap(this).unwrap_or_else(|rc| (*rc).clone())
17741774
}

Diff for: library/alloc/src/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ impl<T: Clone, A: Allocator + Clone> Arc<T, A> {
21942194
/// assert!(ptr::eq(ptr, inner.as_ptr()));
21952195
/// ```
21962196
#[inline]
2197-
#[stable(feature = "arc_unwrap_or_clone", since = "CURRENT_RUSTC_VERSION")]
2197+
#[stable(feature = "arc_unwrap_or_clone", since = "1.76.0")]
21982198
pub fn unwrap_or_clone(this: Self) -> T {
21992199
Arc::try_unwrap(this).unwrap_or_else(|arc| (*arc).clone())
22002200
}

0 commit comments

Comments
 (0)