- for proj in place_projections {
- match proj.elem {
- ProjectionElem::Deref => {
- if context.is_mutating_use() {
- // `not_const` errors out in const contexts
- self.not_const()
- }
- let base_ty = proj.base.ty(self.mir, self.tcx).ty;
- match self.mode {
- Mode::Fn => {},
- _ => {
- if let ty::RawPtr(_) = base_ty.sty {
- if !self.tcx.features().const_raw_ptr_deref {
- emit_feature_err(
- &self.tcx.sess.parse_sess, sym::const_raw_ptr_deref,
- self.span, GateIssue::Language,
- &format!(
- "dereferencing raw pointers in {}s is unstable",
- self.mode,
- ),
- );
- }
- }
+ fn visit_projection(
+ &mut self,
+ proj: &Projection<'tcx>,
+ context: PlaceContext,
+ location: Location,
+ ) {
+ debug!(
+ "visit_place_projection: proj={:?} context={:?} location={:?}",
+ proj, context, location,
+ );
+ self.super_projection(proj, context, location);
+ match proj.elem {
+ ProjectionElem::Deref => {
+ if context.is_mutating_use() {
+ // `not_const` errors out in const contexts
+ self.not_const()
+ }
+ let base_ty = proj.base.ty(self.body, self.tcx).ty;
+ match self.mode {
+ Mode::Fn => {},
+ _ => {
+ if let ty::RawPtr(_) = base_ty.sty {
+ if !self.tcx.features().const_raw_ptr_deref {
+ emit_feature_err(
+ &self.tcx.sess.parse_sess, sym::const_raw_ptr_deref,
+ self.span, GateIssue::Language,
+ &format!(
+ "dereferencing raw pointers in {}s is unstable",
+ self.mode,
+ ),
+ );