()
| 1007 | return unbox(boxed) |
| 1008 | } |
| 1009 | "#, |
| 1010 | 42, |
| 1011 | ); |
| 1012 | } |
| 1013 | |
| 1014 | #[test] |
| 1015 | fn generic_function_rejects_conflicting_inference() { |
| 1016 | assert_compile_fails( |
| 1017 | r#" |
| 1018 | first: <T>(left: T, right: T) -> T { |
| 1019 | return left |
| 1020 | } |
| 1021 | |
| 1022 | main: () -> i32 { |
| 1023 | return first(42, true) |
| 1024 | } |
| 1025 | "#, |
| 1026 | ); |
| 1027 | } |
| 1028 | |
| 1029 | #[test] |
| 1030 | fn generic_record_specializations_have_distinct_layouts() { |
| 1031 | assert_exit( |
| 1032 | r#" |
| 1033 | struct Box<T> { |
| 1034 | value: T |
| 1035 | } |
| 1036 | |
| 1037 | main: () -> i32 { |
| 1038 | small: Box<i32>* = new(Box<i32>) |
| 1039 | wide: Box<i64>* = new(Box<i64>) |
| 1040 | small.value = 17 |
nothing calls this directly
no test coverage detected