diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-12 02:54:42 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-11-12 04:08:34 +0000 |
| commit | 0dc6c1e59421e44e15cda1cef307b0381ba12468 (patch) | |
| tree | 0fe6281339af80cbf9b404dda71b4acc54ef75d4 /compiler/rustc_trait_selection/src | |
| parent | 81eef2d362a6f03db6f8928f82d94298d31eb81b (diff) | |
| download | rust-0dc6c1e59421e44e15cda1cef307b0381ba12468.tar.gz rust-0dc6c1e59421e44e15cda1cef307b0381ba12468.zip | |
Make precise capturing suggestion machine-applicable only if it has not APITs
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/errors.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index 3e06d0807d8..afac6fc6004 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -1907,10 +1907,18 @@ impl Subdiagnostic for AddPreciseCapturingForOvercapture { diag: &mut Diag<'_, G>, _f: &F, ) { + let applicability = if self.apit_spans.is_empty() { + Applicability::MachineApplicable + } else { + // If there are APIT that are converted to regular parameters, + // then this may make the API turbofishable in ways that were + // not intended. + Applicability::MaybeIncorrect + }; diag.multipart_suggestion_verbose( fluent::trait_selection_precise_capturing_overcaptures, self.suggs, - Applicability::MaybeIncorrect, + applicability, ); if !self.apit_spans.is_empty() { diag.span_note( |
