Skip to content

Commit

Permalink
Add a UI test for types named the same as primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Mar 4, 2024
1 parent 6b1a91f commit 603aeb6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/ui/resolve/conflicting-primitive-names.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//@ check-pass
#![allow(non_camel_case_types)]
#![allow(unused)]

// Ensure that primitives do not interfere with user types of similar names

macro_rules! make_ty_mod {
($modname:ident, $ty:tt) => {
mod $modname {
struct $ty {
a: i32,
}

fn assignment() {
let $ty = ();
}

fn access(a: $ty) -> i32 {
a.a
}
}
};
}

make_ty_mod!(check_f16, f16);
make_ty_mod!(check_f32, f32);
make_ty_mod!(check_f64, f64);
make_ty_mod!(check_f128, f128);

fn main() {}

0 comments on commit 603aeb6

Please sign in to comment.