]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/issue-53123-raw-pointer-cast.rs
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
[rust.git] / tests / ui / 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 }