rust/tests/pretty/postfix-match/precedence.pp
Vadim Petrochenkov c56f49dc34 expand: Micro-optimize prelude injection
Use `splice` to avoid shifting the other items twice.
Put `extern crate std;` first so it's already resolved when we resolve `::std::prelude::rust_20XX`.
2025-07-28 17:35:09 +03:00

35 lines
684 B
Rust

#![feature(prelude_import)]
#![no_std]
#![feature(postfix_match)]
#[macro_use]
extern crate std;
#[prelude_import]
use ::std::prelude::rust_2015::*;
use std::ops::Add;
//@ pretty-mode:expanded
//@ pp-exact:precedence.pp
macro_rules! repro { ($e:expr) => { $e.match { _ => {} } }; }
struct Struct {}
impl Add<Struct> for usize {
type Output = ();
fn add(self, _: Struct) -> () { () }
}
pub fn main() {
let a;
(
{ 1 } + 1).match {
_ => {}
};
(4 as usize).match { _ => {} };
return.match { _ => {} };
(a = 42).match { _ => {} };
(|| {}).match { _ => {} };
(42..101).match { _ => {} };
(1 + Struct {}).match { _ => {} };
}