diff options
| author | bors <bors@rust-lang.org> | 2020-02-09 04:01:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-09 04:01:28 +0000 |
| commit | f8d830b4decaef5a6ae0f27baac14dfb48baa4c5 (patch) | |
| tree | a5e7a6a7f68e12dbd174c1313b4d0ab0e742dbdc /src/librustc_errors | |
| parent | a19edd6b161521a4f66716b3b45b8cf4d3f03f3a (diff) | |
| parent | d2b88b7050b0e21b136022c4cfe8d352c1425588 (diff) | |
| download | rust-f8d830b4decaef5a6ae0f27baac14dfb48baa4c5.tar.gz rust-f8d830b4decaef5a6ae0f27baac14dfb48baa4c5.zip | |
Auto merge of #68376 - Centril:move-ref-patterns, r=matthewjasper
Initial implementation of `#![feature(move_ref_pattern)]` Following up on #45600, under the gate `#![feature(move_ref_pattern)]`, `(ref x, mut y)` is allowed subject to restrictions necessary for soundness. The match checking implementation and tests for `#![feature(bindings_after_at)]` is also adjusted as necessary. Closes #45600. Tracking issue: #68354. r? @matthewjasper
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/diagnostic_builder.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 3c217c1d643..82bbae18a9c 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -186,11 +186,25 @@ impl<'a> DiagnosticBuilder<'a> { /// all, and you just supplied a `Span` to create the diagnostic, /// then the snippet will just include that `Span`, which is /// called the primary span. - pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self { + pub fn span_label(&mut self, span: Span, label: impl Into<String>) -> &mut Self { self.0.diagnostic.span_label(span, label); self } + /// Labels all the given spans with the provided label. + /// See `span_label` for more information. + pub fn span_labels( + &mut self, + spans: impl IntoIterator<Item = Span>, + label: impl AsRef<str>, + ) -> &mut Self { + let label = label.as_ref(); + for span in spans { + self.0.diagnostic.span_label(span, label); + } + self + } + forward!(pub fn note_expected_found( &mut self, expected_label: &dyn fmt::Display, |
