From 224aec213d62aa11758c864c871c341b7e7e7681 Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 13 Jul 2022 13:10:37 +0100 Subject: middle: add `implies_by` to `#[unstable]` If part of a feature is stabilized and a new feature is added for the remaining parts, then the `implied_by` attribute can be used to indicate which now-stable feature previously contained a item. If the now-stable feature is still active (if the user has only just updated rustc, for example) then there will not be an stability error for uses of the item from the implied feature. Signed-off-by: David Wood --- compiler/rustc_span/src/symbol.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler/rustc_span/src') diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ec1d2c39b80..2ac1ecfe87e 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -800,6 +800,7 @@ symbols! { impl_lint_pass, impl_macros, impl_trait_in_bindings, + implied_by, import, import_shadowing, imported_main, -- cgit 1.4.1-3-g733a5 From 97edb9f336e98c0597210092e2e0ef0ee1576e24 Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 13 Jul 2022 15:02:23 +0100 Subject: span: add `span_extend_to_line` helper Adds a simple helper function to the `SourceMap` for extending a `Span` to encompass the entire line it is on - useful for suggestions where removing a line is the suggested action. Signed-off-by: David Wood --- compiler/rustc_span/src/source_map.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler/rustc_span/src') diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index afbb88e9233..b4a4424e876 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -718,6 +718,11 @@ impl SourceMap { sp } + /// Extends the given `Span` to contain the entire line it is on. + pub fn span_extend_to_line(&self, sp: Span) -> Span { + self.span_extend_to_prev_char(self.span_extend_to_next_char(sp, '\n', true), '\n', true) + } + /// Given a `Span`, tries to get a shorter span ending before the first occurrence of `char` /// `c`. pub fn span_until_char(&self, sp: Span, c: char) -> Span { -- cgit 1.4.1-3-g733a5