1
Fork 0

Stop unloading syntax libraries

Externally loaded libraries are able to do things that cause references
to them to survive past the expansion phase (e.g. creating @-box cycles,
launching a task or storing something in task local data). As such, the
library has to stay loaded for the lifetime of the process.
This commit is contained in:
Steven Fackler 2014-02-11 22:43:23 -08:00 committed by Alex Crichton
parent cfb87f10ec
commit 6b429d07c9
4 changed files with 63 additions and 11 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -28,6 +28,7 @@ use visit;
use visit::Visitor;
use util::small_vector::SmallVector;
use std::cast;
use std::vec;
use std::unstable::dynamic_lib::DynamicLibrary;
use std::os;
@ -469,9 +470,12 @@ fn load_extern_macros(crate: &ast::ViewItem, fld: &mut MacroExpander) {
};
fld.extsbox.insert(name, extension);
});
}
fld.extsbox.insert_macro_crate(lib);
// Intentionally leak the dynamic library. We can't ever unload it
// since the library can do things that will outlive the expansion
// phase (e.g. make an @-box cycle or launch a task).
cast::forget(lib);
}
}
// expand a stmt