Closed
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c95a5c248a2a9b88242ae9bb08b1a836
fn foo() where T: Send {
let s = "abc".to_string();
}
The current output is:
error[[E0412]](https://doc.rust-lang.org/nightly/error-index.html#E0412): cannot find type `T` in this scope
[--> src/lib.rs:1:16
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) |
1 | fn foo() where T: Send {
| - ^ not found in this scope
| |
| help: you might be missing a type parameter: `<T>`
error[[E0282]](https://doc.rust-lang.org/nightly/error-index.html#E0282): type annotations needed
[--> src/lib.rs:2:19
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) |
2 | let s = "abc".to_string();
| ^^^^^^^^^ cannot infer type
|
= note: type must be known at this point
error[[E0599]](https://doc.rust-lang.org/nightly/error-index.html#E0599): no method named `to_string` found for reference `&'static str` in the current scope
[--> src/lib.rs:2:19
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) |
2 | let s = "abc".to_string();
| ^^^^^^^^^ method not found in `&'static str`
Some errors have detailed explanations: E0282, E0412, E0599.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `playground` due to 3 previous errors
The first error is great, but the other ones are quite strange. Ideally the output would not have them and look like:
error[[E0412]](https://doc.rust-lang.org/nightly/error-index.html#E0412): cannot find type `T` in this scope
[--> src/lib.rs:1:16
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) |
1 | fn foo() where T: Send {
| - ^ not found in this scope
| |
| help: you might be missing a type parameter: `<T>`
Output is the same on stable and nightly