diff options
| -rw-r--r-- | compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/tagged_ptr/impl_tag/tests.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs b/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs index deaaee4cc17..c9968959368 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs @@ -23,7 +23,7 @@ /// /// impl_tag! { /// // The type for which the `Tag` will be implemented -/// for SomeTag; +/// impl Tag for SomeTag; /// // You need to specify the `{value_of_the_type} <=> {tag}` relationship /// SomeTag::A <=> 0, /// SomeTag::B <=> 1, @@ -54,7 +54,7 @@ /// struct Flags { a: bool, b: bool } /// /// impl_tag! { -/// for Flags; +/// impl Tag for Flags; /// Flags { a: true, b: true } <=> 3, /// Flags { a: false, b: true } <=> 2, /// Flags { a: true, b: false } <=> 1, @@ -73,7 +73,7 @@ // struct Unit; // // impl_tag! { -// for Unit; +// impl Tag for Unit; // Unit <=> 0, // Unit <=> 1, // } @@ -87,7 +87,7 @@ // enum E { A, B }; // // impl_tag! { -// for E; +// impl Tag for E; // E::A <=> 0, // E::B <=> 0, // } @@ -104,14 +104,14 @@ /// } /// /// impl_tag! { -/// for E; +/// impl Tag for E; /// E::A <=> 0, /// } /// ``` #[macro_export] macro_rules! impl_tag { ( - for $Self:ty; + impl Tag for $Self:ty; $( $($path:ident)::* $( { $( $fields:tt )* })? <=> $tag:literal, )* diff --git a/compiler/rustc_data_structures/src/tagged_ptr/impl_tag/tests.rs b/compiler/rustc_data_structures/src/tagged_ptr/impl_tag/tests.rs index 26d1cf3b454..cd19b30ff53 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/impl_tag/tests.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/impl_tag/tests.rs @@ -4,22 +4,22 @@ fn bits_constant() { #[derive(Copy, Clone)] struct Unit; - impl_tag! { for Unit; Unit <=> 0, } + impl_tag! { impl Tag for Unit; Unit <=> 0, } assert_eq!(Unit::BITS, 0); #[derive(Copy, Clone)] struct Unit1; - impl_tag! { for Unit1; Unit1 <=> 1, } + impl_tag! { impl Tag for Unit1; Unit1 <=> 1, } assert_eq!(Unit1::BITS, 1); #[derive(Copy, Clone)] struct Unit2; - impl_tag! { for Unit2; Unit2 <=> 0b10, } + impl_tag! { impl Tag for Unit2; Unit2 <=> 0b10, } assert_eq!(Unit2::BITS, 2); #[derive(Copy, Clone)] struct Unit3; - impl_tag! { for Unit3; Unit3 <=> 0b100, } + impl_tag! { impl Tag for Unit3; Unit3 <=> 0b100, } assert_eq!(Unit3::BITS, 3); #[derive(Copy, Clone)] @@ -28,6 +28,6 @@ fn bits_constant() { B, C, } - impl_tag! { for Enum; Enum::A <=> 0b1, Enum::B <=> 0b1000, Enum::C <=> 0b10, } + impl_tag! { impl Tag for Enum; Enum::A <=> 0b1, Enum::B <=> 0b1000, Enum::C <=> 0b10, } assert_eq!(Enum::BITS, 4); } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index f520faa6a61..d13c71b78e4 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1627,7 +1627,7 @@ struct ParamTag { } impl_tag! { - for ParamTag; + impl Tag for ParamTag; ParamTag { reveal: traits::Reveal::UserFacing, constness: hir::Constness::NotConst } <=> 0, ParamTag { reveal: traits::Reveal::All, constness: hir::Constness::NotConst } <=> 1, ParamTag { reveal: traits::Reveal::UserFacing, constness: hir::Constness::Const } <=> 2, |
