Skip to content

Commit 4b67506

Browse files
committed
Remove usage of extern_types feature gate
1 parent 681ea25 commit 4b67506

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

library/proc_macro/src/bridge/closure.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
//! Closure type (equivalent to `&mut dyn FnMut(A) -> R`) that's `repr(C)`.
22
3+
use std::marker::PhantomData;
4+
35
#[repr(C)]
46
pub struct Closure<'a, A, R> {
5-
call: unsafe extern "C" fn(&mut Env, A) -> R,
6-
env: &'a mut Env,
7+
call: unsafe extern "C" fn(*mut Env, A) -> R,
8+
env: *mut Env,
9+
_marker: PhantomData<&'a mut ()>,
710
}
811

9-
extern "C" {
10-
type Env;
11-
}
12+
struct Env;
1213

1314
impl<'a, A, R> !Sync for Closure<'a, A, R> {}
1415
impl<'a, A, R> !Send for Closure<'a, A, R> {}
1516

1617
impl<'a, A, R, F: FnMut(A) -> R> From<&'a mut F> for Closure<'a, A, R> {
1718
fn from(f: &'a mut F) -> Self {
18-
unsafe extern "C" fn call<A, R, F: FnMut(A) -> R>(env: &mut Env, arg: A) -> R {
19+
unsafe extern "C" fn call<A, R, F: FnMut(A) -> R>(env: *mut Env, arg: A) -> R {
1920
(*(env as *mut _ as *mut F))(arg)
2021
}
21-
Closure { call: call::<A, R, F>, env: unsafe { &mut *(f as *mut _ as *mut Env) } }
22+
Closure { call: call::<A, R, F>, env: f as *mut _ as *mut Env, _marker: PhantomData }
2223
}
2324
}
2425

library/proc_macro/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![cfg_attr(bootstrap, feature(const_fn_fn_ptr_basics))]
2525
#![feature(allow_internal_unstable)]
2626
#![feature(decl_macro)]
27-
#![feature(extern_types)]
2827
#![feature(negative_impls)]
2928
#![feature(restricted_std)]
3029
#![feature(rustc_attrs)]

0 commit comments

Comments
 (0)