1
Fork 0
rust/tests/ui/parser/extern-abi-from-mac-literal-frag.rs
Nicholas Nethercote 49ed25b5d2 Remove NtExpr and NtLiteral.
Notes about tests:
- tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs: some messages are
  now duplicated due to repeated parsing.

- tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs: ditto.

- `tests/ui/proc-macro/macro-rules-derive-cfg.rs`: the diff looks large
  but the only difference is the insertion of a single
  invisible-delimited group around a metavar.

- `tests/ui/attributes/nonterminal-expansion.rs`: a slight span
  degradation, somehow related to the recent massive attr parsing
  rewrite (#135726). I couldn't work out exactly what is going wrong,
  but I don't think it's worth holding things up for a single slightly
  suboptimal error message.
2025-04-02 06:20:35 +11:00

51 lines
871 B
Rust

#![allow(clashing_extern_declarations)]
//@ check-pass
// In this test we check that the parser accepts an ABI string when it
// comes from a macro `literal` or `expr` fragment as opposed to a hardcoded string.
fn main() {}
macro_rules! abi_from_lit_frag {
($abi:literal) => {
extern $abi {
fn _import();
}
unsafe extern $abi {}
extern $abi fn _export() {}
type _PTR = extern $abi fn();
}
}
macro_rules! abi_from_expr_frag {
($abi:expr) => {
extern $abi {
fn _import();
}
unsafe extern $abi {}
extern $abi fn _export() {}
type _PTR = extern $abi fn();
};
}
mod rust {
abi_from_lit_frag!("Rust");
}
mod c {
abi_from_lit_frag!("C");
}
mod rust_expr {
abi_from_expr_frag!("Rust");
}
mod c_expr {
abi_from_expr_frag!("C");
}