Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
need_type_info_err
more conservative
- Loading branch information
Showing
6 changed files
with
178 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
fn no_err() { | ||
|x: String| x; | ||
let _ = String::from("x"); | ||
} | ||
|
||
fn err() { | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
} | ||
|
||
fn arg_pat_closure_err() { | ||
|x| String::from("x".as_ref()); //~ ERROR type annotations needed | ||
} | ||
|
||
fn local_pat_closure_err() { | ||
let _ = "x".as_ref(); //~ ERROR type annotations needed | ||
} | ||
|
||
fn err_first_arg_pat() { | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
|x: String| x; | ||
} | ||
|
||
fn err_second_arg_pat() { | ||
|x: String| x; | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
} | ||
|
||
fn err_mid_arg_pat() { | ||
|x: String| x; | ||
|x: String| x; | ||
|x: String| x; | ||
|x: String| x; | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
|x: String| x; | ||
|x: String| x; | ||
|x: String| x; | ||
|x: String| x; | ||
} | ||
|
||
fn err_first_local_pat() { | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
let _ = String::from("x"); | ||
} | ||
|
||
fn err_second_local_pat() { | ||
let _ = String::from("x"); | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
} | ||
|
||
fn err_mid_local_pat() { | ||
let _ = String::from("x"); | ||
let _ = String::from("x"); | ||
let _ = String::from("x"); | ||
let _ = String::from("x"); | ||
String::from("x".as_ref()); //~ ERROR type annotations needed | ||
let _ = String::from("x"); | ||
let _ = String::from("x"); | ||
let _ = String::from("x"); | ||
let _ = String::from("x"); | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
error[E0283]: type annotations needed | ||
--> $DIR/issue-72690.rs:7:5 | ||
| | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/issue-72690.rs:11:6 | ||
| | ||
LL | |x| String::from("x".as_ref()); | ||
| ^ consider giving this closure parameter a type | ||
|
||
error[E0283]: type annotations needed | ||
--> $DIR/issue-72690.rs:15:17 | ||
| | ||
LL | let _ = "x".as_ref(); | ||
| ^^^^^^ cannot infer type for type `str` | ||
| | ||
= note: cannot satisfy `str: std::convert::AsRef<_>` | ||
|
||
error[E0283]: type annotations needed | ||
--> $DIR/issue-72690.rs:19:5 | ||
| | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error[E0283]: type annotations needed | ||
--> $DIR/issue-72690.rs:25:5 | ||
| | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error[E0283]: type annotations needed | ||
--> $DIR/issue-72690.rs:33:5 | ||
| | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error[E0283]: type annotations needed for `std::string::String` | ||
--> $DIR/issue-72690.rs:41:5 | ||
| | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
LL | let _ = String::from("x"); | ||
| - consider giving this pattern a type | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error[E0283]: type annotations needed for `std::string::String` | ||
--> $DIR/issue-72690.rs:47:5 | ||
| | ||
LL | let _ = String::from("x"); | ||
| - consider giving this pattern a type | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error[E0283]: type annotations needed for `std::string::String` | ||
--> $DIR/issue-72690.rs:55:5 | ||
| | ||
LL | let _ = String::from("x"); | ||
| - consider giving this pattern a type | ||
... | ||
LL | String::from("x".as_ref()); | ||
| ^^^^^^^^^^^^ cannot infer type for struct `std::string::String` | ||
| | ||
= note: cannot satisfy `std::string::String: std::convert::From<&_>` | ||
= note: required by `std::convert::From::from` | ||
|
||
error: aborting due to 9 previous errors | ||
|
||
Some errors have detailed explanations: E0282, E0283. | ||
For more information about an error, try `rustc --explain E0282`. |