diff options
Diffstat (limited to 'src/test/ui/macros/assert-trailing-junk.rs')
-rw-r--r-- | src/test/ui/macros/assert-trailing-junk.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/macros/assert-trailing-junk.rs b/src/test/ui/macros/assert-trailing-junk.rs new file mode 100644 index 000000000..da725e19e --- /dev/null +++ b/src/test/ui/macros/assert-trailing-junk.rs @@ -0,0 +1,27 @@ +// revisions: with-generic-asset without-generic-asset +// [with-generic-asset] compile-flags: --cfg feature="generic_assert" + +// Ensure assert macro does not ignore trailing garbage. +// +// See https://github.com/rust-lang/rust/issues/60024 for details. + +fn main() { + assert!(true some extra junk, "whatever"); + //~^ ERROR expected one of + + assert!(true some extra junk); + //~^ ERROR expected one of + + assert!(true, "whatever" blah); + //~^ ERROR no rules expected + + assert!(true "whatever" blah); + //~^ ERROR unexpected string literal + //~^^ ERROR no rules expected + + assert!(true;); + //~^ ERROR macro requires an expression + + assert!(false || true "error message"); + //~^ ERROR unexpected string literal +} |