From b07a44d5c4f7f1a834c566e97911f35b01f671bf Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 8 May 2020 21:59:17 +0200 Subject: [PATCH] Document `global_alloc` --- src/librustc_middle/mir/interpret/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_middle/mir/interpret/mod.rs b/src/librustc_middle/mir/interpret/mod.rs index e663521eee826..4b13c6d1a37e0 100644 --- a/src/librustc_middle/mir/interpret/mod.rs +++ b/src/librustc_middle/mir/interpret/mod.rs @@ -515,6 +515,10 @@ impl<'tcx> TyCtxt<'tcx> { #[inline] #[track_caller] + /// Panics in case the `AllocId` is dangling. Since that is impossible for `AllocId`s in + /// constants (as all constants must pass interning and validation that check for dangling + /// ids), this function is frequently used throughout rustc, but should not be used within + /// the miri engine. pub fn global_alloc(&self, id: AllocId) -> GlobalAlloc<'tcx> { match self.get_global_alloc(id) { Some(alloc) => alloc,