Skip to content

Commit ed844c1

Browse files
committed
Some cleanup.
1 parent 456b7be commit ed844c1

File tree

6 files changed

+38
-46
lines changed

6 files changed

+38
-46
lines changed

src/semcheck/traverse.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ fn match_inherent_impl<'a, 'tcx>(changes: &mut ChangeSet<'tcx>,
910910
return false;
911911
}
912912

913+
// at this point we have an impl match, so the return value is always `true`.
914+
913915
if !register_errors {
914916
// checking backwards, impls match.
915917
return true;

src/semcheck/typeck.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
255255
pred: err,
256256
};
257257

258-
changes.add_change(err_type,
259-
orig_def_id,
260-
Some(tcx.def_span(orig_def_id)));
258+
changes.add_change(err_type, orig_def_id, None);
261259
}
262260
}
263261

@@ -275,9 +273,7 @@ impl<'a, 'gcx, 'tcx> TypeComparisonContext<'a, 'gcx, 'tcx> {
275273
pred: err,
276274
};
277275

278-
changes.add_change(err_type,
279-
orig_def_id,
280-
Some(tcx.def_span(orig_def_id)));
276+
changes.add_change(err_type, orig_def_id, None);
281277
}
282278
}
283279
}

tests/cases/bounds/stdout

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ warning: breaking changes in `Abc`
77
3 | | }
88
| |_^
99
|
10-
warning: added bound: `A: std::clone::Clone` (breaking)
11-
--> $REPO_PATH/tests/cases/bounds/old.rs:1:1
12-
|
13-
1 | / pub struct Abc<A> {
14-
2 | | pub a: A,
15-
3 | | }
16-
| |_^
10+
= warning: added bound: `A: std::clone::Clone` (breaking)
1711

1812
warning: technically breaking changes in `Def`
1913
--> $REPO_PATH/tests/cases/bounds/new.rs:5:1
@@ -23,35 +17,21 @@ warning: technically breaking changes in `Def`
2317
7 | | }
2418
| |_^
2519
|
26-
note: removed bound: `A: std::clone::Clone` (technically breaking)
27-
--> $REPO_PATH/tests/cases/bounds/old.rs:5:1
28-
|
29-
5 | / pub struct Def<A: Clone> {
30-
6 | | pub d: A,
31-
7 | | }
32-
| |_^
20+
= note: removed bound: `A: std::clone::Clone` (technically breaking)
3321

3422
warning: breaking changes in `abc`
3523
--> $REPO_PATH/tests/cases/bounds/new.rs:9:1
3624
|
3725
9 | pub fn abc<A: Clone>(_: A) {}
3826
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3927
|
40-
warning: added bound: `A: std::clone::Clone` (breaking)
41-
--> $REPO_PATH/tests/cases/bounds/old.rs:9:1
42-
|
43-
9 | pub fn abc<A>(_: A) {}
44-
| ^^^^^^^^^^^^^^^^^^^^^^
28+
= warning: added bound: `A: std::clone::Clone` (breaking)
4529

4630
warning: technically breaking changes in `def`
4731
--> $REPO_PATH/tests/cases/bounds/new.rs:11:1
4832
|
4933
11 | pub fn def<A>(_: A) {}
5034
| ^^^^^^^^^^^^^^^^^^^^^^
5135
|
52-
note: removed bound: `A: std::clone::Clone` (technically breaking)
53-
--> $REPO_PATH/tests/cases/bounds/old.rs:11:1
54-
|
55-
11 | pub fn def<A: Clone>(_: A) {}
56-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
= note: removed bound: `A: std::clone::Clone` (technically breaking)
5737

tests/cases/inherent_impls/new.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ impl Abc {
1010
}
1111

1212
fn def(&self) { }
13+
14+
// TODO
15+
/* pub fn ghi<A>(&self, _: A) -> u8 {
16+
0
17+
} */
1318
}
1419

1520
#[allow(dead_code)]
1621
pub struct Def<A> {
1722
field: A,
1823
}
1924

25+
#[allow(dead_code)]
2026
impl Def<u8> {
2127
pub fn def(&self) -> u16 {
2228
0
@@ -27,6 +33,7 @@ impl Def<u8> {
2733
fn abc2() { }
2834
}
2935

36+
#[allow(dead_code)]
3037
impl Def<u16> {
3138
pub fn def(&self) -> u8 {
3239
0

tests/cases/inherent_impls/old.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,26 @@ impl Abc {
1010
}
1111

1212
fn def(&self) { }
13+
14+
// TODO
15+
/* pub fn ghi<A>(&self, a: A) -> A {
16+
a
17+
} */
1318
}
1419

1520
#[allow(dead_code)]
1621
pub struct Def<A> {
1722
field: A,
1823
}
1924

25+
#[allow(dead_code)]
2026
impl Def<bool> {
2127
pub fn def(&self) -> u8 {
2228
0
2329
}
2430
}
2531

32+
#[allow(dead_code)]
2633
impl Def<u8> {
2734
pub fn def(&self) -> u8 {
2835
0

tests/cases/inherent_impls/stdout

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
version bump: 1.0.0 -> (breaking) -> 2.0.0
22
warning: breaking changes in `def`
3-
--> $REPO_PATH/tests/cases/inherent_impls/old.rs:21:5
3+
--> $REPO_PATH/tests/cases/inherent_impls/old.rs:27:5
44
|
5-
21 | / pub fn def(&self) -> u8 {
6-
22 | | 0
7-
23 | | }
5+
27 | / pub fn def(&self) -> u8 {
6+
28 | | 0
7+
29 | | }
88
| |_____^
99
|
1010
= warning: removed item in inherent impl (breaking)
1111

1212
warning: breaking changes in `def`
13-
--> $REPO_PATH/tests/cases/inherent_impls/old.rs:27:5
13+
--> $REPO_PATH/tests/cases/inherent_impls/old.rs:34:5
1414
|
15-
27 | / pub fn def(&self) -> u8 {
16-
28 | | 0
17-
29 | | }
15+
34 | / pub fn def(&self) -> u8 {
16+
35 | | 0
17+
36 | | }
1818
| |_____^
1919
|
2020
= warning: type error: expected u8, found u16 (breaking)
2121

2222
warning: breaking changes in `ghi`
23-
--> $REPO_PATH/tests/cases/inherent_impls/old.rs:31:5
23+
--> $REPO_PATH/tests/cases/inherent_impls/old.rs:38:5
2424
|
25-
31 | pub fn ghi() { }
25+
38 | pub fn ghi() { }
2626
| ^^^^^^^^^^^^^^^^
2727
|
2828
= warning: removed item in inherent impl (breaking)
2929

3030
warning: technically breaking changes in `abc`
31-
--> $REPO_PATH/tests/cases/inherent_impls/new.rs:25:5
31+
--> $REPO_PATH/tests/cases/inherent_impls/new.rs:31:5
3232
|
33-
25 | pub fn abc() { }
33+
31 | pub fn abc() { }
3434
| ^^^^^^^^^^^^^^^^
3535
|
3636
= note: added item in inherent impl (technically breaking)
3737

3838
warning: technically breaking changes in `def`
39-
--> $REPO_PATH/tests/cases/inherent_impls/new.rs:31:5
39+
--> $REPO_PATH/tests/cases/inherent_impls/new.rs:38:5
4040
|
41-
31 | / pub fn def(&self) -> u8 {
42-
32 | | 0
43-
33 | | }
41+
38 | / pub fn def(&self) -> u8 {
42+
39 | | 0
43+
40 | | }
4444
| |_____^
4545
|
4646
= note: added item in inherent impl (technically breaking)

0 commit comments

Comments
 (0)