diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-07-17 16:34:13 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-07-18 11:50:50 -0700 |
| commit | f22bc2d3ff650c3f0e5d492d18235d79ebdec230 (patch) | |
| tree | dd41933b53e5bfc11b6f24dce5b59afca56f3ee9 /src/test/ui/span | |
| parent | 2eb0bc5e3c52a34b6d62ab0527520c66e4c575bd (diff) | |
| download | rust-f22bc2d3ff650c3f0e5d492d18235d79ebdec230.tar.gz rust-f22bc2d3ff650c3f0e5d492d18235d79ebdec230.zip | |
Suggest trait bound on type parameter when it is unconstrained
Given
```
mented on Jan 26, 2015 •
trait Foo { fn method(&self) {} }
fn call_method<T>(x: &T) {
x.method()
}
```
suggest constraining `T` with `Foo`.
Diffstat (limited to 'src/test/ui/span')
| -rw-r--r-- | src/test/ui/span/issue-7575.stderr | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr index 614638752f1..36db5bea862 100644 --- a/src/test/ui/span/issue-7575.stderr +++ b/src/test/ui/span/issue-7575.stderr @@ -61,9 +61,11 @@ note: the candidate is defined in the trait `ManyImplTrait` LL | fn is_str() -> bool { | ^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `ManyImplTrait::is_str(t)` instead - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `is_str`, perhaps you need to implement it: - candidate #1: `ManyImplTrait` + = help: items from traits can only be used if the type parameter is bounded by the trait +help: the following trait defines an item `is_str`, perhaps you need to restrict type parameter `T` with it: + | +LL | fn param_bound<T: ManyImplTrait + ManyImplTrait>(t: T) -> bool { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors |
