Skip to content

Rollup of 5 pull requests #63412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ad832a1
add basic lint testing for misuse of mem::zeroed and mem::uninitialized
RalfJung Aug 6, 2019
16c0902
warn for more cases
RalfJung Aug 7, 2019
a902f7a
fix a comment
RalfJung Aug 7, 2019
d03b64a
add tuple_fields convenience method and use it in a few places
RalfJung Aug 7, 2019
1873844
note a FIXME
RalfJung Aug 7, 2019
b258ed5
proper doc comment for 'recovered' field of variant
RalfJung Aug 7, 2019
157b76a
allow the lint if a few UB-demonstrating doc tests
RalfJung Aug 7, 2019
6c7d84d
note down some more future plans
RalfJung Aug 7, 2019
3a6a29b
Use associated_type_bounds where applicable - closes #61738
iluuu1994 Jul 31, 2019
322a7d6
Add test for issue 36804
jackh726 Aug 8, 2019
3d231ac
Add missing #![feature(associated_type_bounds)]
iluuu1994 Aug 8, 2019
77bfd7f
Don't use associated type bounds in docs until it is stable
iluuu1994 Aug 9, 2019
e1bd8cb
rustc_target: add musl targets for MIPS64 arches
xen0n Jul 28, 2019
c076392
Tweak mismatched types error on break expressions
estebank Aug 6, 2019
799b13a
Do not suggest using ! with break
estebank Aug 7, 2019
4fbbf99
Be more accurate when mentioning type of found match arms
estebank Aug 7, 2019
01a6139
Change wording for function without return value
estebank Aug 7, 2019
94fe8a3
Suggest calling function on type error when finding bare fn
estebank Aug 7, 2019
195d837
When suggesting fn call use an appropriate number of placeholder argu…
estebank Aug 8, 2019
b7f7756
Recover parser from `foo(_, _)`
estebank Aug 8, 2019
0d53f69
review comments
estebank Aug 8, 2019
efa62d6
Tweak wording of fn without explicit return
estebank Aug 8, 2019
52da091
Differentiate between tuple structs and tuple variants
estebank Aug 8, 2019
5a54945
Extend suggestion support for traits and foreign items
estebank Aug 8, 2019
33d1082
review comment: review wording or missing return error
estebank Aug 8, 2019
bc1a4f5
review comments: typo and rewording
estebank Aug 8, 2019
45a5bc7
fix tests
estebank Aug 9, 2019
4637396
Rollup merge of #63165 - xen0n:mips64-musl-targets, r=alexcrichton
Centril Aug 9, 2019
3b99865
Rollup merge of #63337 - estebank:break-ee0308, r=Centril
Centril Aug 9, 2019
a133e53
Rollup merge of #63346 - RalfJung:zeroed-lint, r=eddyb
Centril Aug 9, 2019
4cd0e7d
Rollup merge of #63350 - iluuu1994:use-associated-type-bounds, r=Centril
Centril Aug 9, 2019
56d3742
Rollup merge of #63394 - jackh726:issue-36804, r=jonas-schievink
Centril Aug 9, 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
review comment: review wording or missing return error
  • Loading branch information
estebank committed Aug 9, 2019
commit 33d1082d6e3cb9fe5e0fd090f52a3effa9871fce
3 changes: 2 additions & 1 deletion src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3711,7 +3711,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Some(fn_span) = fn_span {
err.span_label(
fn_span,
"this function's body doesn't `return` a value",
"this function implicitly returns `()` as its body has no tail \
or `return` expression",
);
}
}, false);
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/block-result/consider-removing-last-semi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn f() -> String {
| - ^^^^^^ expected struct `std::string::String`, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | 0u8;
LL | "bla".to_string();
| - help: consider removing this semicolon
Expand All @@ -18,7 +18,7 @@ error[E0308]: mismatched types
LL | fn g() -> String {
| - ^^^^^^ expected struct `std::string::String`, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | "this won't work".to_string();
LL | "removeme".to_string();
| - help: consider removing this semicolon
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/block-result/issue-11714.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn blah() -> i32 {
| ---- ^^^ expected i32, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
...
LL | ;
| - help: consider removing this semicolon
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/block-result/issue-13428.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo() -> String {
| --- ^^^^^^ expected struct `std::string::String`, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
...
LL | ;
| - help: consider removing this semicolon
Expand All @@ -18,7 +18,7 @@ error[E0308]: mismatched types
LL | fn bar() -> String {
| --- ^^^^^^ expected struct `std::string::String`, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | "foobar".to_string()
LL | ;
| - help: consider removing this semicolon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn plus_one(x: i32) -> i32 {
| -------- ^^^ expected i32, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | x + 1;
| - help: consider removing this semicolon
|
Expand All @@ -17,7 +17,7 @@ error[E0308]: mismatched types
LL | fn foo() -> Result<u8, u64> {
| --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | Ok(1);
| - help: consider removing this semicolon
|
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-32323.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {}
| - ^^^^^^^^^^^^^^^^^^ expected associated type, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `<T as Tr<'a>>::Out`
found type `()`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-43162.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ error[E0308]: mismatched types
LL | fn foo() -> bool {
| --- ^^^^ expected bool, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL |
LL | break true;
| - help: consider removing this semicolon
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-44023.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
| ------------------------ ^^^^^ expected isize, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `isize`
found type `()`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-6458-4.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo(b: bool) -> Result<bool,String> {
| --- ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | Err("bar".to_string());
| - help: consider removing this semicolon
|
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/liveness/liveness-forgot-ret.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; }
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `isize`
found type `()`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/liveness/liveness-missing-ret2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn f() -> isize {
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `isize`
found type `()`
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } }
| --- ^^^ - help: consider removing this semicolon
| | |
| | expected i32, found ()
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
...
LL | test!();
| -------- in this macro invocation
Expand All @@ -19,7 +19,7 @@ error[E0308]: mismatched types
LL | fn no_return() -> i32 {}
| --------- ^^^ expected i32, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `i32`
found type `()`
Expand All @@ -30,7 +30,7 @@ error[E0308]: mismatched types
LL | fn bar(x: u32) -> u32 {
| --- ^^^ expected u32, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
LL | x * 2;
| - help: consider removing this semicolon
|
Expand All @@ -43,7 +43,7 @@ error[E0308]: mismatched types
LL | fn baz(x: u64) -> u32 {
| --- ^^^ expected u32, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `u32`
found type `()`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/missing/missing-return.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn f() -> isize { }
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `isize`
found type `()`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-62881.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ error[E0308]: mismatched types
LL | fn f() -> isize { fn f() -> isize {} pub f<
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `isize`
found type `()`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issue-62895.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ error[E0308]: mismatched types
LL | fn v() -> isize {
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't `return` a value
| this function implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type `isize`
found type `()`
Expand Down