diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-17 06:30:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-17 06:30:02 +0100 |
| commit | a1a750b5adce06fc77b22ee32eecd7c83ad2d090 (patch) | |
| tree | 09c21dda1fc679cc9363d6635abcaf305be0deb4 /compiler/rustc_trait_selection/src | |
| parent | 3e727054ad7671b64bea2a0a8ae97c78c2237ae4 (diff) | |
| parent | 91adb6ccd693737aaf740bc18bc6f82e3898d322 (diff) | |
| download | rust-a1a750b5adce06fc77b22ee32eecd7c83ad2d090.tar.gz rust-a1a750b5adce06fc77b22ee32eecd7c83ad2d090.zip | |
Rollup merge of #94030 - ChayimFriedman2:issue-94010, r=petrochenkov
Correctly mark the span of captured arguments in `format_args!()` It should not include the braces, or misspelling suggestions will be wrong. Fixes #94010.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/on_unimplemented.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs index bdf677a63b6..b05dbbe898a 100644 --- a/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/on_unimplemented.rs @@ -309,23 +309,23 @@ impl<'tcx> OnUnimplementedFormatString { Piece::String(_) => (), // Normal string, no need to check it Piece::NextArgument(a) => match a.position { // `{Self}` is allowed - Position::ArgumentNamed(s) if s == kw::SelfUpper => (), + Position::ArgumentNamed(s, _) if s == kw::SelfUpper => (), // `{ThisTraitsName}` is allowed - Position::ArgumentNamed(s) if s == name => (), + Position::ArgumentNamed(s, _) if s == name => (), // `{from_method}` is allowed - Position::ArgumentNamed(s) if s == sym::from_method => (), + Position::ArgumentNamed(s, _) if s == sym::from_method => (), // `{from_desugaring}` is allowed - Position::ArgumentNamed(s) if s == sym::from_desugaring => (), + Position::ArgumentNamed(s, _) if s == sym::from_desugaring => (), // `{ItemContext}` is allowed - Position::ArgumentNamed(s) if s == sym::ItemContext => (), + Position::ArgumentNamed(s, _) if s == sym::ItemContext => (), // `{integral}` and `{integer}` and `{float}` are allowed - Position::ArgumentNamed(s) + Position::ArgumentNamed(s, _) if s == sym::integral || s == sym::integer_ || s == sym::float => { () } // So is `{A}` if A is a type parameter - Position::ArgumentNamed(s) => { + Position::ArgumentNamed(s, _) => { match generics.params.iter().find(|param| param.name == s) { Some(_) => (), None => { @@ -392,7 +392,7 @@ impl<'tcx> OnUnimplementedFormatString { .map(|p| match p { Piece::String(s) => s, Piece::NextArgument(a) => match a.position { - Position::ArgumentNamed(s) => match generic_map.get(&s) { + Position::ArgumentNamed(s, _) => match generic_map.get(&s) { Some(val) => val, None if s == name => &trait_str, None => { |
