Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused macro rules #96149

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions compiler/rustc_errors/src/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,6 @@ impl EmissionGuarantee for ! {
/// instead of a `&DiagnosticBuilder<'a>`. This `forward!` macro makes
/// it easy to declare such methods on the builder.
macro_rules! forward {
// Forward pattern for &self -> &Self
(
$(#[$attrs:meta])*
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)?) -> &Self
) => {
$(#[$attrs])*
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
pub fn $n(&self, $($name: $ty),*) -> &Self {
self.diagnostic.$n($($name),*);
self
}
};

// Forward pattern for &mut self -> &mut Self
(
$(#[$attrs:meta])*
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_middle/src/ty/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,6 @@ macro_rules! impl_arena_allocatable_decoder {
}
}
};
([$ignore:ident $(, $attrs:ident)*]$args:tt) => {
impl_arena_allocatable_decoder!([$($attrs),*]$args);
};
}

macro_rules! impl_arena_allocatable_decoders {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_serialize/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ macro_rules! peel {
/// Therefore, the recursion depth is the binary logarithm of the number of
/// tokens to count, and the expanded tree is likewise very small.
macro_rules! count {
() => (0usize);
($one:tt) => (1usize);
($($pairs:tt $_p:tt)*) => (count!($($pairs)*) << 1usize);
($odd:tt $($rest:tt)*) => (count!($($rest)*) | 1usize);
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2249,10 +2249,6 @@ impl ToJson for Target {
let name = (stringify!($attr)).replace("_", "-");
d.insert(name, self.$attr.to_json());
}};
($attr:ident, $key_name:expr) => {{
let name = $key_name;
d.insert(name.into(), self.$attr.to_json());
}};
}

macro_rules! target_option_val {
Expand Down
24 changes: 0 additions & 24 deletions library/core/src/internal_macros.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// implements the unary operator "op &T"
// based on "op T" where T is expected to be `Copy`able
macro_rules! forward_ref_unop {
(impl $imp:ident, $method:ident for $t:ty) => {
forward_ref_unop!(impl $imp, $method for $t,
#[stable(feature = "rust1", since = "1.0.0")]);
};
(impl const $imp:ident, $method:ident for $t:ty) => {
forward_ref_unop!(impl const $imp, $method for $t,
#[stable(feature = "rust1", since = "1.0.0")]);
Expand Down Expand Up @@ -38,10 +34,6 @@ macro_rules! forward_ref_unop {
// implements binary operators "&T op U", "T op &U", "&T op &U"
// based on "T op U" where T and U are expected to be `Copy`able
macro_rules! forward_ref_binop {
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
forward_ref_binop!(impl $imp, $method for $t, $u,
#[stable(feature = "rust1", since = "1.0.0")]);
};
(impl const $imp:ident, $method:ident for $t:ty, $u:ty) => {
forward_ref_binop!(impl const $imp, $method for $t, $u,
#[stable(feature = "rust1", since = "1.0.0")]);
Expand Down Expand Up @@ -230,22 +222,6 @@ macro_rules! cfg_if {
}
};

// match if/else chains lacking a final `else`
(
if #[cfg( $i_meta:meta )] { $( $i_tokens:tt )* }
$(
else if #[cfg( $e_meta:meta )] { $( $e_tokens:tt )* }
)*
) => {
cfg_if! {
@__items () ;
(( $i_meta ) ( $( $i_tokens )* )) ,
$(
(( $e_meta ) ( $( $e_tokens )* )) ,
)*
}
};

// Internal and recursive macro to emit all the items
//
// Collects all the previous cfgs in a list at the beginning, so they can be
Expand Down
12 changes: 0 additions & 12 deletions library/core/tests/num/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ macro_rules! impls_defined {
}

macro_rules! test_op {
($fn_name:ident, $op:ident::$method:ident($lhs:literal, $rhs:literal), $result:literal, $($t:ty),+) => {
#[test]
fn $fn_name() {
impls_defined!($op, $method($lhs, $rhs), $result, $($t),+);
}
};
($fn_name:ident, $op:ident::$method:ident(&mut $lhs:literal, $rhs:literal), $result:literal, $($t:ty),+) => {
#[test]
fn $fn_name() {
impls_defined!($op, $method(&mut $lhs, $rhs), $result, $($t),+);
}
};
($fn_name:ident, $op:ident::$method:ident($lhs:literal), $result:literal, $($t:ty),+) => {
#[test]
fn $fn_name() {
Expand Down
1 change: 0 additions & 1 deletion library/proc_macro/src/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ macro_rules! quote_tt {
({$($t:tt)*}) => { Group::new(Delimiter::Brace, quote!($($t)*)) };
(,) => { Punct::new(',', Spacing::Alone) };
(.) => { Punct::new('.', Spacing::Alone) };
(:) => { Punct::new(':', Spacing::Alone) };
(;) => { Punct::new(';', Spacing::Alone) };
(!) => { Punct::new('!', Spacing::Alone) };
(<) => { Punct::new('<', Spacing::Alone) };
Expand Down