Deny bare trait objects in src/libsyntax_ext
This commit is contained in:
parent
c946c2539e
commit
08c113abef
|
@ -50,7 +50,7 @@ const OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"];
|
||||||
pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
if !cx.ecfg.enable_asm() {
|
if !cx.ecfg.enable_asm() {
|
||||||
feature_gate::emit_feature_err(&cx.parse_sess,
|
feature_gate::emit_feature_err(&cx.parse_sess,
|
||||||
"asm",
|
"asm",
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub fn expand_assert<'cx>(
|
||||||
cx: &'cx mut ExtCtxt,
|
cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree],
|
tts: &[TokenTree],
|
||||||
) -> Box<MacResult + 'cx> {
|
) -> Box<dyn MacResult + 'cx> {
|
||||||
let mut parser = cx.new_parser_from_tts(tts);
|
let mut parser = cx.new_parser_from_tts(tts);
|
||||||
let cond_expr = panictry!(parser.parse_expr());
|
let cond_expr = panictry!(parser.parse_expr());
|
||||||
let custom_msg_args = if parser.eat(&token::Comma) {
|
let custom_msg_args = if parser.eat(&token::Comma) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ use syntax_pos::Span;
|
||||||
pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
|
pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'static> {
|
-> Box<dyn base::MacResult + 'static> {
|
||||||
let sp = sp.apply_mark(cx.current_expansion.mark);
|
let sp = sp.apply_mark(cx.current_expansion.mark);
|
||||||
let mut p = cx.new_parser_from_tts(tts);
|
let mut p = cx.new_parser_from_tts(tts);
|
||||||
let cfg = panictry!(p.parse_meta_item());
|
let cfg = panictry!(p.parse_meta_item());
|
||||||
|
|
|
@ -18,7 +18,7 @@ use syntax::tokenstream;
|
||||||
pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") {
|
let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") {
|
||||||
None => return DummyResult::expr(sp),
|
None => return DummyResult::expr(sp),
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub fn expand_syntax_ext(
|
||||||
cx: &mut base::ExtCtxt,
|
cx: &mut base::ExtCtxt,
|
||||||
sp: syntax_pos::Span,
|
sp: syntax_pos::Span,
|
||||||
tts: &[tokenstream::TokenTree],
|
tts: &[tokenstream::TokenTree],
|
||||||
) -> Box<base::MacResult + 'static> {
|
) -> Box<dyn base::MacResult + 'static> {
|
||||||
let es = match base::get_exprs_from_tts(cx, sp, tts) {
|
let es = match base::get_exprs_from_tts(cx, sp, tts) {
|
||||||
Some(e) => e,
|
Some(e) => e,
|
||||||
None => return base::DummyResult::expr(sp),
|
None => return base::DummyResult::expr(sp),
|
||||||
|
|
|
@ -21,7 +21,7 @@ use syntax::tokenstream::TokenTree;
|
||||||
pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[TokenTree])
|
tts: &[TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
if !cx.ecfg.enable_concat_idents() {
|
if !cx.ecfg.enable_concat_idents() {
|
||||||
feature_gate::emit_feature_err(&cx.parse_sess,
|
feature_gate::emit_feature_err(&cx.parse_sess,
|
||||||
"concat_idents",
|
"concat_idents",
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub fn expand_deriving_unsafe_bound(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
_: &MetaItem,
|
_: &MetaItem,
|
||||||
_: &Annotatable,
|
_: &Annotatable,
|
||||||
_: &mut FnMut(Annotatable)) {
|
_: &mut dyn FnMut(Annotatable)) {
|
||||||
cx.span_err(span, "this unsafe trait should be implemented explicitly");
|
cx.span_err(span, "this unsafe trait should be implemented explicitly");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
let trait_def = TraitDef {
|
let trait_def = TraitDef {
|
||||||
span,
|
span,
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
// check if we can use a short form
|
// check if we can use a short form
|
||||||
//
|
//
|
||||||
// the short form is `fn clone(&self) -> Self { *self }`
|
// the short form is `fn clone(&self) -> Self { *self }`
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
||||||
let hidden = cx.meta_list_item_word(span, Symbol::intern("hidden"));
|
let hidden = cx.meta_list_item_word(span, Symbol::intern("hidden"));
|
||||||
let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]);
|
let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]);
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
||||||
let attrs = vec![cx.attribute(span, inline)];
|
let attrs = vec![cx.attribute(span, inline)];
|
||||||
let trait_def = TraitDef {
|
let trait_def = TraitDef {
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
// structures are equal if all fields are equal, and non equal, if
|
// structures are equal if all fields are equal, and non equal, if
|
||||||
// any fields are not equal or if the enum variants are different
|
// any fields are not equal or if the enum variants are different
|
||||||
fn cs_op(cx: &mut ExtCtxt,
|
fn cs_op(cx: &mut ExtCtxt,
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
macro_rules! md {
|
macro_rules! md {
|
||||||
($name:expr, $op:expr, $equal:expr) => { {
|
($name:expr, $op:expr, $equal:expr) => { {
|
||||||
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
// &mut ::std::fmt::Formatter
|
// &mut ::std::fmt::Formatter
|
||||||
let fmtr = Ptr(Box::new(Literal(path_std!(cx, fmt::Formatter))),
|
let fmtr = Ptr(Box::new(Literal(path_std!(cx, fmt::Formatter))),
|
||||||
Borrowed(None, ast::Mutability::Mutable));
|
Borrowed(None, ast::Mutability::Mutable));
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub fn expand_deriving_rustc_decodable(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
expand_deriving_decodable_imp(cx, span, mitem, item, push, "rustc_serialize")
|
expand_deriving_decodable_imp(cx, span, mitem, item, push, "rustc_serialize")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
warn_if_deprecated(cx, span, "Decodable");
|
warn_if_deprecated(cx, span, "Decodable");
|
||||||
expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
|
expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable),
|
push: &mut dyn FnMut(Annotatable),
|
||||||
krate: &'static str) {
|
krate: &'static str) {
|
||||||
let typaram = &*deriving::hygienic_type_parameter(item, "__D");
|
let typaram = &*deriving::hygienic_type_parameter(item, "__D");
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
let inline = cx.meta_word(span, Symbol::intern("inline"));
|
||||||
let attrs = vec![cx.attribute(span, inline)];
|
let attrs = vec![cx.attribute(span, inline)];
|
||||||
let trait_def = TraitDef {
|
let trait_def = TraitDef {
|
||||||
|
|
|
@ -108,7 +108,7 @@ pub fn expand_deriving_rustc_encodable(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
expand_deriving_encodable_imp(cx, span, mitem, item, push, "rustc_serialize")
|
expand_deriving_encodable_imp(cx, span, mitem, item, push, "rustc_serialize")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
warn_if_deprecated(cx, span, "Encodable");
|
warn_if_deprecated(cx, span, "Encodable");
|
||||||
expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
|
expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable),
|
push: &mut dyn FnMut(Annotatable),
|
||||||
krate: &'static str) {
|
krate: &'static str) {
|
||||||
let typaram = &*deriving::hygienic_type_parameter(item, "__S");
|
let typaram = &*deriving::hygienic_type_parameter(item, "__S");
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ pub enum SubstructureFields<'a> {
|
||||||
/// Combine the values of all the fields together. The last argument is
|
/// Combine the values of all the fields together. The last argument is
|
||||||
/// all the fields of all the structures.
|
/// all the fields of all the structures.
|
||||||
pub type CombineSubstructureFunc<'a> =
|
pub type CombineSubstructureFunc<'a> =
|
||||||
Box<FnMut(&mut ExtCtxt, Span, &Substructure) -> P<Expr> + 'a>;
|
Box<dyn FnMut(&mut ExtCtxt, Span, &Substructure) -> P<Expr> + 'a>;
|
||||||
|
|
||||||
/// Deal with non-matching enum variants. The tuple is a list of
|
/// Deal with non-matching enum variants. The tuple is a list of
|
||||||
/// identifiers (one for each `Self` argument, which could be any of the
|
/// identifiers (one for each `Self` argument, which could be any of the
|
||||||
|
@ -338,7 +338,7 @@ pub type CombineSubstructureFunc<'a> =
|
||||||
/// holding the variant index value for each of the `Self` arguments. The
|
/// holding the variant index value for each of the `Self` arguments. The
|
||||||
/// last argument is all the non-`Self` args of the method being derived.
|
/// last argument is all the non-`Self` args of the method being derived.
|
||||||
pub type EnumNonMatchCollapsedFunc<'a> =
|
pub type EnumNonMatchCollapsedFunc<'a> =
|
||||||
Box<FnMut(&mut ExtCtxt, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>;
|
Box<dyn FnMut(&mut ExtCtxt, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>;
|
||||||
|
|
||||||
pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>)
|
pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>)
|
||||||
-> RefCell<CombineSubstructureFunc<'a>> {
|
-> RefCell<CombineSubstructureFunc<'a>> {
|
||||||
|
@ -398,7 +398,7 @@ impl<'a> TraitDef<'a> {
|
||||||
cx: &mut ExtCtxt,
|
cx: &mut ExtCtxt,
|
||||||
mitem: &ast::MetaItem,
|
mitem: &ast::MetaItem,
|
||||||
item: &'a Annotatable,
|
item: &'a Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
self.expand_ext(cx, mitem, item, push, false);
|
self.expand_ext(cx, mitem, item, push, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ impl<'a> TraitDef<'a> {
|
||||||
cx: &mut ExtCtxt,
|
cx: &mut ExtCtxt,
|
||||||
mitem: &ast::MetaItem,
|
mitem: &ast::MetaItem,
|
||||||
item: &'a Annotatable,
|
item: &'a Annotatable,
|
||||||
push: &mut FnMut(Annotatable),
|
push: &mut dyn FnMut(Annotatable),
|
||||||
from_scratch: bool) {
|
from_scratch: bool) {
|
||||||
match *item {
|
match *item {
|
||||||
Annotatable::Item(ref item) => {
|
Annotatable::Item(ref item) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
|
||||||
span: Span,
|
span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Annotatable,
|
item: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)) {
|
push: &mut dyn FnMut(Annotatable)) {
|
||||||
|
|
||||||
let path = Path::new_(pathvec_std!(cx, hash::Hash), None, vec![], PathKind::Std);
|
let path = Path::new_(pathvec_std!(cx, hash::Hash), None, vec![], PathKind::Std);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ macro_rules! derive_traits {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_builtin_derives(resolver: &mut Resolver) {
|
pub fn register_builtin_derives(resolver: &mut dyn Resolver) {
|
||||||
$(
|
$(
|
||||||
resolver.add_builtin(
|
resolver.add_builtin(
|
||||||
ast::Ident::with_empty_ctxt(Symbol::intern($name)),
|
ast::Ident::with_empty_ctxt(Symbol::intern($name)),
|
||||||
|
|
|
@ -26,7 +26,7 @@ use std::env;
|
||||||
pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") {
|
let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") {
|
||||||
None => return DummyResult::expr(sp),
|
None => return DummyResult::expr(sp),
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
|
@ -57,7 +57,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
let mut exprs = match get_exprs_from_tts(cx, sp, tts) {
|
let mut exprs = match get_exprs_from_tts(cx, sp, tts) {
|
||||||
Some(ref exprs) if exprs.is_empty() => {
|
Some(ref exprs) if exprs.is_empty() => {
|
||||||
cx.span_err(sp, "env! takes 1 or 2 arguments");
|
cx.span_err(sp, "env! takes 1 or 2 arguments");
|
||||||
|
|
|
@ -679,7 +679,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
||||||
pub fn expand_format_args<'cx>(ecx: &'cx mut ExtCtxt,
|
pub fn expand_format_args<'cx>(ecx: &'cx mut ExtCtxt,
|
||||||
mut sp: Span,
|
mut sp: Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
sp = sp.apply_mark(ecx.current_expansion.mark);
|
sp = sp.apply_mark(ecx.current_expansion.mark);
|
||||||
match parse_args(ecx, sp, tts) {
|
match parse_args(ecx, sp, tts) {
|
||||||
Some((efmt, args, names)) => {
|
Some((efmt, args, names)) => {
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub const MACRO: &'static str = "global_asm";
|
||||||
|
|
||||||
pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tts: &[tokenstream::TokenTree]) -> Box<base::MacResult + 'cx> {
|
tts: &[tokenstream::TokenTree]) -> Box<dyn base::MacResult + 'cx> {
|
||||||
if !cx.ecfg.enable_global_asm() {
|
if !cx.ecfg.enable_global_asm() {
|
||||||
feature_gate::emit_feature_err(&cx.parse_sess,
|
feature_gate::emit_feature_err(&cx.parse_sess,
|
||||||
MACRO,
|
MACRO,
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
//! Syntax extensions in the Rust compiler.
|
//! Syntax extensions in the Rust compiler.
|
||||||
|
|
||||||
|
#![deny(bare_trait_objects)]
|
||||||
|
|
||||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||||
|
@ -59,7 +61,7 @@ use syntax::ext::base::{MacroExpanderFn, NormalTT, NamedSyntaxExtension};
|
||||||
use syntax::ext::hygiene;
|
use syntax::ext::hygiene;
|
||||||
use syntax::symbol::Symbol;
|
use syntax::symbol::Symbol;
|
||||||
|
|
||||||
pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
|
pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
|
||||||
user_exts: Vec<NamedSyntaxExtension>,
|
user_exts: Vec<NamedSyntaxExtension>,
|
||||||
enable_quotes: bool) {
|
enable_quotes: bool) {
|
||||||
deriving::register_builtin_derives(resolver);
|
deriving::register_builtin_derives(resolver);
|
||||||
|
|
|
@ -17,7 +17,7 @@ use syntax_pos;
|
||||||
pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
|
pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
|
||||||
sp: syntax_pos::Span,
|
sp: syntax_pos::Span,
|
||||||
tts: &[tokenstream::TokenTree])
|
tts: &[tokenstream::TokenTree])
|
||||||
-> Box<base::MacResult + 'cx> {
|
-> Box<dyn base::MacResult + 'cx> {
|
||||||
if !cx.ecfg.enable_log_syntax() {
|
if !cx.ecfg.enable_log_syntax() {
|
||||||
feature_gate::emit_feature_err(&cx.parse_sess,
|
feature_gate::emit_feature_err(&cx.parse_sess,
|
||||||
"log_syntax",
|
"log_syntax",
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct CollectProcMacros<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn modify(sess: &ParseSess,
|
pub fn modify(sess: &ParseSess,
|
||||||
resolver: &mut ::syntax::ext::base::Resolver,
|
resolver: &mut dyn (::syntax::ext::base::Resolver),
|
||||||
mut krate: ast::Crate,
|
mut krate: ast::Crate,
|
||||||
is_proc_macro_crate: bool,
|
is_proc_macro_crate: bool,
|
||||||
is_test_crate: bool,
|
is_test_crate: bool,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use syntax::tokenstream::TokenTree;
|
||||||
pub fn expand_trace_macros(cx: &mut ExtCtxt,
|
pub fn expand_trace_macros(cx: &mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
tt: &[TokenTree])
|
tt: &[TokenTree])
|
||||||
-> Box<base::MacResult + 'static> {
|
-> Box<dyn base::MacResult + 'static> {
|
||||||
if !cx.ecfg.enable_trace_macros() {
|
if !cx.ecfg.enable_trace_macros() {
|
||||||
feature_gate::emit_feature_err(&cx.parse_sess,
|
feature_gate::emit_feature_err(&cx.parse_sess,
|
||||||
"trace_macros",
|
"trace_macros",
|
||||||
|
|
Loading…
Reference in New Issue