Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Add minimal example for issue 92537 #1073

Closed
wants to merge 1 commit into from

Conversation

Patrick-Poitras
Copy link
Contributor

@Patrick-Poitras
Copy link
Contributor Author

Seems to work on the runners? Uhhhh... Will report back once I figure this out.

@Alexendoo
Copy link
Member

As you spotted it's windows only and the runners use linux, so it'd have to be done in a .sh file

#!/usr/bin/env bash

rustc --target x86_64-pc-windows-msvc -C debuginfo=1 - <<EOF
use std::mem;
use std::marker::PhantomData;

struct LazyStack { }

impl Drop for LazyStack {
    fn drop(&mut self) {
        let g: *mut dyn FnMut(Option<NodeFactory<'_>>) -> Option<VNode<'_>> =
            unsafe {make_fat_ptr()};

        let clos = unsafe { &mut *g };
        clos(None);
    }
}

unsafe fn make_fat_ptr<T: ?Sized>() -> *mut T {
    mem::MaybeUninit::<*mut T>::uninit().assume_init()
}

enum VNode<'src> {
    Fragment(&'src [VNode<'src>]),
}

struct NodeFactory<'a> {
    _x : &'a PhantomData<u32>,
}

fn main() {
    let _x = LazyStack{};
} 
EOF

with the x86_64-pc-windows-msvc target being added via rustup in main and autofix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants