diff options
| author | lcnr <rust@lcnr.de> | 2021-08-09 10:38:27 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2021-08-26 11:14:31 +0200 |
| commit | 977124590eb6a2230e168eed6391d6f70bfedaaf (patch) | |
| tree | 7fc7862a6aa419e4972d43a73977482b3ab2dd33 | |
| parent | bc0983df060c7131a3a7384cd26b6aef18096670 (diff) | |
| download | rust-977124590eb6a2230e168eed6391d6f70bfedaaf.tar.gz rust-977124590eb6a2230e168eed6391d6f70bfedaaf.zip | |
inline stuff
| -rw-r--r-- | compiler/rustc_middle/src/ty/consts/kind.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/consts/kind.rs b/compiler/rustc_middle/src/ty/consts/kind.rs index e6a6b7f8556..7188eed5445 100644 --- a/compiler/rustc_middle/src/ty/consts/kind.rs +++ b/compiler/rustc_middle/src/ty/consts/kind.rs @@ -28,6 +28,7 @@ pub struct Unevaluated<'tcx, P = Option<Promoted>> { } impl<'tcx> Unevaluated<'tcx> { + #[inline] pub fn shrink(self) -> Unevaluated<'tcx, ()> { debug_assert_eq!(self.promoted, None); Unevaluated { def: self.def, substs_: self.substs_, promoted: () } @@ -35,18 +36,21 @@ impl<'tcx> Unevaluated<'tcx> { } impl<'tcx> Unevaluated<'tcx, ()> { + #[inline] pub fn expand(self) -> Unevaluated<'tcx> { Unevaluated { def: self.def, substs_: self.substs_, promoted: None } } } impl<'tcx, P: Default> Unevaluated<'tcx, P> { + #[inline] pub fn new(def: ty::WithOptConstParam<DefId>, substs: SubstsRef<'tcx>) -> Unevaluated<'tcx, P> { Unevaluated { def, substs_: Some(substs), promoted: Default::default() } } } impl<'tcx, P: Default + PartialEq + fmt::Debug> Unevaluated<'tcx, P> { + #[inline] pub fn substs(self, tcx: TyCtxt<'tcx>) -> SubstsRef<'tcx> { self.substs_.unwrap_or_else(|| { // We must not use the parents default substs for promoted constants |
