]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs
New upstream version 1.36.0+dfsg1
[rustc.git] / src / test / run-pass / nll / issue-53123-raw-pointer-cast.rs
1 // run-pass
2
3 #![allow(unused_variables)]
4
5 pub trait TryTransform {
6 fn try_transform<F>(self, f: F)
7 where
8 Self: Sized,
9 F: FnOnce(Self);
10 }
11
12 impl<'a, T> TryTransform for &'a mut T {
13 fn try_transform<F>(self, f: F)
14 where
15 // The bug was that `Self: Sized` caused the lifetime of `this` to "extend" for all
16 // of 'a instead of only lasting as long as the binding is used (for just that line).
17 Self: Sized,
18 F: FnOnce(Self),
19 {
20 let this: *mut T = self as *mut T;
21 f(self);
22 }
23 }
24
25 fn main() {
26 }