Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a5d9310
remove 'as_str' when it's already a str type.
Sep 24, 2019
bb3c030
add test files
Sep 24, 2019
4cb86c9
comment fixes
Sep 25, 2019
5abc5e9
add FIXME and use 'span_label'
Oct 1, 2019
51482d0
fix unit tests
Oct 1, 2019
11c2d43
typo fix in the code
Oct 2, 2019
55ecb79
Note when a mutable trait object is needed
estebank Oct 4, 2019
f5e372a
Tweak wording
estebank Oct 4, 2019
4414068
Correctly estimate required space for string
AnthonyMikh Oct 5, 2019
35a3b58
Obligation must apply modulo regions
estebank Oct 5, 2019
169b040
review comments
estebank Oct 5, 2019
0b0aeac
Suggest dereferencing boolean reference when used in 'if' or 'while'
XiangQingW Oct 6, 2019
8a164ac
Suggest dereferencing boolean reference when used in 'if' or 'while'
XiangQingW Oct 6, 2019
bbb69d1
Suggest dereferencing boolean reference when used in 'if' or 'while'
XiangQingW Oct 6, 2019
c5e0d6e
Add long error explanation for E0566
GuillaumeGomez Oct 6, 2019
57cb881
Update ui tests
GuillaumeGomez Oct 6, 2019
8baf7bf
Update reference
tmandry Oct 6, 2019
6efcb02
review comments
estebank Oct 7, 2019
c100831
Rollup merge of #64739 - guanqun:remove-as-str, r=estebank
Centril Oct 7, 2019
fa961fa
Rollup merge of #65077 - estebank:mut-trait-expected, r=nikomatsakis
Centril Oct 7, 2019
a3d0c90
Rollup merge of #65120 - AnthonyMikh:fix_65119, r=estebank
Centril Oct 7, 2019
934f3c2
Rollup merge of #65150 - XiangQingW:master, r=estebank
Centril Oct 7, 2019
00315c3
Rollup merge of #65164 - GuillaumeGomez:long-err-explanation-E0566, r…
Centril Oct 7, 2019
ca3f01a
Rollup merge of #65173 - tmandry:reffy-ref, r=tmandry
Centril Oct 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Suggest dereferencing boolean reference when used in 'if' or 'while'
Change-Id: I0c5c4d767be2647e6f017ae7bf83558c56dbca97
  • Loading branch information
XiangQingW committed Oct 6, 2019
commit 8a164acf5879aec3389180f7102ea32dce5eb07a
44 changes: 34 additions & 10 deletions src/test/ui/if/if-no-match-bindings.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:18:8
|
LL | if b_ref() {}
| ^^^^^^^ expected bool, found &bool
| ^^^^^^^
| |
| expected bool, found &bool
| help: consider dereferencing the borrow: `*b_ref()`
|
= note: expected type `bool`
found type `&bool`
Expand All @@ -11,7 +14,10 @@ error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:19:8
|
LL | if b_mut_ref() {}
| ^^^^^^^^^^^ expected bool, found &mut bool
| ^^^^^^^^^^^
| |
| expected bool, found &mut bool
| help: consider dereferencing the borrow: `*b_mut_ref()`
|
= note: expected type `bool`
found type `&mut bool`
Expand All @@ -20,7 +26,10 @@ error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:20:8
|
LL | if &true {}
| ^^^^^ expected bool, found &bool
| ^^^^^
| |
| expected bool, found &bool
| help: consider dereferencing the borrow: `*&true`
|
= note: expected type `bool`
found type `&bool`
Expand All @@ -29,7 +38,10 @@ error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:21:8
|
LL | if &mut true {}
| ^^^^^^^^^ expected bool, found &mut bool
| ^^^^^^^^^
| |
| expected bool, found &mut bool
| help: consider dereferencing the borrow: `*&mut true`
|
= note: expected type `bool`
found type `&mut bool`
Expand All @@ -38,7 +50,10 @@ error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:24:11
|
LL | while b_ref() {}
| ^^^^^^^ expected bool, found &bool
| ^^^^^^^
| |
| expected bool, found &bool
| help: consider dereferencing the borrow: `*b_ref()`
|
= note: expected type `bool`
found type `&bool`
Expand All @@ -47,25 +62,34 @@ error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:25:11
|
LL | while b_mut_ref() {}
| ^^^^^^^^^^^ expected bool, found &mut bool
| ^^^^^^^^^^^
| |
| expected bool, found &mut bool
| help: consider dereferencing the borrow: `*b_mut_ref()`
|
= note: expected type `bool`
found type `&mut bool`

error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:26:11
|
LL | while &true {}
| ^^^^^ expected bool, found &bool
26 | while &true {}
| ^^^^^
| |
| expected bool, found &bool
| help: consider dereferencing the borrow: `*&true`
|
= note: expected type `bool`
found type `&bool`

error[E0308]: mismatched types
--> $DIR/if-no-match-bindings.rs:27:11
|
LL | while &mut true {}
| ^^^^^^^^^ expected bool, found &mut bool
27 | while &mut true {}
| ^^^^^^^^^
| |
| expected bool, found &mut bool
| help: consider dereferencing the borrow: `*&mut true`
|
= note: expected type `bool`
found type `&mut bool`
Expand Down
48 changes: 46 additions & 2 deletions src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,52 @@ warning: the feature `let_chains` is incomplete and may cause the compiler to cr
LL | #![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test.
| ^^^^^^^^^^

warning: unnecessary parentheses around `if` condition
--> $DIR/disallowed-positions.rs:51:8
|
LL | if (true || let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
|
= note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around `while` condition
--> $DIR/disallowed-positions.rs:115:11
|
LL | while (true || let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

wrning: unnecessary parentheses around `let` head expression
--> $DIR/disallowed-positions.rs:160:41
|
LL | if let Range { start: _, end: _ } = (true..true || false) { }
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around `let` head expression
--> $DIR/disallowed-positions.rs:162:41
|
LL | if let Range { start: _, end: _ } = (true..true && false) { }
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around `let` head expression
--> $DIR/disallowed-positions.rs:164:44
|
LL | while let Range { start: _, end: _ } = (true..true || false) { }
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around `let` head expression
--> $DIR/disallowed-positions.rs:166:44
|
LL | while let Range { start: _, end: _ } = (true..true && false) { }
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

error[E0308]: mismatched types
--> $DIR/disallowed-positions.rs:32:8
|
LL | if &let 0 = 0 {}
| ^^^^^^^^^^ expected bool, found &bool
| ^^^^^^^^^^
| |
| expected bool, found &bool
| help: consider dereferencing the borrow: `*&let 0 = 0`
|
= note: expected type `bool`
found type `&bool`
Expand Down Expand Up @@ -702,7 +743,10 @@ error[E0308]: mismatched types
--> $DIR/disallowed-positions.rs:96:11
|
LL | while &let 0 = 0 {}
| ^^^^^^^^^^ expected bool, found &bool
| ^^^^^^^^^^
| |
| expected bool, found &bool
| help: consider dereferencing the borrow: `*&let 0 = 0`
|
= note: expected type `bool`
found type `&bool`
Expand Down