inform type annotations

This commit is contained in:
csmoe 2018-02-14 11:06:08 +08:00
parent 4d2d3fc5da
commit 20dcc72127
13 changed files with 15 additions and 43 deletions

View file

@ -5086,9 +5086,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// If not, error.
if alternative.is_ty_var() || alternative.references_error() {
if !self.is_tainted_by_errors() {
type_error_struct!(self.tcx.sess, sp, ty, E0619,
"the type of this value must be known in this context")
.emit();
self.need_type_info((**self).body_id, sp, ty);
}
self.demand_suptype(sp, self.tcx.types.err, ty);
ty = self.tcx.types.err;

View file

@ -4368,12 +4368,13 @@ i_am_a_function();
"##,
E0619: r##"
#### Note: this error code is no longer emitted by the compiler.
The type-checker needed to know the type of an expression, but that type had not
yet been inferred.
Erroneous code example:
```compile_fail,E0619
```compile_fail
let mut x = vec![];
match x.pop() {
Some(v) => {

View file

@ -18,6 +18,6 @@ fn main() {
let x = 0;
let y = &x as *const _;
let _ = y.is_null();
//~^ error: the type of this value must be known in this context [tyvar_behind_raw_pointer]
//~^ error: type annotations needed [tyvar_behind_raw_pointer]
//~^^ warning: this was previously accepted
}

View file

@ -11,7 +11,7 @@
fn main() {
return
{ return () }
//~^ ERROR the type of this value must be known in this context
//~^ ERROR type annotations needed [E0282]
()
;
}

View file

@ -10,5 +10,5 @@
fn main() {
let x = panic!();
x.clone(); //~ ERROR the type of this value must be known in this context
x.clone(); //~ ERROR type annotations needed
}

View file

@ -43,6 +43,6 @@ fn main() {
fn another_fn_to_avoid_suppression() {
match Default::default()
{
[] => {} //~ ERROR the type of this value
[] => {} //~ ERROR type annotations needed
};
}

View file

@ -12,7 +12,7 @@ fn main() {
let x;
match x {
(..) => {} //~ ERROR the type of this value must be known in this context
(..) => {} //~ ERROR type annotations needed
_ => {}
}

View file

@ -24,7 +24,7 @@ fn a() {
match closure0.take() {
Some(c) => {
return c();
//~^ ERROR the type of this value must be known in this context
//~^ ERROR type annotations needed
}
None => { }
}

View file

@ -1,19 +0,0 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let x;
match x {
(..) => {} //~ ERROR E0619
_ => {}
}
}

View file

@ -1,8 +0,0 @@
error[E0619]: the type of this value must be known in this context
--> $DIR/E0619.rs:15:9
|
15 | (..) => {} //~ ERROR E0619
| ^^^^
error: aborting due to previous error

View file

@ -1,4 +1,4 @@
warning: the type of this value must be known in this context
warning: type annotations needed
--> $DIR/inference-variable-behind-raw-pointer.rs:18:13
|
18 | if data.is_null() {}

View file

@ -15,11 +15,11 @@
fn shines_a_beacon_through_the_darkness() {
let x: Option<_> = None;
x.unwrap().method_that_could_exist_on_some_type();
//~^ ERROR 17:5: 17:15: the type of this value must be known in this context
//~^ ERROR 17:5: 17:15: type annotations needed
}
fn courier_to_des_moines_and_points_west(data: &[u32]) -> String {
data.iter() //~ ERROR 22:5: 23:20: the type of this value must be known in this context
data.iter() //~ ERROR 22:5: 23:20: type annotations needed
.sum::<_>()
.to_string()
}

View file

@ -1,13 +1,13 @@
error[E0619]: the type of this value must be known in this context
error[E0282]: type annotations needed
--> $DIR/issue-42234-unknown-receiver-type.rs:17:5
|
17 | x.unwrap().method_that_could_exist_on_some_type();
| ^^^^^^^^^^
error[E0619]: the type of this value must be known in this context
error[E0282]: type annotations needed
--> $DIR/issue-42234-unknown-receiver-type.rs:22:5
|
22 | / data.iter() //~ ERROR 22:5: 23:20: the type of this value must be known in this context
22 | / data.iter() //~ ERROR 22:5: 23:20: type annotations needed
23 | | .sum::<_>()
| |___________________^