From ed3c483aa8472bf791718d6f157e4e55873e7e5d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 8 Dec 2016 20:49:26 -0800 Subject: Change error to E0572 --- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/diagnostics.rs | 4 ++-- src/test/compile-fail/E0571.rs | 13 ------------- src/test/compile-fail/E0572.rs | 13 +++++++++++++ 4 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 src/test/compile-fail/E0571.rs create mode 100644 src/test/compile-fail/E0572.rs (limited to 'src') diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index abc1c5e4b4c..9c8d7caefe5 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3708,7 +3708,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::ExprAgain(_) => { tcx.types.never } hir::ExprRet(ref expr_opt) => { if self.ret_ty.is_none() { - struct_span_err!(self.tcx.sess, expr.span, E0571, + struct_span_err!(self.tcx.sess, expr.span, E0572, "return statement outside of function body").emit(); } else if let Some(ref e) = *expr_opt { self.check_expr_coercable_to_type(&e, self.ret_ty.unwrap()); diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 86220cf57c4..71507063ffc 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -4164,12 +4164,12 @@ target / ABI combination is currently unsupported by llvm. If necessary, you can circumvent this check using custom target specifications. "##, -E0571: r##" +E0572: r##" A return statement was found outside of a function body. Erroneous code example: -```compile_fail,E0571 +```compile_fail,E0572 const FOO: u32 = return 0; // error: return statement outside of function body fn main() {} diff --git a/src/test/compile-fail/E0571.rs b/src/test/compile-fail/E0571.rs deleted file mode 100644 index d300c597008..00000000000 --- a/src/test/compile-fail/E0571.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 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. - -const FOO: u32 = return 0; //~ ERROR E0571 - -fn main() {} diff --git a/src/test/compile-fail/E0572.rs b/src/test/compile-fail/E0572.rs new file mode 100644 index 00000000000..bbaab102de7 --- /dev/null +++ b/src/test/compile-fail/E0572.rs @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +const FOO: u32 = return 0; //~ ERROR E0572 + +fn main() {} -- cgit 1.4.1-3-g733a5