Skip to content

Commit 96905d5

Browse files
committed
Use impl Tag for $T syntax for impl_tag!
1 parent 77c83c0 commit 96905d5

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
///
2424
/// impl_tag! {
2525
/// // The type for which the `Tag` will be implemented
26-
/// for SomeTag;
26+
/// impl Tag for SomeTag;
2727
/// // You need to specify the `{value_of_the_type} <=> {tag}` relationship
2828
/// SomeTag::A <=> 0,
2929
/// SomeTag::B <=> 1,
@@ -54,7 +54,7 @@
5454
/// struct Flags { a: bool, b: bool }
5555
///
5656
/// impl_tag! {
57-
/// for Flags;
57+
/// impl Tag for Flags;
5858
/// Flags { a: true, b: true } <=> 3,
5959
/// Flags { a: false, b: true } <=> 2,
6060
/// Flags { a: true, b: false } <=> 1,
@@ -73,7 +73,7 @@
7373
// struct Unit;
7474
//
7575
// impl_tag! {
76-
// for Unit;
76+
// impl Tag for Unit;
7777
// Unit <=> 0,
7878
// Unit <=> 1,
7979
// }
@@ -87,7 +87,7 @@
8787
// enum E { A, B };
8888
//
8989
// impl_tag! {
90-
// for E;
90+
// impl Tag for E;
9191
// E::A <=> 0,
9292
// E::B <=> 0,
9393
// }
@@ -104,14 +104,14 @@
104104
/// }
105105
///
106106
/// impl_tag! {
107-
/// for E;
107+
/// impl Tag for E;
108108
/// E::A <=> 0,
109109
/// }
110110
/// ```
111111
#[macro_export]
112112
macro_rules! impl_tag {
113113
(
114-
for $Self:ty;
114+
impl Tag for $Self:ty;
115115
$(
116116
$($path:ident)::* $( { $( $fields:tt )* })? <=> $tag:literal,
117117
)*

compiler/rustc_data_structures/src/tagged_ptr/impl_tag/tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ fn bits_constant() {
44

55
#[derive(Copy, Clone)]
66
struct Unit;
7-
impl_tag! { for Unit; Unit <=> 0, }
7+
impl_tag! { impl Tag for Unit; Unit <=> 0, }
88
assert_eq!(Unit::BITS, 0);
99

1010
#[derive(Copy, Clone)]
1111
struct Unit1;
12-
impl_tag! { for Unit1; Unit1 <=> 1, }
12+
impl_tag! { impl Tag for Unit1; Unit1 <=> 1, }
1313
assert_eq!(Unit1::BITS, 1);
1414

1515
#[derive(Copy, Clone)]
1616
struct Unit2;
17-
impl_tag! { for Unit2; Unit2 <=> 0b10, }
17+
impl_tag! { impl Tag for Unit2; Unit2 <=> 0b10, }
1818
assert_eq!(Unit2::BITS, 2);
1919

2020
#[derive(Copy, Clone)]
2121
struct Unit3;
22-
impl_tag! { for Unit3; Unit3 <=> 0b100, }
22+
impl_tag! { impl Tag for Unit3; Unit3 <=> 0b100, }
2323
assert_eq!(Unit3::BITS, 3);
2424

2525
#[derive(Copy, Clone)]
@@ -28,6 +28,6 @@ fn bits_constant() {
2828
B,
2929
C,
3030
}
31-
impl_tag! { for Enum; Enum::A <=> 0b1, Enum::B <=> 0b1000, Enum::C <=> 0b10, }
31+
impl_tag! { impl Tag for Enum; Enum::A <=> 0b1, Enum::B <=> 0b1000, Enum::C <=> 0b10, }
3232
assert_eq!(Enum::BITS, 4);
3333
}

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ struct ParamTag {
16271627
}
16281628

16291629
impl_tag! {
1630-
for ParamTag;
1630+
impl Tag for ParamTag;
16311631
ParamTag { reveal: traits::Reveal::UserFacing, constness: hir::Constness::NotConst } <=> 0,
16321632
ParamTag { reveal: traits::Reveal::All, constness: hir::Constness::NotConst } <=> 1,
16331633
ParamTag { reveal: traits::Reveal::UserFacing, constness: hir::Constness::Const } <=> 2,

0 commit comments

Comments
 (0)