diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-09-28 10:33:57 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-28 10:33:57 -0700 |
| commit | f819b4d72d7034d62c1d79f1bc8643482983b7db (patch) | |
| tree | 166e2d99e7dcebea7b079401d4c5ab402ca33fca /src/test/compile-fail-fulldeps | |
| parent | f7f1903b8906e1c078a3f5168d0a8994aee520b5 (diff) | |
| parent | e5e7021ca5b67c17fa116a971c3204bd147a1f0d (diff) | |
| download | rust-f819b4d72d7034d62c1d79f1bc8643482983b7db.tar.gz rust-f819b4d72d7034d62c1d79f1bc8643482983b7db.zip | |
Rollup merge of #36782 - alexcrichton:rustc-macro-expand-order, r=nrc
rustc: Tweak expansion order of custom derive This commit alters the expansion order of custom macros-1.1 style `#[derive]` modes. Instead of left-to-right the expansion now happens in three categories, each of which is internally left-to-right: * Old-style custom derive (`#[derive_Foo]`) is expanded * New-style custom derive (macros 1.1) is expanded * Built in derive modes are expanded This gives built in derive modes maximal knowledge about the struct that's being expanded and also avoids pesky issues like exposing `#[structural_match]` or `#[rustc_copy_clone_marker]`. cc #35900
Diffstat (limited to 'src/test/compile-fail-fulldeps')
| -rw-r--r-- | src/test/compile-fail-fulldeps/rustc-macro/append-impl.rs | 33 | ||||
| -rw-r--r-- | src/test/compile-fail-fulldeps/rustc-macro/auxiliary/append-impl.rs | 31 |
2 files changed, 0 insertions, 64 deletions
diff --git a/src/test/compile-fail-fulldeps/rustc-macro/append-impl.rs b/src/test/compile-fail-fulldeps/rustc-macro/append-impl.rs deleted file mode 100644 index 1300fe66585..00000000000 --- a/src/test/compile-fail-fulldeps/rustc-macro/append-impl.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 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. - -// aux-build:append-impl.rs - -#![feature(rustc_macro)] -#![allow(warnings)] - -#[macro_use] -extern crate append_impl; - -trait Append { - fn foo(&self); -} - -#[derive(PartialEq, - Append, - Eq)] -struct A { -//~^ ERROR: the semantics of constant patterns is not yet settled - inner: u32, -} - -fn main() { - A { inner: 3 }.foo(); -} diff --git a/src/test/compile-fail-fulldeps/rustc-macro/auxiliary/append-impl.rs b/src/test/compile-fail-fulldeps/rustc-macro/auxiliary/append-impl.rs deleted file mode 100644 index c3d295e02c1..00000000000 --- a/src/test/compile-fail-fulldeps/rustc-macro/auxiliary/append-impl.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 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. - -// force-host -// no-prefer-dynamic - -#![feature(rustc_macro)] -#![feature(rustc_macro_lib)] -#![crate_type = "rustc-macro"] - -extern crate rustc_macro; - -use rustc_macro::TokenStream; - -#[rustc_macro_derive(Append)] -pub fn derive_a(input: TokenStream) -> TokenStream { - let mut input = input.to_string(); - input.push_str(" - impl Append for A { - fn foo(&self) {} - } - "); - input.parse().unwrap() -} |
