Fix overcapturing, unsafe extern blocks, and new unsafe ops
This commit is contained in:
parent
7f6873f64c
commit
e1819a889a
7 changed files with 24 additions and 16 deletions
|
@ -65,7 +65,7 @@ fn main() {
|
||||||
// linking, so we need to explicitly depend on the function.
|
// linking, so we need to explicitly depend on the function.
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn _rjem_je_zone_register();
|
fn _rjem_je_zone_register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl<'tcx> UniversalRegions<'tcx> {
|
||||||
|
|
||||||
/// Returns an iterator over all the RegionVids corresponding to
|
/// Returns an iterator over all the RegionVids corresponding to
|
||||||
/// universally quantified free regions.
|
/// universally quantified free regions.
|
||||||
pub(crate) fn universal_regions_iter(&self) -> impl Iterator<Item = RegionVid> {
|
pub(crate) fn universal_regions_iter(&self) -> impl Iterator<Item = RegionVid> + use<> {
|
||||||
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
|
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use super::ffi::{BasicBlock, Metadata, Module, Type, Value};
|
||||||
use crate::llvm::Bool;
|
use crate::llvm::Bool;
|
||||||
|
|
||||||
#[link(name = "llvm-wrapper", kind = "static")]
|
#[link(name = "llvm-wrapper", kind = "static")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
// Enzyme
|
// Enzyme
|
||||||
pub(crate) fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
|
pub(crate) fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
|
||||||
pub(crate) fn LLVMRustEraseInstUntilInclusive(BB: &BasicBlock, I: &Value);
|
pub(crate) fn LLVMRustEraseInstUntilInclusive(BB: &BasicBlock, I: &Value);
|
||||||
|
@ -18,7 +18,7 @@ extern "C" {
|
||||||
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
|
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
// Enzyme
|
// Enzyme
|
||||||
pub(crate) fn LLVMDumpModule(M: &Module);
|
pub(crate) fn LLVMDumpModule(M: &Module);
|
||||||
pub(crate) fn LLVMDumpValue(V: &Value);
|
pub(crate) fn LLVMDumpValue(V: &Value);
|
||||||
|
|
|
@ -133,7 +133,7 @@ impl<N: Idx, S: Idx + Ord, A: Annotation> Sccs<N, S, A> {
|
||||||
/// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after.
|
/// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after.
|
||||||
/// This is convenient when the edges represent dependencies: when you visit
|
/// This is convenient when the edges represent dependencies: when you visit
|
||||||
/// `S1`, the value for `S2` will already have been computed.
|
/// `S1`, the value for `S2` will already have been computed.
|
||||||
pub fn all_sccs(&self) -> impl Iterator<Item = S> {
|
pub fn all_sccs(&self) -> impl Iterator<Item = S> + use<N, S, A> {
|
||||||
(0..self.scc_data.len()).map(S::new)
|
(0..self.scc_data.len()).map(S::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl<T> pm::bridge::server::MessagePipe<T> for MessagePipe<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy {
|
fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy + use<> {
|
||||||
pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new(
|
pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new(
|
||||||
ecx.sess.opts.unstable_opts.proc_macro_execution_strategy
|
ecx.sess.opts.unstable_opts.proc_macro_execution_strategy
|
||||||
== ProcMacroExecutionStrategy::CrossThread,
|
== ProcMacroExecutionStrategy::CrossThread,
|
||||||
|
|
|
@ -171,6 +171,7 @@ fn configure_and_expand(
|
||||||
new_path.push(path);
|
new_path.push(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unsafe {
|
||||||
env::set_var(
|
env::set_var(
|
||||||
"PATH",
|
"PATH",
|
||||||
&env::join_paths(
|
&env::join_paths(
|
||||||
|
@ -179,6 +180,7 @@ fn configure_and_expand(
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the config for macro expansion
|
// Create the config for macro expansion
|
||||||
let recursion_limit = get_recursion_limit(pre_configured_attrs, sess);
|
let recursion_limit = get_recursion_limit(pre_configured_attrs, sess);
|
||||||
|
@ -216,8 +218,10 @@ fn configure_and_expand(
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
|
unsafe {
|
||||||
env::set_var("PATH", &old_path);
|
env::set_var("PATH", &old_path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
krate
|
krate
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,10 +51,14 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
|
||||||
fn restore_library_path() {
|
fn restore_library_path() {
|
||||||
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
|
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
|
||||||
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
|
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
|
||||||
|
unsafe {
|
||||||
env::set_var(&key, env);
|
env::set_var(&key, env);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
unsafe {
|
||||||
env::remove_var(&key);
|
env::remove_var(&key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads an environment variable and adds it to dependencies.
|
/// Reads an environment variable and adds it to dependencies.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue