about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-12 06:27:16 +0100
committerGitHub <noreply@github.com>2024-11-12 06:27:16 +0100
commit9098e03fb21ec6591e4c394059e9a02df297d29f (patch)
treee53d5ab06c2b2cbee57bc04bf8a29d2fd5dddd95 /compiler/rustc_middle/src
parent67f21277cd40cd12e69aa34089f4a20926fd6dc5 (diff)
parent02add7d0fbc65296af285fe5c62b36b42a9f476f (diff)
downloadrust-9098e03fb21ec6591e4c394059e9a02df297d29f.tar.gz
rust-9098e03fb21ec6591e4c394059e9a02df297d29f.zip
Rollup merge of #132487 - dianne:include-trait-args-in-suggestion, r=fmease
Provide placeholder generics for traits in "no method found for type parameter" suggestions

In the diagnostics for the error ``no method named `method` found for type parameter `T` in the current scope [E0599]``, the compiler will suggest adding bounds on `T` for traits that define a method named `method`. However, these suggestions didn't include any generic arguments, so applying them would result in a `missing generics for trait` or `missing lifetime specifier` error. This PR adds placeholder arguments to the suggestion in such cases. Specifically, I tried to base the placeholders off of what's done in suggestions for when generics are missing or too few are provided:
- The placeholder for a parameter without a default is the name of the parameter.
- Placeholders are not provided for parameters with defaults.

Placeholder arguments are enclosed in `/*` and `*/`, and the applicability of the suggestion is downgraded to `Applicability::HasPlaceholders` if any placeholders are provided.

Fixes #132407
Diffstat (limited to 'compiler/rustc_middle/src')
0 files changed, 0 insertions, 0 deletions