]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/macro-backtrace-println.rs
1 // Copyright 2015 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 // The `format_args!` syntax extension issues errors before code expansion
12 // has completed, but we still need a backtrace.
14 // This test includes stripped-down versions of `print!` and `println!`,
15 // because we can't otherwise verify the lines of the backtrace.
17 fn print(_args
: std
::fmt
::Arguments
) {}
19 macro_rules
! myprint
{
20 ($
($arg
:tt
)*) => (print(format_args
!($
($arg
)*))); //~ NOTE in this expansion of
23 macro_rules
! myprintln
{
24 ($fmt
:expr
) => (myprint
!(concat
!($fmt
, "\n"))); //~ ERROR invalid reference to argument `0`
25 //~^ NOTE in this expansion of myprint!
26 //~^^ NOTE in this expansion of concat!
30 myprintln
!("{}"); //~ NOTE in this expansion of