]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #63056 - petrochenkov:macstd2, r=alexcrichton
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 10 Aug 2019 06:13:16 +0000 (08:13 +0200)
committerGitHub <noreply@github.com>
Sat, 10 Aug 2019 06:13:16 +0000 (08:13 +0200)
commiteb44561600a3f2edceae13d1395ca84d7a23dc17
tree2a28987934814c0a315d210f0487344ef8a74dbe
parentbe8bbb06976c8065425b18e9cbe24a6d1d4e7515
parentcbcc7dd182b9bf67d664508b82284c5539ef8819
Rollup merge of #63056 - petrochenkov:macstd2, r=alexcrichton

Give built-in macros stable addresses in the standard library

Continuation of https://github.com/rust-lang/rust/pull/62086.

Derive macros corresponding to traits from libcore are now available through the same paths as those traits:
- `Clone` - `{core,std}::clone::Clone`
- `PartialEq` - `{core,std}::cmp::PartialEq`
- `Eq` - `{core,std}::cmp::Eq`
- `PartialOrd` - `{core,std}::cmp::PartialOrd`
- `Ord` - `{core,std}::cmp::Ord`
- `Default` - `{core,std}::default::Default`
- `Debug` - `{core,std}::fmt::Debug`
- `Hash` - `{core,std}::hash::Hash`
- `Copy` - `{core,std}::marker::Copy`

Fn-like built-in macros are now available through libcore and libstd's root module, by analogy with non-builtin macros defined by libcore and libstd:
```rust
{core,std}::{
    __rust_unstable_column,
    asm,
    assert,
    cfg,
    column,
    compile_error,
    concat,
    concat_idents,
    env,
    file,
    format_args,
    format_args_nl,
    global_asm,
    include,
    include_bytes,
    include_str,
    line,
    log_syntax,
    module_path,
    option_env,
    stringify,
    trace_macros,
}
```

Derive macros without a corresponding trait in libcore or libstd are still available only through prelude (also see https://github.com/rust-lang/rust/pull/62507).
Attribute macros also keep being available only through prelude, mostly because they don't have an existing practice to follow. An advice from the library team on their eventual placement would be appreciated.
```rust
    RustcDecodable,
    RustcEncodable,
    bench,
    global_allocator,
    test,
    test_case,
```

r? @alexcrichton