Skip to content

Commit 1a8011f

Browse files
committed
Rollup merge of rust-lang#52093 - alexcrichton:update-issue, r=kennytm
rustc: Update tracking issue for wasm_import_module It's now rust-lang#52090
2 parents 20e32ee + 23fbfb5 commit 1a8011f

File tree

5 files changed

+60
-22
lines changed

5 files changed

+60
-22
lines changed

src/librustc/session/config.rs

+24-17
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,29 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> ast::CrateConfig {
17491749
.collect::<ast::CrateConfig>()
17501750
}
17511751

1752+
pub fn get_cmd_lint_options(matches: &getopts::Matches,
1753+
error_format: ErrorOutputType)
1754+
-> (Vec<(String, lint::Level)>, bool, Option<lint::Level>) {
1755+
let mut lint_opts = vec![];
1756+
let mut describe_lints = false;
1757+
1758+
for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
1759+
for lint_name in matches.opt_strs(level.as_str()) {
1760+
if lint_name == "help" {
1761+
describe_lints = true;
1762+
} else {
1763+
lint_opts.push((lint_name.replace("-", "_"), level));
1764+
}
1765+
}
1766+
}
1767+
1768+
let lint_cap = matches.opt_str("cap-lints").map(|cap| {
1769+
lint::Level::from_str(&cap)
1770+
.unwrap_or_else(|| early_error(error_format, &format!("unknown lint level: `{}`", cap)))
1771+
});
1772+
(lint_opts, describe_lints, lint_cap)
1773+
}
1774+
17521775
pub fn build_session_options_and_crate_config(
17531776
matches: &getopts::Matches,
17541777
) -> (Options, ast::CrateConfig) {
@@ -1826,23 +1849,7 @@ pub fn build_session_options_and_crate_config(
18261849
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
18271850
.unwrap_or_else(|e| early_error(error_format, &e[..]));
18281851

1829-
let mut lint_opts = vec![];
1830-
let mut describe_lints = false;
1831-
1832-
for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
1833-
for lint_name in matches.opt_strs(level.as_str()) {
1834-
if lint_name == "help" {
1835-
describe_lints = true;
1836-
} else {
1837-
lint_opts.push((lint_name.replace("-", "_"), level));
1838-
}
1839-
}
1840-
}
1841-
1842-
let lint_cap = matches.opt_str("cap-lints").map(|cap| {
1843-
lint::Level::from_str(&cap)
1844-
.unwrap_or_else(|| early_error(error_format, &format!("unknown lint level: `{}`", cap)))
1845-
});
1852+
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
18461853

18471854
let mut debugging_opts = build_debugging_options(matches, error_format);
18481855

src/librustdoc/core.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ pub fn run_core(search_paths: SearchPaths,
178178
force_unstable_if_unmarked: bool,
179179
edition: Edition,
180180
cg: CodegenOptions,
181-
error_format: ErrorOutputType) -> (clean::Crate, RenderInfo)
181+
error_format: ErrorOutputType,
182+
cmd_lints: Vec<(String, lint::Level)>,
183+
lint_cap: Option<lint::Level>,
184+
describe_lints: bool) -> (clean::Crate, RenderInfo)
182185
{
183186
// Parse, resolve, and typecheck the given crate.
184187

@@ -200,6 +203,7 @@ pub fn run_core(search_paths: SearchPaths,
200203
Some((lint.name_lower(), lint::Allow))
201204
}
202205
})
206+
.chain(cmd_lints.into_iter())
203207
.collect::<Vec<_>>();
204208

205209
let host_triple = TargetTriple::from_triple(config::host_triple());
@@ -213,7 +217,7 @@ pub fn run_core(search_paths: SearchPaths,
213217
} else {
214218
vec![]
215219
},
216-
lint_cap: Some(lint::Forbid),
220+
lint_cap: Some(lint_cap.unwrap_or_else(|| lint::Forbid)),
217221
cg,
218222
externs,
219223
target_triple: triple.unwrap_or(host_triple),
@@ -226,6 +230,7 @@ pub fn run_core(search_paths: SearchPaths,
226230
},
227231
error_format,
228232
edition,
233+
describe_lints,
229234
..config::basic_options()
230235
};
231236
driver::spawn_thread_pool(sessopts, move |sessopts| {

src/librustdoc/lib.rs

+27-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use rustc::session::search_paths::SearchPaths;
6868
use rustc::session::config::{ErrorOutputType, RustcOptGroup, Externs, CodegenOptions};
6969
use rustc::session::config::{nightly_options, build_codegen_options};
7070
use rustc_target::spec::TargetTriple;
71+
use rustc::session::config::get_cmd_lint_options;
7172

7273
#[macro_use]
7374
pub mod externalfiles;
@@ -308,6 +309,28 @@ pub fn opts() -> Vec<RustcOptGroup> {
308309
"disable-minification",
309310
"Disable minification applied on JS files")
310311
}),
312+
unstable("warn", |o| {
313+
o.optmulti("W", "warn", "Set lint warnings", "OPT")
314+
}),
315+
unstable("allow", |o| {
316+
o.optmulti("A", "allow", "Set lint allowed", "OPT")
317+
}),
318+
unstable("deny", |o| {
319+
o.optmulti("D", "deny", "Set lint denied", "OPT")
320+
}),
321+
unstable("forbid", |o| {
322+
o.optmulti("F", "forbid", "Set lint forbidden", "OPT")
323+
}),
324+
unstable("cap-lints", |o| {
325+
o.optmulti(
326+
"",
327+
"cap-lints",
328+
"Set the most restrictive lint level. \
329+
More restrictive lints are capped at this \
330+
level. By default, it is at `forbid` level.",
331+
"LEVEL",
332+
)
333+
}),
311334
]
312335
}
313336

@@ -640,6 +663,8 @@ where R: 'static + Send,
640663
*x == "force-unstable-if-unmarked"
641664
});
642665

666+
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
667+
643668
let (tx, rx) = channel();
644669

645670
rustc_driver::monitor(move || syntax::with_globals(move || {
@@ -648,7 +673,8 @@ where R: 'static + Send,
648673
let (mut krate, renderinfo) =
649674
core::run_core(paths, cfgs, externs, Input::File(cratefile), triple, maybe_sysroot,
650675
display_warnings, crate_name.clone(),
651-
force_unstable_if_unmarked, edition, cg, error_format);
676+
force_unstable_if_unmarked, edition, cg, error_format,
677+
lint_opts, lint_cap, describe_lints);
652678

653679
info!("finished with rustc");
654680

src/libsyntax/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ declare_features! (
421421
(active, wasm_custom_section, "1.26.0", Some(51088), None),
422422

423423
// The #![wasm_import_module] attribute
424-
(active, wasm_import_module, "1.26.0", Some(51088), None),
424+
(active, wasm_import_module, "1.26.0", Some(52090), None),
425425

426426
// Allows keywords to be escaped for use as identifiers
427427
(active, raw_identifiers, "1.26.0", Some(48589), None),

src/test/ui/feature-gate-wasm_import_module.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: experimental attribute (see issue #51088)
1+
error[E0658]: experimental attribute (see issue #52090)
22
--> $DIR/feature-gate-wasm_import_module.rs:11:1
33
|
44
LL | #[wasm_import_module = "test"] //~ ERROR: experimental

0 commit comments

Comments
 (0)