Skip to content

Commit

Permalink
Auto merge of #29148 - petrochenkov:noshow, r=alexcrichton
Browse files Browse the repository at this point in the history
Closes #29145

[breaking-change], needs a crater run.
  • Loading branch information
bors committed Oct 20, 2015
2 parents 5e9f305 + 025cf75 commit 97ba52e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/doc/style/features/traits/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ applicable, common traits.

To see why, consider the following situation:

* Crate `std` defines trait `Show`.
* Crate `url` defines type `Url`, without implementing `Show`.
* Crate `std` defines trait `Debug`.
* Crate `url` defines type `Url`, without implementing `Debug`.
* Crate `webapp` imports from both `std` and `url`,

There is no way for `webapp` to add `Show` to `url`, since it defines neither.
There is no way for `webapp` to add `Debug` to `url`, since it defines neither.
(Note: the newtype pattern can provide an efficient, but inconvenient
workaround; see [newtype for views](../types/newtype.md))

The most important common traits to implement from `std` are:

```rust
Clone, Show, Hash, Eq
Clone, Debug, Hash, Eq
```

#### When safe, derive or otherwise implement `Send` and `Share`. [FIXME]
Expand Down
2 changes: 1 addition & 1 deletion src/etc/generate-deriving-span-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def write_file(name, string):
('PartialOrd', ['PartialEq'], 8),
('Eq', ['PartialEq'], 1),
('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1),
('Show', [], 1),
('Debug', [], 1),
('Hash', [], 1)]:
traits[trait] = (ALL, supers, errs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use ext::deriving::generic::ty::*;
use parse::token;
use ptr::P;

pub fn expand_deriving_show(cx: &mut ExtCtxt,
pub fn expand_deriving_debug(cx: &mut ExtCtxt,
span: Span,
mitem: &MetaItem,
item: &Annotatable,
Expand Down
6 changes: 2 additions & 4 deletions src/libsyntax/ext/deriving/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub mod clone;
pub mod encodable;
pub mod decodable;
pub mod hash;
pub mod show;
pub mod debug;
pub mod default;
pub mod primitive;

Expand Down Expand Up @@ -173,7 +173,7 @@ derive_traits! {
"PartialOrd" => partial_ord::expand_deriving_partial_ord,
"Ord" => ord::expand_deriving_ord,

"Debug" => show::expand_deriving_show,
"Debug" => debug::expand_deriving_debug,

"Default" => default::expand_deriving_default,

Expand All @@ -184,15 +184,13 @@ derive_traits! {
"Copy" => bounds::expand_deriving_copy,

// deprecated
"Show" => show::expand_deriving_show,
"Encodable" => encodable::expand_deriving_encodable,
"Decodable" => decodable::expand_deriving_decodable,
}

#[inline] // because `name` is a compile-time constant
fn warn_if_deprecated(ecx: &mut ExtCtxt, sp: Span, name: &str) {
if let Some(replacement) = match name {
"Show" => Some("Debug"),
"Encodable" => Some("RustcEncodable"),
"Decodable" => Some("RustcDecodable"),
_ => None,
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/arr_cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::cell::Cell;

#[derive(Show)]
#[derive(Debug)]
struct B<'a> {
a: [Cell<Option<&'a B<'a>>>; 2]
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-adt-align-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::mem;

#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
enum Foo {
A(u32),
Bar([u16; 4]),
Expand Down
8 changes: 6 additions & 2 deletions src/test/run-pass/deprecated-derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[derive(Show)]
//~^ WARNING derive(Show) is deprecated
#![feature(rustc_private)]

extern crate serialize;

#[derive(Encodable)]
//~^ WARNING derive(Encodable) is deprecated in favor of derive(RustcEncodable)
struct Test1;

fn main() { }
2 changes: 1 addition & 1 deletion src/test/run-pass/vec_cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::cell::Cell;

#[derive(Show)]
#[derive(Debug)]
struct C<'a> {
v: Vec<Cell<Option<&'a C<'a>>>>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/vec_cycle_wrapped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

use std::cell::Cell;

#[derive(Show)]
#[derive(Debug)]
struct Refs<'a> {
v: Vec<Cell<Option<&'a C<'a>>>>,
}

#[derive(Show)]
#[derive(Debug)]
struct C<'a> {
refs: Refs<'a>,
}
Expand Down

0 comments on commit 97ba52e

Please sign in to comment.