creusot icon indicating copy to clipboard operation
creusot copied to clipboard

Shadowing by temporary variable

Open arnaudgolfouse opened this issue 11 months ago • 1 comments

The following:

pub fn testing(x: i32) {
    let _3 = 1;
    testing(x);
}

produces (approx):

module Test_Testing
  use prelude.Int32
  use prelude.Int
  let rec cfg testing  (x : int32) : ()
  =
  var _0 : ();
  var x : int32 = x;
  var _3 : ();
  {
    goto BB0
  }
  BB0 {
     _3 <- (  (1 : int32));
     _3 <- ( testing ( x));
    goto BB1
  }
  BB1 {
     _0 <- ( ());
    return _0
  }
end

The variable _3 is shadowed by a temporary.

arnaudgolfouse avatar Mar 01 '24 16:03 arnaudgolfouse

I didn't even know you could have that kind of variable in rust

xldenis avatar Mar 01 '24 19:03 xldenis