syntax: make old #[deriving_foo]
attribute obsolete
This commit is contained in:
parent
e2abecd3ab
commit
999e7ef9a9
@ -153,13 +153,13 @@ pub fn syntax_expander_table() -> SyntaxEnv {
|
||||
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,
|
||||
|
17
src/test/compile-fail/deriving-obsolete.rs
Normal file
17
src/test/compile-fail/deriving-obsolete.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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() { }
|
Loading…
x
Reference in New Issue
Block a user