Skip to content

Commit d69bdfe

Browse files
Implement the unused variable pass on the MIR
1 parent 6a2987b commit d69bdfe

File tree

6 files changed

+379
-0
lines changed

6 files changed

+379
-0
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4164,6 +4164,7 @@ dependencies = [
41644164
"rustc_infer",
41654165
"rustc_macros",
41664166
"rustc_middle",
4167+
"rustc_mir",
41674168
"rustc_session",
41684169
"rustc_span",
41694170
"rustc_target",

src/librustc_mir_build/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ rustc_errors = { path = "../librustc_errors" }
2121
rustc_hir = { path = "../librustc_hir" }
2222
rustc_infer = { path = "../librustc_infer" }
2323
rustc_macros = { path = "../librustc_macros" }
24+
rustc_mir = { path = "../librustc_mir" } # Just for dataflow
2425
rustc_serialize = { path = "../libserialize", package = "serialize" }
2526
rustc_session = { path = "../librustc_session" }
2627
rustc_span = { path = "../librustc_span" }

src/librustc_mir_build/build/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Body<'_> {
183183
};
184184

185185
lints::unconditional_recursion::check(tcx, &body, def_id);
186+
lints::unused_variables::check(tcx, &body, def_id);
186187

187188
// The borrow checker will replace all the regions here with its own
188189
// inference variables. There's no point having non-erased regions here.

src/librustc_mir_build/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#![feature(const_panic)]
1010
#![feature(crate_visibility_modifier)]
1111
#![feature(bool_to_option)]
12+
#![feature(in_band_lifetimes)]
1213
#![feature(or_patterns)]
1314
#![recursion_limit = "256"]
1415

src/librustc_mir_build/lints/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
//! user's code as possible.
55
66
pub mod unconditional_recursion;
7+
pub mod unused_variables;

0 commit comments

Comments
 (0)