1. 05 2月, 2017 2 次提交
  2. 03 1月, 2017 1 次提交
    • A
      rustc: Stabilize the `proc_macro` feature · 045f8f69
      Alex Crichton 提交于
      This commit stabilizes the `proc_macro` and `proc_macro_lib` features in the
      compiler to stabilize the "Macros 1.1" feature of the language. Many more
      details can be found on the tracking issue, #35900.
      
      Closes #35900
      045f8f69
  3. 07 10月, 2016 1 次提交
    • A
      rustc: Rename rustc_macro to proc_macro · 2148bdfc
      Alex Crichton 提交于
      This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`,
      which reflects the general consensus of #35900. A follow up PR to Cargo will be
      required to purge the `rustc-macro` name as well.
      2148bdfc
  4. 03 9月, 2016 1 次提交
    • A
      rustc: Implement custom derive (macros 1.1) · ecc6c39e
      Alex Crichton 提交于
      This commit is an implementation of [RFC 1681] which adds support to the
      compiler for first-class user-define custom `#[derive]` modes with a far more
      stable API than plugins have today.
      
      [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md
      
      The main features added by this commit are:
      
      * A new `rustc-macro` crate-type. This crate type represents one which will
        provide custom `derive` implementations and perhaps eventually flower into the
        implementation of macros 2.0 as well.
      
      * A new `rustc_macro` crate in the standard distribution. This crate will
        provide the runtime interface between macro crates and the compiler. The API
        here is particularly conservative right now but has quite a bit of room to
        expand into any manner of APIs required by macro authors.
      
      * The ability to load new derive modes through the `#[macro_use]` annotations on
        other crates.
      
      All support added here is gated behind the `rustc_macro` feature gate, both for
      the library support (the `rustc_macro` crate) as well as the language features.
      
      There are a few minor differences from the implementation outlined in the RFC,
      such as the `rustc_macro` crate being available as a dylib and all symbols are
      `dlsym`'d directly instead of having a shim compiled. These should only affect
      the implementation, however, not the public interface.
      
      This commit also ended up touching a lot of code related to `#[derive]`, making
      a few notable changes:
      
      * Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't
        sure how to keep this behavior and *not* expose it to custom derive.
      
      * Derive attributes no longer have access to unstable features by default, they
        have to opt in on a granular level.
      
      * The `derive(Copy,Clone)` optimization is now done through another "obscure
        attribute" which is just intended to ferry along in the compiler that such an
        optimization is possible. The `derive(PartialEq,Eq)` optimization was also
        updated to do something similar.
      
      ---
      
      One part of this PR which needs to be improved before stabilizing are the errors
      and exact interfaces here. The error messages are relatively poor quality and
      there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]`
      not working by default. The custom attributes added by the compiler end up
      becoming unstable again when going through a custom impl.
      
      Hopefully though this is enough to start allowing experimentation on crates.io!
      
      syntax-[breaking-change]
      ecc6c39e
  5. 07 8月, 2016 1 次提交
  6. 02 3月, 2016 1 次提交
  7. 23 1月, 2016 1 次提交
  8. 15 1月, 2016 1 次提交
  9. 09 1月, 2016 1 次提交
  10. 08 1月, 2016 1 次提交
    • F
      update test to reflect other sources of brokenness in it under new · a2960bc7
      Felix S. Klock II 提交于
      macro future proofing rules.
      
      (We may want to think about what this test was actually testing and
      figure out a way to test it without running afoul of macro future
      proofing.  I spent some time trying to do this, e.g. by inserting
      parenthesis in the macro input pattern, but I could not quickly get it
      working, so I took this tack instead.)
      a2960bc7
  11. 06 1月, 2016 1 次提交
  12. 24 3月, 2015 1 次提交
  13. 17 11月, 2014 1 次提交
    • S
      Switch to purely namespaced enums · 3dcd2157
      Steven Fackler 提交于
      This breaks code that referred to variant names in the same namespace as
      their enum. Reexport the variants in the old location or alter code to
      refer to the new locations:
      
      ```
      pub enum Foo {
          A,
          B
      }
      
      fn main() {
          let a = A;
      }
      ```
      =>
      ```
      pub use self::Foo::{A, B};
      
      pub enum Foo {
          A,
          B
      }
      
      fn main() {
          let a = A;
      }
      ```
      or
      ```
      pub enum Foo {
          A,
          B
      }
      
      fn main() {
          let a = Foo::A;
      }
      ```
      
      [breaking-change]
      3dcd2157
  14. 24 4月, 2014 1 次提交
  15. 08 2月, 2014 1 次提交
  16. 25 9月, 2013 1 次提交
  17. 14 6月, 2013 1 次提交
  18. 31 5月, 2013 1 次提交