提交 999e7ef9 编写于 作者: A Andrew Paseltiner

syntax: make old `#[deriving_foo]` attribute obsolete

上级 e2abecd3
......@@ -153,13 +153,13 @@ fn builtin_item_tt(f: SyntaxExpanderTTItemFun) -> @Transformer {
ext::deriving::expand_meta_deriving)));
syntax_expanders.insert(@~"deriving_eq",
@SE(ItemDecorator(
ext::deriving::eq::expand_deriving_eq)));
ext::deriving::eq::expand_deriving_obsolete)));
syntax_expanders.insert(@~"deriving_iter_bytes",
@SE(ItemDecorator(
ext::deriving::iter_bytes::expand_deriving_iter_bytes)));
ext::deriving::iter_bytes::expand_deriving_obsolete)));
syntax_expanders.insert(@~"deriving_clone",
@SE(ItemDecorator(
ext::deriving::clone::expand_deriving_clone)));
ext::deriving::clone::expand_deriving_obsolete)));
// Quasi-quoting expanders
syntax_expanders.insert(@~"quote_tokens",
......
......@@ -39,6 +39,15 @@ pub fn expand_deriving_clone(cx: @ext_ctxt,
expand_deriving_clone_enum_def)
}
pub fn expand_deriving_obsolete(cx: @ext_ctxt,
span: span,
_mitem: @meta_item,
in_items: ~[@item])
-> ~[@item] {
cx.span_err(span, ~"`#[deriving_clone]` is obsolete; use `#[deriving(Clone)]` instead");
in_items
}
fn create_derived_clone_impl(cx: @ext_ctxt,
span: span,
type_ident: ident,
......
......@@ -53,6 +53,15 @@ pub fn expand_deriving_eq(cx: @ext_ctxt,
expand_deriving_eq_enum_def)
}
pub fn expand_deriving_obsolete(cx: @ext_ctxt,
span: span,
_mitem: @meta_item,
in_items: ~[@item])
-> ~[@item] {
cx.span_err(span, ~"`#[deriving_eq]` is obsolete; use `#[deriving(Eq)]` instead");
in_items
}
/// Creates a method from the given expression, the signature of which
/// conforms to the `eq` or `ne` method.
fn create_eq_method(cx: @ext_ctxt,
......
......@@ -39,6 +39,16 @@ pub fn expand_deriving_iter_bytes(cx: @ext_ctxt,
expand_deriving_iter_bytes_enum_def)
}
pub fn expand_deriving_obsolete(cx: @ext_ctxt,
span: span,
_mitem: @meta_item,
in_items: ~[@item])
-> ~[@item] {
cx.span_err(span, ~"`#[deriving_iter_bytes]` is obsolete; use `#[deriving(IterBytes)]` \
instead");
in_items
}
fn create_derived_iter_bytes_impl(cx: @ext_ctxt,
span: span,
type_ident: ident,
......
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[deriving_clone] //~ ERROR `#[deriving_clone]` is obsolete; use `#[deriving(Clone)]` instead
#[deriving_eq] //~ ERROR `#[deriving_eq]` is obsolete; use `#[deriving(Eq)]` instead
#[deriving_iter_bytes]
//~^ ERROR `#[deriving_iter_bytes]` is obsolete; use `#[deriving(IterBytes)]` instead
struct Foo;
pub fn main() { }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册