| Age | Commit message (Collapse) | Author | Lines |
|
Previously, on a type mismatch (and if this wasn't preƫmpted by a
higher-priority suggestion), we would look for argumentless methods
returning the expected type, and list them in a `help` note.
This had two major shortcomings. Firstly, a lot of the suggestions didn't
really make sense (if you used a &str where a String was expected,
`.to_ascii_uppercase()` is probably not the solution you were hoping
for). Secondly, we weren't generating suggestions from the most useful
traits!
We address the first problem with an internal
`#[rustc_conversion_suggestion]` attribute meant to mark methods that keep
the "same value" in the relevant sense, just converting the type. We
address the second problem by making `FnCtxt.probe_for_return_type` pass
the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe
because grep reveals no other callers of `probe_for_return_type`.
Also, structured suggestions are preferred (because they're pretty, but
also for RLS and friends).
Also also, we make the E0055 autoderef recursion limit error use the
one-time-diagnostics set, because we can potentially hit the limit a lot
during probing. (Without this,
test/ui/did_you_mean/recursion_limit_deref.rs would report "aborting due to
51 errors").
Unfortunately, the trait probing is still not all one would hope for: at a
minimum, we don't know how to rule out `into()` in cases where it wouldn't
actually work, and we don't know how to rule in `.to_owned()` where it
would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME.
This is hoped to resolve #42929, #44672, and #45777.
|
|
|
|
|
|
Many AsciiExt imports have become useless thanks to the inherent ascii
methods added in the last commits. These were removed. In some places, I
fully specified the ascii method being called to enforce usage of the
AsciiExt trait. Note that some imports are not removed but tagged with
a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii
methods are not yet available in stage0. All those imports will be
removed later.
Additionally, failing tests were fixed. The test suite should exit
successfully now.
|
|
|
|
Clarify return type of `String::from_utf16_lossy`.
Fixes https://github.com/rust-lang/rust/issues/32874
|
|
Add doc example to String::as_mut_str
Fixes #44429.
|
|
Fixes https://github.com/rust-lang/rust/issues/32874
|
|
Fixes #44429.
|
|
Fixes #44428.
|
|
Remove Splice struct return value from String::splice
The implementation is now almost identical to the one in the RFC.
Fixes #44038
cc #32310
|
|
|
|
|
|
|
|
Like #43008 (f668999), but _much more aggressive_.
|
|
Add method `String::retain`
Behaves like `Vec::retain`, accepting a predicate `FnMut(char) -> bool`
and reducing the string to only characters for which the predicate
returns `true`.
|
|
Behaves like `Vec::retain`, accepting a predicate `FnMut(char) -> bool`
and reducing the string to only characters for which the predicate
returns `true`.
|
|
|
|
|
|
|
|
|
|
|
|
Convert Intos to Froms.
This is a resubmission of #42129 without `impl<T> From<Vec<T>> for Box<[T]>`.
|
|
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
|
|
Move it and Bound to core::ops while we're at it.
Closes #30877
|
|
Replaced by adding extra imports, adding hidden code (`# ...`), modifying
examples to be runnable (sorry Homura), specifying non-Rust code, and
converting to should_panic, no_run, or compile_fail.
Remaining "```ignore"s received an explanation why they are being ignored.
|
|
|
|
|
|
|
|
|