]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/macro-comma-behavior.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Companion test to the similarly-named file in run-pass.
13 // compile-flags: -C debug_assertions=yes
14 // revisions: std core
16 #![cfg_attr(core, no_std)]
18 #[cfg(std)] use std::fmt;
19 #[cfg(core)] use core::fmt;
21 // (see documentation of the similarly-named test in run-pass)
22 fn to_format_or_not_to_format() {
23 let falsum
= || false;
25 // assert!(true, "{}",); // see run-pass
27 assert_eq
!(1, 1, "{}",);
28 //[core]~^ ERROR no arguments
29 //[std]~^^ ERROR no arguments
30 assert_ne
!(1, 2, "{}",);
31 //[core]~^ ERROR no arguments
32 //[std]~^^ ERROR no arguments
34 // debug_assert!(true, "{}",); // see run-pass
36 debug_assert_eq
!(1, 1, "{}",);
37 //[core]~^ ERROR no arguments
38 //[std]~^^ ERROR no arguments
39 debug_assert_ne
!(1, 2, "{}",);
40 //[core]~^ ERROR no arguments
41 //[std]~^^ ERROR no arguments
45 //[std]~^ ERROR no arguments
49 // FIXME: compile-fail says "expected error not found" even though
50 // rustc does emit an error
52 // <DISABLED> [std]~^ ERROR no arguments
57 //[std]~^ ERROR no arguments
61 //[core]~^ ERROR no arguments
62 //[std]~^^ ERROR no arguments
64 // if falsum() { panic!("{}",); } // see run-pass
68 //[std]~^ ERROR no arguments
72 // FIXME: compile-fail says "expected error not found" even though
73 // rustc does emit an error
75 // <DISABLED> [std]~^ ERROR no arguments
78 unimplemented
!("{}",);
79 //[core]~^ ERROR no arguments
80 //[std]~^^ ERROR no arguments
82 // if falsum() { unreachable!("{}",); } // see run-pass
85 impl fmt
::Display
for S
{
86 fn fmt(&self, f
: &mut fmt
::Formatter
) -> fmt
::Result
{
88 //[core]~^ ERROR no arguments
89 //[std]~^^ ERROR no arguments
91 // FIXME: compile-fail says "expected error not found" even though
92 // rustc does emit an error
93 // writeln!(f, "{}",)?;
94 // <DISABLED> [core]~^ ERROR no arguments
95 // <DISABLED> [std]~^^ ERROR no arguments