We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using auto trait leakage, it's possible to fully leak opaque types outside of their defining scope
struct RequiresEq<T, U>(T, U); unsafe impl<T: Send> Send for RequiresEq<T, T> {} trait GetRhs<T> { fn get_rhs(self) -> T; } impl<T, U> GetRhs<U> for RequiresEq<T, U> { fn get_rhs(self) -> U { self.1 } } fn define<T, U: Default>() -> impl GetRhs<U> { RequiresEq(1u32, Default::default()) } fn req_send<T: Send>(x: T) -> T { x } fn main() { let opaque = define::<(), _>(); // Leak through an opaque type. let _hidden_ty: u32 = req_send(opaque).get_rhs(); }
#![feature(type_alias_impl_trait)] #![allow(unused)] #![crate_type = "rlib"] fn require_auto<T: Unpin>(x: T) -> T { x } struct WaddupGamers<T, U>(Option<T>, U); impl<T: Leak<Assoc = U>, U> Unpin for WaddupGamers<T, U> {} trait Leak { type Assoc; } impl<T> Leak for T { type Assoc = T; } fn define<T>() -> impl Sized { WaddupGamers(None::<T>, || ()) } type NameMe<T> = impl Sized; fn leak<T>() -> NameMe<T> where T: Leak<Assoc = NameMe<T>>, { let opaque = require_auto(define::<T>()); let closure; loop {} return closure; closure(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Using auto trait leakage, it's possible to fully leak opaque types outside of their defining scope
The text was updated successfully, but these errors were encountered: