diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-06 22:45:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-06 22:45:40 +0100 |
| commit | a0c3b8782398e6cb7044cd17980d789be74ccb92 (patch) | |
| tree | 18837acabc5df6f33350771a883ea17766c69c3e /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | ce32d4862b4b50fcf7d1717033336e952839888a (diff) | |
| parent | 9ccc77036a144cc0d172c28e48c330d544ae5471 (diff) | |
| download | rust-a0c3b8782398e6cb7044cd17980d789be74ccb92.tar.gz rust-a0c3b8782398e6cb7044cd17980d789be74ccb92.zip | |
Rollup merge of #120396 - estebank:method-on-unbounded-type-param, r=nnethercote
Account for unbounded type param receiver in suggestions
When encountering
```rust
fn f<T>(a: T, b: T) -> std::cmp::Ordering {
a.cmp(&b) //~ ERROR E0599
}
```
output
```
error[E0599]: no method named `cmp` found for type parameter `T` in the current scope
--> $DIR/method-on-unbounded-type-param.rs:2:7
|
LL | fn f<T>(a: T, b: T) -> std::cmp::Ordering {
| - method `cmp` not found for this type parameter
LL | a.cmp(&b)
| ^^^ method cannot be called on `T` due to unsatisfied trait bounds
|
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
|
LL | fn f<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
| +++++
LL | fn f<T: Iterator>(a: T, b: T) -> std::cmp::Ordering {
| ++++++++++
```
Fix #120186.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
