Skip to content

Commit 97ba52e

Browse files
committed
Auto merge of #29148 - petrochenkov:noshow, r=alexcrichton
Closes #29145 [breaking-change], needs a crater run.
2 parents 5e9f305 + 025cf75 commit 97ba52e

File tree

9 files changed

+19
-17
lines changed

9 files changed

+19
-17
lines changed

src/doc/style/features/traits/common.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ applicable, common traits.
99

1010
To see why, consider the following situation:
1111

12-
* Crate `std` defines trait `Show`.
13-
* Crate `url` defines type `Url`, without implementing `Show`.
12+
* Crate `std` defines trait `Debug`.
13+
* Crate `url` defines type `Url`, without implementing `Debug`.
1414
* Crate `webapp` imports from both `std` and `url`,
1515

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

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

2222
```rust
23-
Clone, Show, Hash, Eq
23+
Clone, Debug, Hash, Eq
2424
```
2525

2626
#### When safe, derive or otherwise implement `Send` and `Share`. [FIXME]

src/etc/generate-deriving-span-tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def write_file(name, string):
119119
('PartialOrd', ['PartialEq'], 8),
120120
('Eq', ['PartialEq'], 1),
121121
('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1),
122-
('Show', [], 1),
122+
('Debug', [], 1),
123123
('Hash', [], 1)]:
124124
traits[trait] = (ALL, supers, errs)
125125

src/libsyntax/ext/deriving/show.rs renamed to src/libsyntax/ext/deriving/debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use ext::deriving::generic::ty::*;
1818
use parse::token;
1919
use ptr::P;
2020

21-
pub fn expand_deriving_show(cx: &mut ExtCtxt,
21+
pub fn expand_deriving_debug(cx: &mut ExtCtxt,
2222
span: Span,
2323
mitem: &MetaItem,
2424
item: &Annotatable,

src/libsyntax/ext/deriving/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub mod clone;
6060
pub mod encodable;
6161
pub mod decodable;
6262
pub mod hash;
63-
pub mod show;
63+
pub mod debug;
6464
pub mod default;
6565
pub mod primitive;
6666

@@ -173,7 +173,7 @@ derive_traits! {
173173
"PartialOrd" => partial_ord::expand_deriving_partial_ord,
174174
"Ord" => ord::expand_deriving_ord,
175175

176-
"Debug" => show::expand_deriving_show,
176+
"Debug" => debug::expand_deriving_debug,
177177

178178
"Default" => default::expand_deriving_default,
179179

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

186186
// deprecated
187-
"Show" => show::expand_deriving_show,
188187
"Encodable" => encodable::expand_deriving_encodable,
189188
"Decodable" => decodable::expand_deriving_decodable,
190189
}
191190

192191
#[inline] // because `name` is a compile-time constant
193192
fn warn_if_deprecated(ecx: &mut ExtCtxt, sp: Span, name: &str) {
194193
if let Some(replacement) = match name {
195-
"Show" => Some("Debug"),
196194
"Encodable" => Some("RustcEncodable"),
197195
"Decodable" => Some("RustcDecodable"),
198196
_ => None,

src/test/run-pass/arr_cycle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::cell::Cell;
1212

13-
#[derive(Show)]
13+
#[derive(Debug)]
1414
struct B<'a> {
1515
a: [Cell<Option<&'a B<'a>>>; 2]
1616
}

src/test/run-pass/const-adt-align-mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::mem;
1212

13-
#[derive(PartialEq, Show)]
13+
#[derive(PartialEq, Debug)]
1414
enum Foo {
1515
A(u32),
1616
Bar([u16; 4]),

src/test/run-pass/deprecated-derive.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[derive(Show)]
12-
//~^ WARNING derive(Show) is deprecated
11+
#![feature(rustc_private)]
12+
13+
extern crate serialize;
14+
15+
#[derive(Encodable)]
16+
//~^ WARNING derive(Encodable) is deprecated in favor of derive(RustcEncodable)
1317
struct Test1;
1418

1519
fn main() { }

src/test/run-pass/vec_cycle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::cell::Cell;
1212

13-
#[derive(Show)]
13+
#[derive(Debug)]
1414
struct C<'a> {
1515
v: Vec<Cell<Option<&'a C<'a>>>>,
1616
}

src/test/run-pass/vec_cycle_wrapped.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
use std::cell::Cell;
1212

13-
#[derive(Show)]
13+
#[derive(Debug)]
1414
struct Refs<'a> {
1515
v: Vec<Cell<Option<&'a C<'a>>>>,
1616
}
1717

18-
#[derive(Show)]
18+
#[derive(Debug)]
1919
struct C<'a> {
2020
refs: Refs<'a>,
2121
}

0 commit comments

Comments
 (0)