mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 13:33:43 +00:00
Update some macro tests
This commit is contained in:
parent
c750442e04
commit
9318b4d2cf
@ -97,7 +97,7 @@ fn execute() -> i32 {
|
||||
}
|
||||
|
||||
macro_rules! print_usage {
|
||||
($print:ident, $opts:ident, $reason:expr) => ({
|
||||
($print: ident, $opts: ident, $reason: expr) => ({
|
||||
let msg = format!("{}\nusage: cargo fmt [options]", $reason);
|
||||
$print!(
|
||||
"{}\nThis utility formats all bin and lib files of the current crate using rustfmt. \
|
||||
|
@ -1,5 +1,6 @@
|
||||
macro_rules! test {
|
||||
($($t:tt)*) => {}
|
||||
($($t: tt)*) => {
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -141,7 +141,8 @@ fn issue_1555() {
|
||||
|
||||
fn issue1178() {
|
||||
macro_rules! foo {
|
||||
(#[$attr:meta] $name:ident) => {}
|
||||
(#[$attr: meta] $name: ident) => {
|
||||
};
|
||||
}
|
||||
|
||||
foo!(
|
||||
@ -246,11 +247,15 @@ fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
|
||||
|
||||
// #878
|
||||
macro_rules! try_opt {
|
||||
($expr:expr) => (match $expr {
|
||||
Some(val) => val,
|
||||
($expr: expr) => {
|
||||
match $expr {
|
||||
Some(val) => val,
|
||||
|
||||
None => { return None; }
|
||||
})
|
||||
None => {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// #2214
|
||||
@ -885,24 +890,29 @@ fn macro_in_pattern_position() {
|
||||
};
|
||||
}
|
||||
|
||||
macro foo() {
|
||||
|
||||
}
|
||||
|
||||
pub macro bar($x: ident + $y: expr;) {
|
||||
fn foo($x: Foo) {
|
||||
long_function(
|
||||
a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
|
||||
$x.bar($y),
|
||||
);
|
||||
macro foo {
|
||||
() => {
|
||||
}
|
||||
}
|
||||
|
||||
macro foo() {
|
||||
// a comment
|
||||
fn foo() {
|
||||
// another comment
|
||||
bar();
|
||||
pub macro bar {
|
||||
($x: ident + $y: expr;) => {
|
||||
fn foo($x: Foo) {
|
||||
long_function(
|
||||
a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
|
||||
$x.bar($y),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro foo {
|
||||
() => {
|
||||
// a comment
|
||||
fn foo() {
|
||||
// another comment
|
||||
bar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user