From 61865384b8fa6d79d2b36cbd7c899eaf15f4aeea Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 17 Aug 2016 07:20:04 -0700 Subject: Replace local backtrace with def-use, repair std macro spans --- src/test/ui/codemap_tests/bad-format-args.rs | 15 +++++++++++++ src/test/ui/codemap_tests/bad-format-args.stderr | 26 ++++++++++++++++++++++ src/test/ui/codemap_tests/issue-28308.rs | 13 +++++++++++ src/test/ui/codemap_tests/issue-28308.stderr | 10 +++++++++ .../ui/codemap_tests/repair_span_std_macros.rs | 13 +++++++++++ .../ui/codemap_tests/repair_span_std_macros.stderr | 11 +++++++++ 6 files changed, 88 insertions(+) create mode 100644 src/test/ui/codemap_tests/bad-format-args.rs create mode 100644 src/test/ui/codemap_tests/bad-format-args.stderr create mode 100644 src/test/ui/codemap_tests/issue-28308.rs create mode 100644 src/test/ui/codemap_tests/issue-28308.stderr create mode 100644 src/test/ui/codemap_tests/repair_span_std_macros.rs create mode 100644 src/test/ui/codemap_tests/repair_span_std_macros.stderr (limited to 'src/test/ui/codemap_tests') diff --git a/src/test/ui/codemap_tests/bad-format-args.rs b/src/test/ui/codemap_tests/bad-format-args.rs new file mode 100644 index 00000000000..de7bc88f9ba --- /dev/null +++ b/src/test/ui/codemap_tests/bad-format-args.rs @@ -0,0 +1,15 @@ +// 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. + +fn main() { + format!(); + format!("" 1); + format!("", 1 1); +} diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr new file mode 100644 index 00000000000..fab8e2c8ce1 --- /dev/null +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -0,0 +1,26 @@ +error: requires at least a format string argument + --> $DIR/bad-format-args.rs:12:5 + | +12 | format!(); + | ^^^^^^^^^^ + | + = note: this error originates in a macro from the standard library + +error: expected token: `,` + --> $DIR/bad-format-args.rs:13:5 + | +13 | format!("" 1); + | ^^^^^^^^^^^^^^ + | + = note: this error originates in a macro from the standard library + +error: expected token: `,` + --> $DIR/bad-format-args.rs:14:5 + | +14 | format!("", 1 1); + | ^^^^^^^^^^^^^^^^^ + | + = note: this error originates in a macro from the standard library + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/codemap_tests/issue-28308.rs b/src/test/ui/codemap_tests/issue-28308.rs new file mode 100644 index 00000000000..e3a4920d951 --- /dev/null +++ b/src/test/ui/codemap_tests/issue-28308.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. + +fn main() { + assert!("foo"); +} diff --git a/src/test/ui/codemap_tests/issue-28308.stderr b/src/test/ui/codemap_tests/issue-28308.stderr new file mode 100644 index 00000000000..0d51a3f36e9 --- /dev/null +++ b/src/test/ui/codemap_tests/issue-28308.stderr @@ -0,0 +1,10 @@ +error: cannot apply unary operator `!` to type `&'static str` + --> $DIR/issue-28308.rs:12:5 + | +12 | assert!("foo"); + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a macro from the standard library + +error: aborting due to previous error + diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.rs b/src/test/ui/codemap_tests/repair_span_std_macros.rs new file mode 100644 index 00000000000..3abc91d4f5f --- /dev/null +++ b/src/test/ui/codemap_tests/repair_span_std_macros.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. + +fn main() { + let x = vec![]; +} diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr new file mode 100644 index 00000000000..1c9cbd63c33 --- /dev/null +++ b/src/test/ui/codemap_tests/repair_span_std_macros.stderr @@ -0,0 +1,11 @@ +error[E0282]: unable to infer enough type information about `_` + --> $DIR/repair_span_std_macros.rs:12:13 + | +12 | let x = vec![]; + | ^^^^^^ cannot infer type for `_` + | + = note: type annotations or generic parameter binding required + = note: this error originates in a macro from the standard library + +error: aborting due to previous error + -- cgit 1.4.1-3-g733a5