Hack for "unsafety hygiene" -- push_unsafe!
and pop_unsafe!
.
Even after expansion, the generated expressions still track depth of such pushes (i.e. how often you have "pushed" without a corresponding "pop"), and we add a rule that in a context with a positive `push_unsafe!` depth, it is effectively an `unsafe` block context. (This way, we can inject code that uses `unsafe` features, but still contains within it a sub-expression that should inherit the outer safety checking setting, outside of the injected code.) This is a total hack; it not only needs a feature-gate, but probably should be feature-gated forever (if possible). ignore-pretty in test/run-pass/pushpop-unsafe-okay.rs
This commit is contained in:
parent
25281b121f
commit
1829fa5199
12 changed files with 301 additions and 16 deletions
|
@ -810,6 +810,8 @@ pub type SpannedIdent = Spanned<Ident>;
|
|||
pub enum BlockCheckMode {
|
||||
DefaultBlock,
|
||||
UnsafeBlock(UnsafeSource),
|
||||
PushUnsafeBlock(UnsafeSource),
|
||||
PopUnsafeBlock(UnsafeSource),
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue