Skip to content
/ rust Public
forked from rust-lang/rust

Commit 1557c9f

Browse files
authored
Rollup merge of rust-lang#152852 - bjorn3:remove_driver_lint_caps, r=notriddle
Remove driver_lint_caps It was only used by rustdoc and doesn't seem like it was necessary there. No tests fail at least. r? rust-lang/rustdoc
2 parents beae781 + e1491b9 commit 1557c9f

12 files changed

Lines changed: 17 additions & 59 deletions

File tree

compiler/rustc_baked_icu_data/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
2222
// tidy-alphabetical-start
2323
#![allow(elided_lifetimes_in_paths)]
24-
#![allow(unreachable_pub)] // because this crate is mostly generated code
24+
#![allow(unreachable_pub, reason = "this crate is mostly generated code")]
2525
// #![warn(unreachable_pub)] // don't use because this crate is mostly generated code
26+
#![doc(test(attr(elided_lifetimes_in_paths)))]
2627
// tidy-alphabetical-end
2728

2829
pub struct BakedDataProvider;

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
213213
output_dir: odir,
214214
ice_file,
215215
file_loader: None,
216-
lint_caps: Default::default(),
217216
psess_created: None,
218217
track_state: None,
219218
register_lints: None,

compiler/rustc_interface/src/interface.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::sync::Arc;
44

55
use rustc_ast::{LitKind, MetaItemKind, token};
66
use rustc_codegen_ssa::traits::CodegenBackend;
7-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
7+
use rustc_data_structures::fx::FxHashSet;
88
use rustc_data_structures::jobserver::{self, Proxy};
99
use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed};
1010
use rustc_lint::LintStore;
@@ -18,7 +18,7 @@ use rustc_parse::parser::attr::AllowLeadingUnsafe;
1818
use rustc_query_impl::print_query_stack;
1919
use rustc_session::config::{self, Cfg, CheckCfg, ExpectedValues, Input, OutFileName};
2020
use rustc_session::parse::ParseSess;
21-
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, lint};
21+
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session};
2222
use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMapInputs};
2323
use rustc_span::{FileName, sym};
2424
use tracing::trace;
@@ -330,8 +330,6 @@ pub struct Config {
330330
/// running rustc without having to save". (See #102759.)
331331
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
332332

333-
pub lint_caps: FxHashMap<lint::LintId, lint::Level>,
334-
335333
/// This is a callback from the driver that is called when [`ParseSess`] is created.
336334
pub psess_created: Option<Box<dyn FnOnce(&mut ParseSess) + Send>>,
337335

@@ -427,7 +425,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
427425
output_file: config.output_file,
428426
temps_dir,
429427
},
430-
config.lint_caps,
431428
target,
432429
util::rustc_version_str().unwrap_or("unknown"),
433430
config.ice_file,

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,7 @@ where
6868

6969
static USING_INTERNAL_FEATURES: AtomicBool = AtomicBool::new(false);
7070

71-
let sess = build_session(
72-
sessopts,
73-
io,
74-
Default::default(),
75-
target,
76-
"",
77-
None,
78-
&USING_INTERNAL_FEATURES,
79-
);
71+
let sess = build_session(sessopts, io, target, "", None, &USING_INTERNAL_FEATURES);
8072
let cfg = parse_cfg(sess.dcx(), matches.opt_strs("cfg"));
8173
let cfg = build_configuration(&sess, cfg);
8274
f(sess, cfg)

compiler/rustc_middle/src/lint.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ pub fn reveal_actual_level_spec<Id: Copy>(
186186
level_spec.level = min(level_spec.level, sess.opts.lint_cap.unwrap_or(Level::Forbid));
187187
};
188188

189-
// Ensure that we never exceed driver level.
190-
if let Some(driver_level) = sess.driver_lint_caps.get(&lint) {
191-
level_spec.level = min(level_spec.level, *driver_level);
192-
}
193-
194189
level_spec
195190
}
196191

compiler/rustc_session/src/session.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ pub struct Session {
117117
/// This only ever stores a `LintStore` but we don't want a dependency on that type here.
118118
pub lint_store: Option<Arc<dyn DynLintStore>>,
119119

120-
/// Cap lint level specified by a driver specifically.
121-
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
122-
123120
/// Tracks the current behavior of the CTFE engine when an error occurs.
124121
/// Options range from returning the error without a backtrace to returning an error
125122
/// and immediately printing the backtrace to stderr.
@@ -1010,7 +1007,6 @@ fn default_emitter(sopts: &config::Options, source_map: Arc<SourceMap>) -> Box<D
10101007
pub fn build_session(
10111008
sopts: config::Options,
10121009
io: CompilerIO,
1013-
driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
10141010
target: Target,
10151011
cfg_version: &'static str,
10161012
ice_file: Option<PathBuf>,
@@ -1116,7 +1112,6 @@ pub fn build_session(
11161112
timings,
11171113
code_stats: Default::default(),
11181114
lint_store: None,
1119-
driver_lint_caps,
11201115
ctfe_backtrace,
11211116
miri_unleashed_features: Lock::new(Default::default()),
11221117
asm_arch,

src/doc/rustc-dev-guide/examples/rustc-interface-example.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ fn main() {
2828
println!("{HELLO}");
2929
}
3030
"#
31-
.into(),
31+
.into(),
3232
},
33-
output_dir: None, // Option<PathBuf>
34-
output_file: None, // Option<PathBuf>
35-
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
36-
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
33+
output_dir: None, // Option<PathBuf>
34+
output_file: None, // Option<PathBuf>
35+
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
3736
// This is a callback from the driver that is called when [`ParseSess`] is created.
3837
psess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>
3938
// This is a callback from the driver that is called when we're registering lints;

src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,13 @@ fn main() {
5959
let x: &str = 1;
6060
}
6161
"
62-
.into(),
62+
.into(),
6363
},
6464
crate_cfg: Vec::new(),
6565
crate_check_cfg: Vec::new(),
6666
output_dir: None,
6767
output_file: None,
6868
file_loader: None,
69-
lint_caps: rustc_hash::FxHashMap::default(),
7069
psess_created: Some(Box::new(|parse_sess| {
7170
parse_sess.dcx().set_emitter(Box::new(DebugEmitter {
7271
source_map: parse_sess.clone_source_map(),

src/librustdoc/core.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub(crate) fn create_config(
247247
];
248248
lints_to_show.extend(crate::lint::RUSTDOC_LINTS.iter().map(|lint| lint.name.to_string()));
249249

250-
let (lint_opts, lint_caps) = crate::lint::init_lints(lints_to_show, lint_opts, |lint| {
250+
let lint_opts = crate::lint::init_lints(lints_to_show, lint_opts, |lint| {
251251
Some((lint.name_lower(), lint::Allow))
252252
});
253253

@@ -302,7 +302,6 @@ pub(crate) fn create_config(
302302
Some(render_options.output.clone())
303303
},
304304
file_loader: None,
305-
lint_caps,
306305
psess_created: None,
307306
track_state: None,
308307
register_lints: Some(Box::new(crate::lint::register_lints)),

src/librustdoc/doctest.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
144144
lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_owned(),
145145
];
146146

147-
let (lint_opts, lint_caps) = init_lints(allowed_lints, options.lint_opts.clone(), |lint| {
147+
let lint_opts = init_lints(allowed_lints, options.lint_opts.clone(), |lint| {
148148
if lint.name == invalid_codeblock_attributes_name {
149149
None
150150
} else {
@@ -162,7 +162,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
162162
search_paths: options.libs.clone(),
163163
crate_types,
164164
lint_opts,
165-
lint_cap: Some(options.lint_cap.unwrap_or(lint::Forbid)),
165+
lint_cap: None,
166166
cg: options.codegen_options.clone(),
167167
externs: options.externs.clone(),
168168
unstable_features: options.unstable_features,
@@ -189,7 +189,6 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
189189
output_file: None,
190190
output_dir: None,
191191
file_loader: None,
192-
lint_caps,
193192
psess_created: None,
194193
track_state: None,
195194
register_lints: Some(Box::new(crate::lint::register_lints)),

0 commit comments

Comments
 (0)