From 4675690ac4022a937f6817570e06f987c2efbc61 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Tue, 1 Jun 2021 18:01:13 +0200 Subject: [PATCH] Fix issues and add test --- compiler/rustc_lint/src/levels.rs | 2 +- compiler/rustc_middle/src/lint.rs | 1 - src/test/ui/lint/force-warn/force-allowed-group.rs | 2 +- src/test/ui/lint/force-warn/force-warn-group.rs | 13 +++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/test/ui/lint/force-warn/force-warn-group.rs diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 482ec58fd1a..4f3d98304e7 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -147,7 +147,7 @@ impl<'s> LintLevelsBuilder<'s> { LintLevelSource::Default => false, LintLevelSource::Node(symbol, _, _) => self.store.is_lint_group(symbol), LintLevelSource::CommandLine(symbol, _) => self.store.is_lint_group(symbol), - LintLevelSource::ForceWarn(symbol) => { + LintLevelSource::ForceWarn(_symbol) => { bug!("forced warn lint returned a forbid lint level") } }; diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index af9bc5ebe70..f3088326db8 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -1,7 +1,6 @@ use std::cmp; use crate::ich::StableHashingContext; -use chalk_ir::Substitution; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_errors::{DiagnosticBuilder, DiagnosticId}; diff --git a/src/test/ui/lint/force-warn/force-allowed-group.rs b/src/test/ui/lint/force-warn/force-allowed-group.rs index fe8b106a086..b68b979ca11 100644 --- a/src/test/ui/lint/force-warn/force-allowed-group.rs +++ b/src/test/ui/lint/force-warn/force-allowed-group.rs @@ -1,7 +1,7 @@ // compile-flags: --force-warns bare_trait_objects // check-pass -#![allow(rust_2018_compatibility)] +#![allow(rust_2018_idioms)] pub trait SomeTrait {} diff --git a/src/test/ui/lint/force-warn/force-warn-group.rs b/src/test/ui/lint/force-warn/force-warn-group.rs new file mode 100644 index 00000000000..3206d75e940 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-warn-group.rs @@ -0,0 +1,13 @@ +// ignore-test +// compile-flags: --force-warns rust_2018_idioms +// check-pass + +#![allow(rust_2018_idioms)] + +pub trait SomeTrait {} + +pub fn function(_x: Box) {} +//~^ WARN trait objects without an explicit `dyn` are deprecated +//~| WARN this was previously accepted by the compiler + +fn main() {}