@@ -138,9 +138,11 @@ impl<'tcx> Scalar<()> {
138138 "Scalar value {:#x} exceeds size of {} bytes" , data, size) ;
139139 }
140140
141+ /// Tag this scalar with `new_tag` if it is a pointer, leave it unchanged otherwise.
142+ ///
143+ /// Used by `MemPlace::replace_tag`.
141144 #[ inline]
142145 pub fn with_tag < Tag > ( self , new_tag : Tag ) -> Scalar < Tag > {
143- // Used by `MemPlace::replace_tag`
144146 match self {
145147 Scalar :: Ptr ( ptr) => Scalar :: Ptr ( ptr. with_tag ( new_tag) ) ,
146148 Scalar :: Raw { data, size } => Scalar :: Raw { data, size } ,
@@ -149,9 +151,11 @@ impl<'tcx> Scalar<()> {
149151}
150152
151153impl < ' tcx , Tag > Scalar < Tag > {
154+ /// Erase the tag from the scalar, if any.
155+ ///
156+ /// Used by error reporting code to avoid having the error type depend on `Tag`.
152157 #[ inline]
153158 pub fn erase_tag ( self ) -> Scalar {
154- // Used by error reporting code to avoid having the error type depend on `Tag`
155159 match self {
156160 Scalar :: Ptr ( ptr) => Scalar :: Ptr ( ptr. erase_tag ( ) ) ,
157161 Scalar :: Raw { data, size } => Scalar :: Raw { data, size } ,
@@ -472,10 +476,12 @@ impl<Tag> fmt::Display for ScalarMaybeUndef<Tag> {
472476}
473477
474478impl < ' tcx , Tag > ScalarMaybeUndef < Tag > {
479+ /// Erase the tag from the scalar, if any.
480+ ///
481+ /// Used by error reporting code to avoid having the error type depend on `Tag`.
475482 #[ inline]
476483 pub fn erase_tag ( self ) -> ScalarMaybeUndef
477484 {
478- // Used by error reporting code to avoid having the error type depend on `Tag`
479485 match self {
480486 ScalarMaybeUndef :: Scalar ( s) => ScalarMaybeUndef :: Scalar ( s. erase_tag ( ) ) ,
481487 ScalarMaybeUndef :: Undef => ScalarMaybeUndef :: Undef ,
0 commit comments