diff options
| author | Ralf Jung <post@ralfj.de> | 2024-08-05 21:05:51 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-08-06 11:08:14 +0200 |
| commit | 5783e73f4662595ccb3261c3cb42cdc45eb157e0 (patch) | |
| tree | 007722d43c83af61ddce3a9bec61782f71198438 /compiler/rustc_const_eval/src | |
| parent | 522af10cccd9c23f5147d123cd6373ae0aa0795d (diff) | |
make some Frame fields more private
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/stack.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/stack.rs b/compiler/rustc_const_eval/src/interpret/stack.rs index b5f55434d5a..5733e2316fd 100644 --- a/compiler/rustc_const_eval/src/interpret/stack.rs +++ b/compiler/rustc_const_eval/src/interpret/stack.rs @@ -61,10 +61,10 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> { // Function and callsite information //////////////////////////////////////////////////////////////////////////////// /// The MIR for the function called on this frame. - pub body: &'tcx mir::Body<'tcx>, + pub(super) body: &'tcx mir::Body<'tcx>, /// The def_id and args of the current function. - pub instance: ty::Instance<'tcx>, + pub(super) instance: ty::Instance<'tcx>, /// Extra data for the machine. pub extra: Extra, @@ -73,7 +73,7 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> { // Return place and locals //////////////////////////////////////////////////////////////////////////////// /// Work to perform when returning from this function. - pub return_to_block: StackPopCleanup, + return_to_block: StackPopCleanup, /// The location where the result of the current stack frame should be written to, /// and its layout in the caller. @@ -101,7 +101,7 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> { /// frames without cleanup code). /// /// Needs to be public because ConstProp does unspeakable things to it. - pub loc: Either<mir::Location, Span>, + pub(super) loc: Either<mir::Location, Span>, } #[derive(Clone, Copy, Eq, PartialEq, Debug)] // Miri debug-prints these @@ -269,6 +269,14 @@ impl<'tcx, Prov: Provenance, Extra> Frame<'tcx, Prov, Extra> { self.loc } + pub fn body(&self) -> &'tcx mir::Body<'tcx> { + self.body + } + + pub fn instance(&self) -> ty::Instance<'tcx> { + self.instance + } + /// Return the `SourceInfo` of the current instruction. pub fn current_source_info(&self) -> Option<&mir::SourceInfo> { self.loc.left().map(|loc| self.body.source_info(loc)) |
