diff options
| author | bors <bors@rust-lang.org> | 2019-03-23 22:26:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-03-23 22:26:11 +0000 |
| commit | 93f5ba0ee5e49090d149e2a2df422901d538cbb7 (patch) | |
| tree | 7e10d0cf3aca3f1162d1003b58902084a874d2f2 /src/libsyntax | |
| parent | 0633c55d2030969d91b57142b8582c53101e6339 (diff) | |
| parent | 59f0f2edc16131aa5ac199e1a348ceddebef1636 (diff) | |
| download | rust-93f5ba0ee5e49090d149e2a2df422901d538cbb7.tar.gz rust-93f5ba0ee5e49090d149e2a2df422901d538cbb7.zip | |
Auto merge of #59084 - estebank:diagnostic-spans, r=davidtwco
Tweak some diagnostic spans
Diffstat (limited to 'src/libsyntax')
| -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(); } |
