diff options
| author | Ralf Jung <post@ralfj.de> | 2019-05-29 11:51:43 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-06-02 10:36:18 +0200 |
| commit | 0f96dd51c584bf7b93155a41ae31dee7777f1508 (patch) | |
| tree | 69d02bded777513af3ed9562408118fccdd105de /src | |
| parent | 6dd9389008e50040dcd97165b3503a0e1a10c987 (diff) | |
| download | rust-0f96dd51c584bf7b93155a41ae31dee7777f1508.tar.gz rust-0f96dd51c584bf7b93155a41ae31dee7777f1508.zip | |
turn comments into doc-comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/mir/interpret/value.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 1c24f5c116c..b8d6c122446 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -138,9 +138,11 @@ impl<'tcx> Scalar<()> { "Scalar value {:#x} exceeds size of {} bytes", data, size); } + /// Tag this scalar with `new_tag` if it is a pointer, leave it unchanged otherwise. + /// + /// Used by `MemPlace::replace_tag`. #[inline] pub fn with_tag<Tag>(self, new_tag: Tag) -> Scalar<Tag> { - // Used by `MemPlace::replace_tag` match self { Scalar::Ptr(ptr) => Scalar::Ptr(ptr.with_tag(new_tag)), Scalar::Raw { data, size } => Scalar::Raw { data, size }, @@ -149,9 +151,11 @@ impl<'tcx> Scalar<()> { } impl<'tcx, Tag> Scalar<Tag> { + /// Erase the tag from the scalar, if any. + /// + /// Used by error reporting code to avoid having the error type depend on `Tag`. #[inline] pub fn erase_tag(self) -> Scalar { - // Used by error reporting code to avoid having the error type depend on `Tag` match self { Scalar::Ptr(ptr) => Scalar::Ptr(ptr.erase_tag()), Scalar::Raw { data, size } => Scalar::Raw { data, size }, @@ -472,10 +476,12 @@ impl<Tag> fmt::Display for ScalarMaybeUndef<Tag> { } impl<'tcx, Tag> ScalarMaybeUndef<Tag> { + /// Erase the tag from the scalar, if any. + /// + /// Used by error reporting code to avoid having the error type depend on `Tag`. #[inline] pub fn erase_tag(self) -> ScalarMaybeUndef { - // Used by error reporting code to avoid having the error type depend on `Tag` match self { ScalarMaybeUndef::Scalar(s) => ScalarMaybeUndef::Scalar(s.erase_tag()), ScalarMaybeUndef::Undef => ScalarMaybeUndef::Undef, |
