Skip to content

26 files changed

+37
-35
lines changed
 

‎src/libsyntax_ext/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"];
5050
pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt,
5151
sp: Span,
5252
tts: &[tokenstream::TokenTree])
53-
-> Box<base::MacResult + 'cx> {
53+
-> Box<dyn base::MacResult + 'cx> {
5454
if !cx.ecfg.enable_asm() {
5555
feature_gate::emit_feature_err(&cx.parse_sess,
5656
"asm",

‎src/libsyntax_ext/assert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn expand_assert<'cx>(
2222
cx: &'cx mut ExtCtxt,
2323
sp: Span,
2424
tts: &[TokenTree],
25-
) -> Box<MacResult + 'cx> {
25+
) -> Box<dyn MacResult + 'cx> {
2626
let mut parser = cx.new_parser_from_tts(tts);
2727
let cond_expr = panictry!(parser.parse_expr());
2828
let custom_msg_args = if parser.eat(&token::Comma) {

‎src/libsyntax_ext/cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use syntax_pos::Span;
2323
pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
2424
sp: Span,
2525
tts: &[tokenstream::TokenTree])
26-
-> Box<base::MacResult + 'static> {
26+
-> Box<dyn base::MacResult + 'static> {
2727
let sp = sp.apply_mark(cx.current_expansion.mark);
2828
let mut p = cx.new_parser_from_tts(tts);
2929
let cfg = panictry!(p.parse_meta_item());

‎src/libsyntax_ext/compile_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use syntax::tokenstream;
1818
pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt,
1919
sp: Span,
2020
tts: &[tokenstream::TokenTree])
21-
-> Box<base::MacResult + 'cx> {
21+
-> Box<dyn base::MacResult + 'cx> {
2222
let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") {
2323
None => return DummyResult::expr(sp),
2424
Some(v) => v,

‎src/libsyntax_ext/concat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn expand_syntax_ext(
2121
cx: &mut base::ExtCtxt,
2222
sp: syntax_pos::Span,
2323
tts: &[tokenstream::TokenTree],
24-
) -> Box<base::MacResult + 'static> {
24+
) -> Box<dyn base::MacResult + 'static> {
2525
let es = match base::get_exprs_from_tts(cx, sp, tts) {
2626
Some(e) => e,
2727
None => return base::DummyResult::expr(sp),

‎src/libsyntax_ext/concat_idents.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use syntax::tokenstream::TokenTree;
2121
pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt,
2222
sp: Span,
2323
tts: &[TokenTree])
24-
-> Box<base::MacResult + 'cx> {
24+
-> Box<dyn base::MacResult + 'cx> {
2525
if !cx.ecfg.enable_concat_idents() {
2626
feature_gate::emit_feature_err(&cx.parse_sess,
2727
"concat_idents",

‎src/libsyntax_ext/deriving/bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ pub fn expand_deriving_unsafe_bound(cx: &mut ExtCtxt,
1919
span: Span,
2020
_: &MetaItem,
2121
_: &Annotatable,
22-
_: &mut FnMut(Annotatable)) {
22+
_: &mut dyn FnMut(Annotatable)) {
2323
cx.span_err(span, "this unsafe trait should be implemented explicitly");
2424
}
2525

2626
pub fn expand_deriving_copy(cx: &mut ExtCtxt,
2727
span: Span,
2828
mitem: &MetaItem,
2929
item: &Annotatable,
30-
push: &mut FnMut(Annotatable)) {
30+
push: &mut dyn FnMut(Annotatable)) {
3131
let trait_def = TraitDef {
3232
span,
3333
attributes: Vec::new(),

‎src/libsyntax_ext/deriving/clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
2525
span: Span,
2626
mitem: &MetaItem,
2727
item: &Annotatable,
28-
push: &mut FnMut(Annotatable)) {
28+
push: &mut dyn FnMut(Annotatable)) {
2929
// check if we can use a short form
3030
//
3131
// the short form is `fn clone(&self) -> Self { *self }`

‎src/libsyntax_ext/deriving/cmp/eq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
2323
span: Span,
2424
mitem: &MetaItem,
2525
item: &Annotatable,
26-
push: &mut FnMut(Annotatable)) {
26+
push: &mut dyn FnMut(Annotatable)) {
2727
let inline = cx.meta_word(span, Symbol::intern("inline"));
2828
let hidden = cx.meta_list_item_word(span, Symbol::intern("hidden"));
2929
let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]);

‎src/libsyntax_ext/deriving/cmp/ord.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
2323
span: Span,
2424
mitem: &MetaItem,
2525
item: &Annotatable,
26-
push: &mut FnMut(Annotatable)) {
26+
push: &mut dyn FnMut(Annotatable)) {
2727
let inline = cx.meta_word(span, Symbol::intern("inline"));
2828
let attrs = vec![cx.attribute(span, inline)];
2929
let trait_def = TraitDef {

‎src/libsyntax_ext/deriving/cmp/partial_eq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
2323
span: Span,
2424
mitem: &MetaItem,
2525
item: &Annotatable,
26-
push: &mut FnMut(Annotatable)) {
26+
push: &mut dyn FnMut(Annotatable)) {
2727
// structures are equal if all fields are equal, and non equal, if
2828
// any fields are not equal or if the enum variants are different
2929
fn cs_op(cx: &mut ExtCtxt,

‎src/libsyntax_ext/deriving/cmp/partial_ord.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
2525
span: Span,
2626
mitem: &MetaItem,
2727
item: &Annotatable,
28-
push: &mut FnMut(Annotatable)) {
28+
push: &mut dyn FnMut(Annotatable)) {
2929
macro_rules! md {
3030
($name:expr, $op:expr, $equal:expr) => { {
3131
let inline = cx.meta_word(span, Symbol::intern("inline"));

‎src/libsyntax_ext/deriving/debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt,
2323
span: Span,
2424
mitem: &MetaItem,
2525
item: &Annotatable,
26-
push: &mut FnMut(Annotatable)) {
26+
push: &mut dyn FnMut(Annotatable)) {
2727
// &mut ::std::fmt::Formatter
2828
let fmtr = Ptr(Box::new(Literal(path_std!(cx, fmt::Formatter))),
2929
Borrowed(None, ast::Mutability::Mutable));

‎src/libsyntax_ext/deriving/decodable.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ pub fn expand_deriving_rustc_decodable(cx: &mut ExtCtxt,
2727
span: Span,
2828
mitem: &MetaItem,
2929
item: &Annotatable,
30-
push: &mut FnMut(Annotatable)) {
30+
push: &mut dyn FnMut(Annotatable)) {
3131
expand_deriving_decodable_imp(cx, span, mitem, item, push, "rustc_serialize")
3232
}
3333

3434
pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
3535
span: Span,
3636
mitem: &MetaItem,
3737
item: &Annotatable,
38-
push: &mut FnMut(Annotatable)) {
38+
push: &mut dyn FnMut(Annotatable)) {
3939
warn_if_deprecated(cx, span, "Decodable");
4040
expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
4141
}
@@ -44,7 +44,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
4444
span: Span,
4545
mitem: &MetaItem,
4646
item: &Annotatable,
47-
push: &mut FnMut(Annotatable),
47+
push: &mut dyn FnMut(Annotatable),
4848
krate: &'static str) {
4949
let typaram = &*deriving::hygienic_type_parameter(item, "__D");
5050

‎src/libsyntax_ext/deriving/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
2323
span: Span,
2424
mitem: &MetaItem,
2525
item: &Annotatable,
26-
push: &mut FnMut(Annotatable)) {
26+
push: &mut dyn FnMut(Annotatable)) {
2727
let inline = cx.meta_word(span, Symbol::intern("inline"));
2828
let attrs = vec![cx.attribute(span, inline)];
2929
let trait_def = TraitDef {

‎src/libsyntax_ext/deriving/encodable.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ pub fn expand_deriving_rustc_encodable(cx: &mut ExtCtxt,
108108
span: Span,
109109
mitem: &MetaItem,
110110
item: &Annotatable,
111-
push: &mut FnMut(Annotatable)) {
111+
push: &mut dyn FnMut(Annotatable)) {
112112
expand_deriving_encodable_imp(cx, span, mitem, item, push, "rustc_serialize")
113113
}
114114

115115
pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
116116
span: Span,
117117
mitem: &MetaItem,
118118
item: &Annotatable,
119-
push: &mut FnMut(Annotatable)) {
119+
push: &mut dyn FnMut(Annotatable)) {
120120
warn_if_deprecated(cx, span, "Encodable");
121121
expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
122122
}
@@ -125,7 +125,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
125125
span: Span,
126126
mitem: &MetaItem,
127127
item: &Annotatable,
128-
push: &mut FnMut(Annotatable),
128+
push: &mut dyn FnMut(Annotatable),
129129
krate: &'static str) {
130130
let typaram = &*deriving::hygienic_type_parameter(item, "__S");
131131

‎src/libsyntax_ext/deriving/generic/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,15 @@ pub enum SubstructureFields<'a> {
330330
/// Combine the values of all the fields together. The last argument is
331331
/// all the fields of all the structures.
332332
pub type CombineSubstructureFunc<'a> =
333-
Box<FnMut(&mut ExtCtxt, Span, &Substructure) -> P<Expr> + 'a>;
333+
Box<dyn FnMut(&mut ExtCtxt, Span, &Substructure) -> P<Expr> + 'a>;
334334

335335
/// Deal with non-matching enum variants. The tuple is a list of
336336
/// identifiers (one for each `Self` argument, which could be any of the
337337
/// variants since they have been collapsed together) and the identifiers
338338
/// holding the variant index value for each of the `Self` arguments. The
339339
/// last argument is all the non-`Self` args of the method being derived.
340340
pub type EnumNonMatchCollapsedFunc<'a> =
341-
Box<FnMut(&mut ExtCtxt, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>;
341+
Box<dyn FnMut(&mut ExtCtxt, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>;
342342

343343
pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>)
344344
-> RefCell<CombineSubstructureFunc<'a>> {
@@ -398,15 +398,15 @@ impl<'a> TraitDef<'a> {
398398
cx: &mut ExtCtxt,
399399
mitem: &ast::MetaItem,
400400
item: &'a Annotatable,
401-
push: &mut FnMut(Annotatable)) {
401+
push: &mut dyn FnMut(Annotatable)) {
402402
self.expand_ext(cx, mitem, item, push, false);
403403
}
404404

405405
pub fn expand_ext(self,
406406
cx: &mut ExtCtxt,
407407
mitem: &ast::MetaItem,
408408
item: &'a Annotatable,
409-
push: &mut FnMut(Annotatable),
409+
push: &mut dyn FnMut(Annotatable),
410410
from_scratch: bool) {
411411
match *item {
412412
Annotatable::Item(ref item) => {

‎src/libsyntax_ext/deriving/hash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
2222
span: Span,
2323
mitem: &MetaItem,
2424
item: &Annotatable,
25-
push: &mut FnMut(Annotatable)) {
25+
push: &mut dyn FnMut(Annotatable)) {
2626

2727
let path = Path::new_(pathvec_std!(cx, hash::Hash), None, vec![], PathKind::Std);
2828

‎src/libsyntax_ext/deriving/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ macro_rules! derive_traits {
7272
}
7373
}
7474

75-
pub fn register_builtin_derives(resolver: &mut Resolver) {
75+
pub fn register_builtin_derives(resolver: &mut dyn Resolver) {
7676
$(
7777
resolver.add_builtin(
7878
ast::Ident::with_empty_ctxt(Symbol::intern($name)),

‎src/libsyntax_ext/env.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::env;
2626
pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt,
2727
sp: Span,
2828
tts: &[tokenstream::TokenTree])
29-
-> Box<base::MacResult + 'cx> {
29+
-> Box<dyn base::MacResult + 'cx> {
3030
let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") {
3131
None => return DummyResult::expr(sp),
3232
Some(v) => v,
@@ -57,7 +57,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt,
5757
pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt,
5858
sp: Span,
5959
tts: &[tokenstream::TokenTree])
60-
-> Box<base::MacResult + 'cx> {
60+
-> Box<dyn base::MacResult + 'cx> {
6161
let mut exprs = match get_exprs_from_tts(cx, sp, tts) {
6262
Some(ref exprs) if exprs.is_empty() => {
6363
cx.span_err(sp, "env! takes 1 or 2 arguments");

‎src/libsyntax_ext/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ impl<'a, 'b> Context<'a, 'b> {
679679
pub fn expand_format_args<'cx>(ecx: &'cx mut ExtCtxt,
680680
mut sp: Span,
681681
tts: &[tokenstream::TokenTree])
682-
-> Box<base::MacResult + 'cx> {
682+
-> Box<dyn base::MacResult + 'cx> {
683683
sp = sp.apply_mark(ecx.current_expansion.mark);
684684
match parse_args(ecx, sp, tts) {
685685
Some((efmt, args, names)) => {

‎src/libsyntax_ext/global_asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub const MACRO: &'static str = "global_asm";
3434

3535
pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
3636
sp: Span,
37-
tts: &[tokenstream::TokenTree]) -> Box<base::MacResult + 'cx> {
37+
tts: &[tokenstream::TokenTree]) -> Box<dyn base::MacResult + 'cx> {
3838
if !cx.ecfg.enable_global_asm() {
3939
feature_gate::emit_feature_err(&cx.parse_sess,
4040
MACRO,

‎src/libsyntax_ext/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
//! Syntax extensions in the Rust compiler.
1212
13+
#![deny(bare_trait_objects)]
14+
1315
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1416
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1517
html_root_url = "https://doc.rust-lang.org/nightly/")]
@@ -59,7 +61,7 @@ use syntax::ext::base::{MacroExpanderFn, NormalTT, NamedSyntaxExtension};
5961
use syntax::ext::hygiene;
6062
use syntax::symbol::Symbol;
6163

62-
pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
64+
pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
6365
user_exts: Vec<NamedSyntaxExtension>,
6466
enable_quotes: bool) {
6567
deriving::register_builtin_derives(resolver);

‎src/libsyntax_ext/log_syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use syntax_pos;
1717
pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
1818
sp: syntax_pos::Span,
1919
tts: &[tokenstream::TokenTree])
20-
-> Box<base::MacResult + 'cx> {
20+
-> Box<dyn base::MacResult + 'cx> {
2121
if !cx.ecfg.enable_log_syntax() {
2222
feature_gate::emit_feature_err(&cx.parse_sess,
2323
"log_syntax",

‎src/libsyntax_ext/proc_macro_registrar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct CollectProcMacros<'a> {
5555
}
5656

5757
pub fn modify(sess: &ParseSess,
58-
resolver: &mut ::syntax::ext::base::Resolver,
58+
resolver: &mut dyn (::syntax::ext::base::Resolver),
5959
mut krate: ast::Crate,
6060
is_proc_macro_crate: bool,
6161
is_test_crate: bool,

‎src/libsyntax_ext/trace_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use syntax::tokenstream::TokenTree;
1818
pub fn expand_trace_macros(cx: &mut ExtCtxt,
1919
sp: Span,
2020
tt: &[TokenTree])
21-
-> Box<base::MacResult + 'static> {
21+
-> Box<dyn base::MacResult + 'static> {
2222
if !cx.ecfg.enable_trace_macros() {
2323
feature_gate::emit_feature_err(&cx.parse_sess,
2424
"trace_macros",

0 commit comments

Comments
 (0)
Please sign in to comment.