File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1967,7 +1967,10 @@ impl<'tcx> Place<'tcx> {
19671967 Place :: Projection ( Box :: new ( PlaceProjection { base : self , elem } ) )
19681968 }
19691969
1970- /// Find the innermost `Local` from this `Place`.
1970+ /// Find the innermost `Local` from this `Place`, *if* it is either a local itself or
1971+ /// a single deref of a local.
1972+ ///
1973+ /// FIXME: can we safely swap the semantics of `fn base_local` below in here instead?
19711974 pub fn local ( & self ) -> Option < Local > {
19721975 match self {
19731976 Place :: Local ( local) |
@@ -1978,6 +1981,15 @@ impl<'tcx> Place<'tcx> {
19781981 _ => None ,
19791982 }
19801983 }
1984+
1985+ /// Find the innermost `Local` from this `Place`.
1986+ pub fn base_local ( & self ) -> Option < Local > {
1987+ match self {
1988+ Place :: Local ( local) => Some ( * local) ,
1989+ Place :: Projection ( box Projection { base, elem : _ } ) => base. base_local ( ) ,
1990+ Place :: Promoted ( ..) | Place :: Static ( ..) => None ,
1991+ }
1992+ }
19811993}
19821994
19831995impl < ' tcx > Debug for Place < ' tcx > {
You can’t perform that action at this time.
0 commit comments