diff options
| author | bors <bors@rust-lang.org> | 2019-02-12 12:10:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-12 12:10:10 +0000 |
| commit | c84e7976423bb910bb5eb5eecffc7e33a897a97f (patch) | |
| tree | 24570884cb7742fe817286a3cde2643722eb8c6a /src/libsyntax_ext/deriving/mod.rs | |
| parent | a54b5c7a645ead203d77e78245362f9e0f00dd3c (diff) | |
| parent | bbe524d7c1a1028737a93c7c71c508a68363b681 (diff) | |
| download | rust-c84e7976423bb910bb5eb5eecffc7e33a897a97f.tar.gz rust-c84e7976423bb910bb5eb5eecffc7e33a897a97f.zip | |
Auto merge of #58098 - oli-obk:maybe_allow_internal_unstable, r=petrochenkov
Require a list of features in `#[allow_internal_unstable]` The blanket-permission slip is not great and will likely give us trouble some point down the road.
Diffstat (limited to 'src/libsyntax_ext/deriving/mod.rs')
| -rw-r--r-- | src/libsyntax_ext/deriving/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs index 2c8a996cdb0..fff54814a38 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/libsyntax_ext/deriving/mod.rs @@ -136,11 +136,16 @@ fn call_intrinsic(cx: &ExtCtxt<'_>, intrinsic: &str, args: Vec<P<ast::Expr>>) -> P<ast::Expr> { - if cx.current_expansion.mark.expn_info().unwrap().allow_internal_unstable { + let intrinsic_allowed_via_allow_internal_unstable = cx + .current_expansion.mark.expn_info().unwrap() + .allow_internal_unstable.map_or(false, |features| features.iter().any(|&s| + s == "core_intrinsics" + )); + if intrinsic_allowed_via_allow_internal_unstable { span = span.with_ctxt(cx.backtrace()); } else { // Avoid instability errors with user defined curstom derives, cc #36316 let mut info = cx.current_expansion.mark.expn_info().unwrap(); - info.allow_internal_unstable = true; + info.allow_internal_unstable = Some(vec![Symbol::intern("core_intrinsics")].into()); let mark = Mark::fresh(Mark::root()); mark.set_expn_info(info); span = span.with_ctxt(SyntaxContext::empty().apply_mark(mark)); |
