Finish transition from semitransparent to semiopaque for rustc_macro_transparency

This commit is contained in:
Martin Nordholts
2026-01-01 10:47:22 +01:00
parent 32fe406b5e
commit 8e3d60447c
23 changed files with 46 additions and 47 deletions

View File

@@ -618,7 +618,7 @@ impl DroplessArena {
/// - Types that are `!Copy` and `Drop`: these must be specified in the
/// arguments. The `TypedArena` will be used for them.
///
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
#[derive(Default)]
pub struct Arena<'tcx> {

View File

@@ -15,7 +15,7 @@ impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
});
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::MacroDef)]);
const TEMPLATE: AttributeTemplate =
template!(NameValueStr: ["transparent", "semitransparent", "opaque"]);
template!(NameValueStr: ["transparent", "semiopaque", "opaque"]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(nv) = args.name_value() else {
@@ -24,12 +24,12 @@ impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
};
match nv.value_as_str() {
Some(sym::transparent) => Some(Transparency::Transparent),
Some(sym::semiopaque | sym::semitransparent) => Some(Transparency::SemiOpaque),
Some(sym::semiopaque) => Some(Transparency::SemiOpaque),
Some(sym::opaque) => Some(Transparency::Opaque),
Some(_) => {
cx.expected_specific_argument_strings(
nv.value_span,
&[sym::transparent, sym::semitransparent, sym::opaque],
&[sym::transparent, sym::semiopaque, sym::opaque],
);
None
}

View File

@@ -744,43 +744,43 @@ unsafe extern "C" {
pub struct VaList<'a>(&'a mut VaListImpl);
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro stringify($($t:tt)*) {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro file() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro line() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro cfg() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro asm() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro global_asm() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro naked_asm() {
/* compiler built-in */
}

View File

@@ -233,7 +233,7 @@ pub(crate) fn compile_global_asm(
#![allow(internal_features)]
#![no_core]
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro global_asm() { /* compiler built-in */ }
global_asm!(r###"
"####,

View File

@@ -748,25 +748,25 @@ extern "C" {
pub struct VaList<'a>(&'a mut VaListImpl);
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro stringify($($t:tt)*) {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro file() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro line() {
/* compiler built-in */
}
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro cfg() {
/* compiler built-in */
}

View File

@@ -2041,7 +2041,6 @@ symbols! {
self_in_typedefs,
self_struct_ctor,
semiopaque,
semitransparent,
sha2,
sha3,
sha512_sm_x86,

View File

@@ -168,7 +168,7 @@ macro_rules! assert_ne {
/// ```
#[unstable(feature = "assert_matches", issue = "82775")]
#[allow_internal_unstable(panic_internals)]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro assert_matches {
($left:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
match $left {
@@ -401,7 +401,7 @@ macro_rules! debug_assert_ne {
/// ```
#[unstable(feature = "assert_matches", issue = "82775")]
#[allow_internal_unstable(assert_matches)]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro debug_assert_matches($($arg:tt)*) {
if $crate::cfg!(debug_assertions) {
$crate::assert_matches::assert_matches!($($arg)*);

View File

@@ -20,7 +20,7 @@ use crate::any::Any;
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
#[allow_internal_unstable(panic_internals, const_format_args)]
#[rustc_diagnostic_item = "core_panic_2015_macro"]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro panic_2015 {
() => (
$crate::panicking::panic("explicit panic")
@@ -47,7 +47,7 @@ pub macro panic_2015 {
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
#[allow_internal_unstable(panic_internals, const_format_args)]
#[rustc_diagnostic_item = "core_panic_2021_macro"]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro panic_2021 {
() => (
$crate::panicking::panic("explicit panic")
@@ -67,7 +67,7 @@ pub macro panic_2021 {
#[unstable(feature = "edition_panic", issue = "none", reason = "use unreachable!() instead")]
#[allow_internal_unstable(panic_internals)]
#[rustc_diagnostic_item = "unreachable_2015_macro"]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro unreachable_2015 {
() => (
$crate::panicking::panic("internal error: entered unreachable code")
@@ -85,7 +85,7 @@ pub macro unreachable_2015 {
#[doc(hidden)]
#[unstable(feature = "edition_panic", issue = "none", reason = "use unreachable!() instead")]
#[allow_internal_unstable(panic_internals)]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro unreachable_2021 {
() => (
$crate::panicking::panic("internal error: entered unreachable code")

View File

@@ -2027,7 +2027,7 @@ unsafe impl<T: ?Sized> PinCoerceUnsized for *mut T {}
///
/// [`Box::pin`]: ../../std/boxed/struct.Box.html#method.pin
#[stable(feature = "pin_macro", since = "1.68.0")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
#[allow_internal_unstable(super_let)]
#[rustc_diagnostic_item = "pin_macro"]
// `super` gets removed by rustfmt

View File

@@ -2662,7 +2662,7 @@ impl<F: FnPtr> fmt::Debug for F {
/// same requirements apply to field projections, even inside `addr_of!`. (In particular, it makes
/// no difference whether the pointer is null or dangling.)
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro addr_of($place:expr) {
&raw const $place
}
@@ -2752,7 +2752,7 @@ pub macro addr_of($place:expr) {
/// same requirements apply to field projections, even inside `addr_of_mut!`. (In particular, it
/// makes no difference whether the pointer is null or dangling.)
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro addr_of_mut($place:expr) {
&raw mut $place
}

View File

@@ -46,7 +46,7 @@
/// # }
/// ```
#[stable(feature = "ready_macro", since = "1.64.0")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro ready($e:expr) {
match $e {
$crate::task::Poll::Ready(t) => t,

View File

@@ -187,7 +187,7 @@ pub struct SimpleMessage {
/// Err(FAIL)
/// }
/// ```
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
#[unstable(feature = "io_const_error", issue = "133448")]
#[allow_internal_unstable(hint_must_use, io_const_error_internals)]
pub macro const_error($kind:expr, $message:expr $(,)?) {

View File

@@ -212,7 +212,7 @@ impl fmt::Display for PanicHookInfo<'_> {
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
#[allow_internal_unstable(libstd_sys_internals, const_format_args, panic_internals, rt)]
#[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_2015_macro")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro panic_2015 {
() => ({
$crate::rt::begin_panic("explicit panic")

View File

@@ -47,7 +47,7 @@ pub use lazy::Storage as LazyStorage;
)]
#[allow_internal_unsafe]
#[unstable(feature = "thread_local_internals", issue = "none")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro thread_local_inner {
// NOTE: we cannot import `LocalKey`, `LazyStorage` or `EagerStorage` with a `use` because that
// can shadow user provided type or type alias with a matching name. Please update the shadowing
@@ -110,7 +110,7 @@ pub macro thread_local_inner {
}},
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub(crate) macro local_pointer {
() => {},
($vis:vis static $name:ident; $($rest:tt)*) => {

View File

@@ -9,7 +9,7 @@ use crate::ptr;
#[allow_internal_unstable(thread_local_internals)]
#[allow_internal_unsafe]
#[unstable(feature = "thread_local_internals", issue = "none")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, $(#[$align_attr:meta])*, const $init:expr) => {{
@@ -119,7 +119,7 @@ impl<T> LazyStorage<T> {
// SAFETY: the target doesn't have threads.
unsafe impl<T> Sync for LazyStorage<T> {}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub(crate) macro local_pointer {
() => {},
($vis:vis static $name:ident; $($rest:tt)*) => {

View File

@@ -12,7 +12,7 @@ use crate::ptr::{self, NonNull};
#[allow_internal_unstable(thread_local_internals)]
#[allow_internal_unsafe]
#[unstable(feature = "thread_local_internals", issue = "none")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro thread_local_inner {
// NOTE: we cannot import `Storage` or `LocalKey` with a `use` because that can shadow user
// provided type or type alias with a matching name. Please update the shadowing test in
@@ -261,7 +261,7 @@ unsafe extern "C" fn destroy_value<T: 'static, const ALIGN: usize>(ptr: *mut u8)
});
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub(crate) macro local_pointer {
() => {},
($vis:vis static $name:ident; $($rest:tt)*) => {

View File

@@ -140,7 +140,7 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
#[doc(hidden)]
#[allow_internal_unstable(thread_local_internals)]
#[unstable(feature = "thread_local_internals", issue = "none")]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro thread_local_process_attrs {
// Parse `cfg_attr` to figure out whether it's a `rustc_align_static`.

View File

@@ -33,7 +33,7 @@ pub mod inner {
// Make sure the logic is not affected by re-exports.
mod unrenamed {
//@ !has krate/macro.unrenamed.html
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro unrenamed() {}
}
//@ has krate/inner/macro.unrenamed.html

View File

@@ -223,8 +223,8 @@ help: try changing it to one of the following valid forms of the attribute
|
LL | #[rustc_macro_transparency = "opaque"]
| ++++++++++
LL | #[rustc_macro_transparency = "semitransparent"]
| +++++++++++++++++++
LL | #[rustc_macro_transparency = "semiopaque"]
| ++++++++++++++
LL | #[rustc_macro_transparency = "transparent"]
| +++++++++++++++

View File

@@ -3,7 +3,7 @@
#![feature(decl_macro, rustc_attrs)]
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro m($a:lifetime) {
fn g<$a, 'a>() {} //~ ERROR the name `'a` is already used for a generic parameter
}

View File

@@ -11,7 +11,7 @@ mod type_params {
}
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro n($T:ident) {
fn g<$T: Clone>(t1: $T, t2: T) -> (T, $T) {
(t1.clone(), t2.clone())
@@ -43,7 +43,7 @@ mod lifetime_params {
}
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro n($a:lifetime) {
fn g<$a>(t1: &$a(), t2: &'a ()) -> (&'a (), &$a ()) {
(t1, t2)
@@ -75,7 +75,7 @@ mod const_params {
}
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro n($C:ident) {
fn g<const $C: usize>(t1: [(); $C], t2: [(); C]) -> ([(); C], [(); $C]) {
(t1, t2)

View File

@@ -5,7 +5,7 @@ macro transparent() {
struct Transparent;
let transparent = 0;
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro semiopaque() {
struct SemiOpaque;
let semiopaque = 0;

View File

@@ -8,7 +8,7 @@ mod type_params {
}
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro n($T:ident) {
fn g<$T: Clone>(t1: $T, t2: T) -> (T, $T) {
(t1.clone(), t2.clone())
@@ -40,7 +40,7 @@ mod lifetime_params {
}
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro n($a:lifetime) {
fn g<$a>(t1: &$a(), t2: &'a ()) -> (&'a (), &$a ()) {
(t1, t2)
@@ -72,7 +72,7 @@ mod const_params {
}
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
macro n($C:ident) {
fn g<const $C: usize>(t1: [(); $C], t2: [(); C]) -> ([(); C], [(); $C]) {
(t1, t2)