]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/mozjs-error.rs
suggest fix for attempted integer identifier in patterns
[rust.git] / tests / ui / consts / mozjs-error.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(non_upper_case_globals)]
4
5 struct CustomAutoRooterVFTable {
6     trace: unsafe extern "C" fn(this: *mut i32, trc: *mut u32),
7 }
8
9 unsafe trait CustomAutoTraceable: Sized {
10     const vftable: CustomAutoRooterVFTable = CustomAutoRooterVFTable {
11         trace: Self::trace,
12     };
13
14     unsafe extern "C" fn trace(this: *mut i32, trc: *mut u32) {
15         let this = this as *const Self;
16         let this = this.as_ref().unwrap();
17         Self::do_trace(this, trc);
18     }
19
20     fn do_trace(&self, trc: *mut u32);
21 }
22
23 unsafe impl CustomAutoTraceable for () {
24     fn do_trace(&self, _: *mut u32) {
25         // nop
26     }
27 }
28
29 fn main() {
30     let _ = <()>::vftable;
31 }