diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index f3850da0ba557..c38ae5cdaec26 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -337,7 +337,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { lint::builtin::TYVAR_BEHIND_RAW_POINTER, scope_expr_id, span, - &format!("the type of this value must be known in this context")); + &format!("type annotations needed")); } } else { let t = self.structurally_resolved_type(span, final_ty); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index cc62833e92e8d..9342c1a26459a 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -5052,9 +5052,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty } else { 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); self.tcx.types.err diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index f59948e9fc42f..1c0e084832ebc 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -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) => { diff --git a/src/test/compile-fail/epoch-raw-pointer-method-2015.rs b/src/test/compile-fail/epoch-raw-pointer-method-2015.rs index a71db040b50e7..6aa83a38b7ee9 100644 --- a/src/test/compile-fail/epoch-raw-pointer-method-2015.rs +++ b/src/test/compile-fail/epoch-raw-pointer-method-2015.rs @@ -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 } diff --git a/src/test/compile-fail/issue-15965.rs b/src/test/compile-fail/issue-15965.rs index 08b896f387bbe..76ba5a0f4b371 100644 --- a/src/test/compile-fail/issue-15965.rs +++ b/src/test/compile-fail/issue-15965.rs @@ -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] () ; } diff --git a/src/test/compile-fail/issue-2151.rs b/src/test/compile-fail/issue-2151.rs index fbd8f9163b5df..3cf971f3f8dfb 100644 --- a/src/test/compile-fail/issue-2151.rs +++ b/src/test/compile-fail/issue-2151.rs @@ -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 } diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs index fed68da006889..998c11979953c 100644 --- a/src/test/compile-fail/match-vec-mismatch.rs +++ b/src/test/compile-fail/match-vec-mismatch.rs @@ -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 }; } diff --git a/src/test/compile-fail/pat-tuple-bad-type.rs b/src/test/compile-fail/pat-tuple-bad-type.rs index fd4ab5d253158..251e7b47dcc99 100644 --- a/src/test/compile-fail/pat-tuple-bad-type.rs +++ b/src/test/compile-fail/pat-tuple-bad-type.rs @@ -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 _ => {} } diff --git a/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs b/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs index 12b48b2a6c8aa..8f5bf827fcf1a 100644 --- a/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs +++ b/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs @@ -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 => { } } diff --git a/src/test/ui/error-codes/E0619.rs b/src/test/ui/error-codes/E0619.rs deleted file mode 100644 index a5a5ff7218dcf..0000000000000 --- a/src/test/ui/error-codes/E0619.rs +++ /dev/null @@ -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 or the MIT license -// , 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 - _ => {} - } -} - diff --git a/src/test/ui/error-codes/E0619.stderr b/src/test/ui/error-codes/E0619.stderr deleted file mode 100644 index cec336cfcec66..0000000000000 --- a/src/test/ui/error-codes/E0619.stderr +++ /dev/null @@ -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 - diff --git a/src/test/ui/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference-variable-behind-raw-pointer.stderr index d0ee55c092b28..bb1d921f1c61c 100644 --- a/src/test/ui/inference-variable-behind-raw-pointer.stderr +++ b/src/test/ui/inference-variable-behind-raw-pointer.stderr @@ -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() {} diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.rs b/src/test/ui/span/issue-42234-unknown-receiver-type.rs index d9cdd99c245e6..975c81955e0b3 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.rs +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.rs @@ -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() } diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr index ed756cdc553ce..d87cec642f18e 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr @@ -1,15 +1,17 @@ -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 | +16 | let x: Option<_> = None; + | - consider giving `x` a type 17 | x.unwrap().method_that_could_exist_on_some_type(); - | ^^^^^^^^^^ + | ^^^^^^^^^^ cannot infer type for `T` -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::<_>() - | |___________________^ + | |___________________^ cannot infer type for `_` error: aborting due to 2 previous errors