diff options
| author | Josh Stone <cuviper@gmail.com> | 2019-03-27 18:15:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-27 18:15:24 -0700 |
| commit | e5fa59735bdc6624a4489b82801c4dc44998f81b (patch) | |
| tree | a48fbd1828f081d4bf52fc2a3625c8ef0fc33ea0 /src/libcore | |
| parent | ecf63630cfbeeb62764a9b417f29258d6abdd2df (diff) | |
| parent | e929d19edc99e5eb7af319709247470cff99719b (diff) | |
| download | rust-e5fa59735bdc6624a4489b82801c4dc44998f81b.tar.gz rust-e5fa59735bdc6624a4489b82801c4dc44998f81b.zip | |
Rollup merge of #59268 - estebank:from-string, r=QuietMisdreavus
Add suggestion to use `&*var` when `&str: From<String>` is expected Fix #53879.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/convert.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index cee4fc6f49a..a6c65e890a5 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -363,6 +363,12 @@ pub trait Into<T>: Sized { /// [`from`]: trait.From.html#tymethod.from /// [book]: ../../book/ch09-00-error-handling.html #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented( + on( + all(_Self="&str", T="std::string::String"), + note="to coerce a `{T}` into a `{Self}`, use `&*` as a prefix", + ) +)] pub trait From<T>: Sized { /// Performs the conversion. #[stable(feature = "rust1", since = "1.0.0")] |
