Add Cow -> Box impls. · rust-lang/rust@778d5f2 (original) (raw)

`@@ -53,6 +53,7 @@

`

53

53

``

54

54

`use alloc::allocator;

`

55

55

`use any::TypeId;

`

``

56

`+

use borrow::Cow;

`

56

57

`use cell;

`

57

58

`use char;

`

58

59

`use fmt::{self, Debug, Display};

`

`@@ -217,6 +218,20 @@ impl<'a> From<&'a str> for Box {

`

217

218

`}

`

218

219

`}

`

219

220

``

``

221

`+

#[stable(feature = "cow_box_error", since = "1.22.0")]

`

``

222

`+

impl<'a, 'b> From<Cow<'b, str>> for Box<Error + Send + Sync + 'a> {

`

``

223

`+

fn from(err: Cow<'b, str>) -> Box<Error + Send + Sync + 'a> {

`

``

224

`+

From::from(String::from(err))

`

``

225

`+

}

`

``

226

`+

}

`

``

227

+

``

228

`+

#[stable(feature = "cow_box_error", since = "1.22.0")]

`

``

229

`+

impl<'a> From<Cow<'a, str>> for Box {

`

``

230

`+

fn from(err: Cow<'a, str>) -> Box {

`

``

231

`+

From::from(String::from(err))

`

``

232

`+

}

`

``

233

`+

}

`

``

234

+

220

235

`#[unstable(feature = "never_type_impls", issue = "35121")]

`

221

236

`impl Error for ! {

`

222

237

`fn description(&self) -> &str { *self }

`