Skip to content

Commit ffc33b3

Browse files
authored
Rollup merge of #60513 - chrisvittal:remove-borrowck-compare, r=matthewjasper
Remove -Z borrowck=compare flag This is the start of the work that needs to be done on #59193. It just removes the flag and updates the tests. r? @matthewjasper
2 parents 0399d13 + db6f7a9 commit ffc33b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+128
-675
lines changed

src/librustc/infer/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ impl SuppressRegionErrors {
9797
// If we're on Migrate mode, report AST region errors
9898
BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false },
9999

100-
// If we're on MIR or Compare mode, don't report AST region errors as they should
101-
// be reported by NLL
102-
BorrowckMode::Compare | BorrowckMode::Mir => SuppressRegionErrors { suppressed: true },
100+
// If we're on MIR, don't report AST region errors as they should be reported by NLL
101+
BorrowckMode::Mir => SuppressRegionErrors { suppressed: true },
103102
}
104103
}
105104
}

src/librustc/session/config.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ pub enum PrintRequest {
462462
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
463463
pub enum BorrowckMode {
464464
Mir,
465-
Compare,
466465
Migrate,
467466
}
468467

@@ -471,7 +470,6 @@ impl BorrowckMode {
471470
/// on the AST borrow check if the MIR-based one errors.
472471
pub fn migrate(self) -> bool {
473472
match self {
474-
BorrowckMode::Compare => false,
475473
BorrowckMode::Mir => false,
476474
BorrowckMode::Migrate => true,
477475
}
@@ -480,7 +478,6 @@ impl BorrowckMode {
480478
/// Should we emit the AST-based borrow checker errors?
481479
pub fn use_ast(self) -> bool {
482480
match self {
483-
BorrowckMode::Compare => true,
484481
BorrowckMode::Mir => false,
485482
BorrowckMode::Migrate => false,
486483
}
@@ -1214,7 +1211,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12141211
identify_regions: bool = (false, parse_bool, [UNTRACKED],
12151212
"make unnamed regions display as '# (where # is some non-ident unique id)"),
12161213
borrowck: Option<String> = (None, parse_opt_string, [UNTRACKED],
1217-
"select which borrowck is used (`ast`, `mir`, `migrate`, or `compare`)"),
1214+
"select which borrowck is used (`mir` or `migrate`)"),
12181215
time_passes: bool = (false, parse_bool, [UNTRACKED],
12191216
"measure time of each rustc pass"),
12201217
time: bool = (false, parse_bool, [UNTRACKED],
@@ -2315,7 +2312,6 @@ pub fn build_session_options_and_crate_config(
23152312
let borrowck_mode = match debugging_opts.borrowck.as_ref().map(|s| &s[..]) {
23162313
None | Some("migrate") => BorrowckMode::Migrate,
23172314
Some("mir") => BorrowckMode::Mir,
2318-
Some("compare") => BorrowckMode::Compare,
23192315
Some(m) => early_error(error_format, &format!("unknown borrowck mode `{}`", m)),
23202316
};
23212317

src/librustc_mir/util/borrowck_errors.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,10 @@ pub enum Origin {
1212
}
1313

1414
impl fmt::Display for Origin {
15-
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
16-
// If the user passed `-Z borrowck=compare`, then include
17-
// origin info as part of the error report,
18-
// otherwise
19-
let display_origin = ty::tls::with_opt(|opt_tcx| {
20-
if let Some(tcx) = opt_tcx {
21-
tcx.sess.opts.borrowck_mode == BorrowckMode::Compare
22-
} else {
23-
false
24-
}
25-
});
26-
if display_origin {
27-
match *self {
28-
Origin::Mir => write!(w, " (Mir)"),
29-
Origin::Ast => write!(w, " (Ast)"),
30-
}
31-
} else {
32-
// Print no origin info
33-
Ok(())
34-
}
15+
fn fmt(&self, _w: &mut fmt::Formatter<'_>) -> fmt::Result {
16+
// FIXME(chrisvittal) remove Origin entirely
17+
// Print no origin info
18+
Ok(())
3519
}
3620
}
3721

src/test/run-pass/binding/match-pipe-binding.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
// compile-flags: -Z borrowck=compare
32

43
fn test1() {
54
// from issue 6338

src/test/run-pass/issues/issue-16671.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
//compile-flags: -Z borrowck=compare
32

43
#![deny(warnings)]
54

src/test/run-pass/issues/issue-49955.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// run-pass
2-
// compile-flags: -Z borrowck=compare
32

43
const ALL_THE_NUMS: [u32; 1] = [
54
1

src/test/run-pass/issues/issue-8860.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![allow(dead_code)]
3-
// compile-flags: -Z borrowck=compare
43

54
static mut DROP: isize = 0;
65
static mut DROP_S: isize = 0;

src/test/run-pass/numbers-arithmetic/i128.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// ignore-emscripten i128 doesn't work
55

6-
// compile-flags: -Z borrowck=compare
76

87
#![feature(test)]
98

src/test/run-pass/numbers-arithmetic/u128.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// run-pass
22
// ignore-emscripten u128 not supported
33

4-
// compile-flags: -Z borrowck=compare
54

65
#![feature(test)]
76

src/test/run-pass/weird-exprs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(dead_code)]
33
#![allow(unreachable_code)]
44
#![allow(unused_parens)]
5-
// compile-flags: -Z borrowck=compare
65

76
#![recursion_limit = "256"]
87

0 commit comments

Comments
 (0)