diff options
| author | xFrednet <xFrednet@gmail.com> | 2022-06-05 12:33:45 +0200 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2022-06-16 08:16:43 +0200 |
| commit | 8527a3d36985bed55de1832c3c1f3d470720bb0b (patch) | |
| tree | ad2f51bc362ba29e281ac832a2a8e62b7b9b8b2c /compiler/rustc_session/src | |
| parent | ec55c61305eaf385fc1b93ac9a78284b4d887fe5 (diff) | |
| download | rust-8527a3d36985bed55de1832c3c1f3d470720bb0b.tar.gz rust-8527a3d36985bed55de1832c3c1f3d470720bb0b.zip | |
Support lint expectations for `--force-warn` lints (RFC 2383)
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index c4a67006504..89d724626cc 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1432,7 +1432,7 @@ pub fn get_cmd_lint_options( let mut lint_opts_with_position = vec![]; let mut describe_lints = false; - for level in [lint::Allow, lint::Warn, lint::ForceWarn, lint::Deny, lint::Forbid] { + for level in [lint::Allow, lint::Warn, lint::ForceWarn(None), lint::Deny, lint::Forbid] { for (arg_pos, lint_name) in matches.opt_strs_pos(level.as_str()) { if lint_name == "help" { describe_lints = true; diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index b2c23cda6aa..06f3e59f9f7 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -286,6 +286,14 @@ impl Session { ) -> DiagnosticBuilder<'_, ()> { self.diagnostic().struct_span_warn(sp, msg) } + pub fn struct_span_warn_with_expectation<S: Into<MultiSpan>>( + &self, + sp: S, + msg: impl Into<DiagnosticMessage>, + id: lint::LintExpectationId, + ) -> DiagnosticBuilder<'_, ()> { + self.diagnostic().struct_span_warn_with_expectation(sp, msg, id) + } pub fn struct_span_warn_with_code<S: Into<MultiSpan>>( &self, sp: S, @@ -297,6 +305,13 @@ impl Session { pub fn struct_warn(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> { self.diagnostic().struct_warn(msg) } + pub fn struct_warn_with_expectation( + &self, + msg: impl Into<DiagnosticMessage>, + id: lint::LintExpectationId, + ) -> DiagnosticBuilder<'_, ()> { + self.diagnostic().struct_warn_with_expectation(msg, id) + } pub fn struct_span_allow<S: Into<MultiSpan>>( &self, sp: S, |
