Rollup merge of #22632 - nagisa:kill-show-string-with-fire!, r=alexcrichton

Toss the tomatoes!

r? @aturon

Fixes #22478. The underlying bug(?) behind that issue still exists though and there’s another issue that reports it.
This commit is contained in:
Manish Goregaokar
2015-02-24 07:14:34 +05:30
15 changed files with 19 additions and 52 deletions

View File

@@ -404,7 +404,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Formatter, Result, Write, rt}; pub use core::fmt::{Formatter, Result, Write, rt};
pub use core::fmt::{Show, String, Octal, Binary}; pub use core::fmt::{Octal, Binary};
pub use core::fmt::{Display, Debug}; pub use core::fmt::{Display, Debug};
pub use core::fmt::{LowerHex, UpperHex, Pointer}; pub use core::fmt::{LowerHex, UpperHex, Pointer};
pub use core::fmt::{LowerExp, UpperExp}; pub use core::fmt::{LowerExp, UpperExp};

View File

@@ -246,16 +246,6 @@ impl<'a> Display for Arguments<'a> {
} }
} }
/// Format trait for the `:?` format. Useful for debugging, all types
/// should implement this.
#[deprecated(since = "1.0.0", reason = "renamed to Debug")]
#[unstable(feature = "old_fmt")]
pub trait Show {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
}
/// Format trait for the `:?` format. Useful for debugging, all types /// Format trait for the `:?` format. Useful for debugging, all types
/// should implement this. /// should implement this.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@@ -269,22 +259,6 @@ pub trait Debug {
fn fmt(&self, &mut Formatter) -> Result; fn fmt(&self, &mut Formatter) -> Result;
} }
#[allow(deprecated)]
impl<T: Show + ?Sized> Debug for T {
#[allow(deprecated)]
fn fmt(&self, f: &mut Formatter) -> Result { Show::fmt(self, f) }
}
/// When a value can be semantically expressed as a String, this trait may be
/// used. It corresponds to the default format, `{}`.
#[deprecated(since = "1.0.0", reason = "renamed to Display")]
#[unstable(feature = "old_fmt")]
pub trait String {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
}
/// When a value can be semantically expressed as a String, this trait may be /// When a value can be semantically expressed as a String, this trait may be
/// used. It corresponds to the default format, `{}`. /// used. It corresponds to the default format, `{}`.
#[rustc_on_unimplemented = "`{Self}` cannot be formatted with the default \ #[rustc_on_unimplemented = "`{Self}` cannot be formatted with the default \
@@ -297,12 +271,6 @@ pub trait Display {
fn fmt(&self, &mut Formatter) -> Result; fn fmt(&self, &mut Formatter) -> Result;
} }
#[allow(deprecated)]
impl<T: String + ?Sized> Display for T {
#[allow(deprecated)]
fn fmt(&self, f: &mut Formatter) -> Result { String::fmt(self, f) }
}
/// Format trait for the `o` character /// Format trait for the `o` character
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Octal { pub trait Octal {

View File

@@ -17,7 +17,7 @@ pub mod kitty {
pub name : String, pub name : String,
} }
impl fmt::String for cat { impl fmt::Display for cat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name) write!(f, "{}", self.name)
} }

View File

@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
use std::marker::MarkerTrait; use std::marker::MarkerTrait;

View File

@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
// Test that two blanket impls conflict (at least without negative // Test that two blanket impls conflict (at least without negative

View File

@@ -13,7 +13,7 @@
extern crate go_trait; extern crate go_trait;
use go_trait::{Go,GoMut}; use go_trait::{Go,GoMut};
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
struct MyThingy; struct MyThingy;

View File

@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
// Test that a blank impl for all T conflicts with an impl for some // Test that a blank impl for all T conflicts with an impl for some

View File

@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
// Test that a blank impl for all T conflicts with an impl for some // Test that a blank impl for all T conflicts with an impl for some

View File

@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
// Test that a blank impl for all T conflicts with an impl for some // Test that a blank impl for all T conflicts with an impl for some

View File

@@ -14,11 +14,11 @@ fn main() {
let _foo = &[1_usize, 2] as [usize]; let _foo = &[1_usize, 2] as [usize];
//~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]`
//~^^ HELP consider using an implicit coercion to `&[usize]` instead //~^^ HELP consider using an implicit coercion to `&[usize]` instead
let _bar = box 1_usize as std::fmt::Show; let _bar = box 1_usize as std::fmt::Debug;
//~^ ERROR cast to unsized type: `Box<usize>` as `core::fmt::Show` //~^ ERROR cast to unsized type: `Box<usize>` as `core::fmt::Debug`
//~^^ HELP did you mean `Box<core::fmt::Show>`? //~^^ HELP did you mean `Box<core::fmt::Debug>`?
let _baz = 1_usize as std::fmt::Show; let _baz = 1_usize as std::fmt::Debug;
//~^ ERROR cast to unsized type: `usize` as `core::fmt::Show` //~^ ERROR cast to unsized type: `usize` as `core::fmt::Debug`
//~^^ HELP consider using a box or reference as appropriate //~^^ HELP consider using a box or reference as appropriate
let _quux = [1_usize, 2] as [usize]; let _quux = [1_usize, 2] as [usize];
//~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]`

View File

@@ -18,7 +18,7 @@ struct Number {
n: i64 n: i64
} }
impl fmt::String for Number { impl fmt::Display for Number {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.n) write!(f, "{}", self.n)
} }

View File

@@ -8,11 +8,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
fn main() { fn main() {
let x: Box<Show+> = box 3 as Box<Show+>; let x: Box<Debug+> = box 3 as Box<Debug+>;
//~^ ERROR at least one type parameter bound must be specified //~^ ERROR at least one type parameter bound must be specified
//~^^ ERROR at least one type parameter bound must be specified //~^^ ERROR at least one type parameter bound must be specified
} }

View File

@@ -54,7 +54,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
} }
} }
impl fmt::String for cat { impl fmt::Display for cat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name) write!(f, "{}", self.name)
} }

View File

@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::fmt::Show; use std::fmt::Debug;
use std::default::Default; use std::default::Default;
// Test that an impl for homogeneous pairs does not conflict with a // Test that an impl for homogeneous pairs does not conflict with a

View File

@@ -101,7 +101,7 @@ impl AsciiArt {
// Allows AsciiArt to be converted to a string using the libcore ToString trait. // Allows AsciiArt to be converted to a string using the libcore ToString trait.
// Note that the %s fmt! specifier will not call this automatically. // Note that the %s fmt! specifier will not call this automatically.
impl fmt::String for AsciiArt { impl fmt::Display for AsciiArt {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Convert each line into a string. // Convert each line into a string.
let lines = self.lines.iter() let lines = self.lines.iter()