diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-03-10 19:46:44 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-03-23 13:05:30 -0700 |
| commit | 9bfb0ef818456cce57edcb2463f63f71594e4a13 (patch) | |
| tree | a018aee119063f38e6f53648b861f59f16ae4d57 /src/libsyntax/parse/parser.rs | |
| parent | e1be8b0318b6f5647ff385dce75e9eb8e958c116 (diff) | |
| download | rust-9bfb0ef818456cce57edcb2463f63f71594e4a13.tar.gz rust-9bfb0ef818456cce57edcb2463f63f71594e4a13.zip | |
Tweak unsupported negative trait bounds message
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6ff06aa4b31..99260314054 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5598,8 +5598,14 @@ impl<'a> Parser<'a> { if !negative_bounds.is_empty() || was_negative { let plural = negative_bounds.len() > 1; - let mut err = self.struct_span_err(negative_bounds, - "negative trait bounds are not supported"); + let last_span = negative_bounds.last().map(|sp| *sp); + let mut err = self.struct_span_err( + negative_bounds, + "negative trait bounds are not supported", + ); + if let Some(sp) = last_span { + err.span_label(sp, "negative trait bounds are not supported"); + } if let Some(bound_list) = colon_span { let bound_list = bound_list.to(self.prev_span); let mut new_bound_list = String::new(); @@ -5612,11 +5618,12 @@ impl<'a> Parser<'a> { } new_bound_list = new_bound_list.replacen(" +", ":", 1); } - err.span_suggestion_short(bound_list, - &format!("remove the trait bound{}", - if plural { "s" } else { "" }), - new_bound_list, - Applicability::MachineApplicable); + err.span_suggestion_hidden( + bound_list, + &format!("remove the trait bound{}", if plural { "s" } else { "" }), + new_bound_list, + Applicability::MachineApplicable, + ); } err.emit(); } |
