diff options
| author | bors <bors@rust-lang.org> | 2017-11-04 10:24:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-11-04 10:24:20 +0000 |
| commit | a6885cb853390fc79a8ff0b223ea1471e261d60e (patch) | |
| tree | 732a966af0d57b74a079ae60311e7f81d02cea2a /src/test/rustdoc/codeblock-title.rs | |
| parent | 9acc3331e187d329d29a70c788c44e25a79edf45 (diff) | |
| parent | 97692afda9e493db65c833b931a6971fb58352b2 (diff) | |
| download | rust-a6885cb853390fc79a8ff0b223ea1471e261d60e.tar.gz rust-a6885cb853390fc79a8ff0b223ea1471e261d60e.zip | |
Auto merge of #45605 - Nashenas88:derive-newtype, r=nikomatsakis
Add derive and doc comment capabilities to newtype_index macro
This moves `RustcDecodable` and `RustcEncodable` out of the macro definition and into the macro uses. They were conflicting with `CrateNum`'s impls of `serialize::UseSpecializedEncodable` and `serialize::UseSpecializedDecodable`, and now it's not :). `CrateNum` is now defined with the `newtype_index` macro. I also added support for doc comments on constant definitions and allowed a type to remove the pub specification on the tuple param (otherwise a LOT of code would refuse to compile for `CrateNum`). I was getting dozens of errors like this if `CrateNum` was defined as `pub struct CrateNum(pub u32)`:
```
error[E0530]: match bindings cannot shadow tuple structs
--> src/librustc/dep_graph/dep_node.rs:624:25
|
63 | use hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX};
| -------- a tuple struct `CrateNum` is imported here
...
624 | [] MissingLangItems(CrateNum),
| ^^^^^^^^ cannot be named the same as a tuple struct
```
I also cleaned up the formatting of the macro bodies as they were getting impossibly long. Should I go back and fix the matching rules to this style too?
I also want to see what the test results look like because `CrateNum` used to just derive `Debug`, but the `newtype_index` macro has a custom implementation. This might require further pushes.
Feel free to bikeshed on the macro language, I have no preference here.
Diffstat (limited to 'src/test/rustdoc/codeblock-title.rs')
0 files changed, 0 insertions, 0 deletions
