Skip to content

Commit d6a5946

Browse files
committed
re-add tests from fixed regressions
This should make sure that they stay fixed.
1 parent 13f0d45 commit d6a5946

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

src/test/codegen/packed.rs

+11
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,14 @@ pub fn pkd_pair(pair1: &mut PackedPair, pair2: &mut PackedPair) {
6060
// CHECK: store i32 [[V2]], i32* {{.*}}, align 1
6161
*pair2 = *pair1;
6262
}
63+
64+
#[repr(packed)]
65+
#[derive(Copy, Clone)]
66+
pub struct PackedNestedPair((u32, u32));
67+
68+
// CHECK-LABEL: @pkd_nested_pair
69+
#[no_mangle]
70+
pub fn pkd_nested_pair(pair1: &mut PackedNestedPair, pair2: &mut PackedNestedPair) {
71+
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 8, i32 1, i1 false)
72+
*pair2 = *pair1;
73+
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-include ../tools.mk
2+
3+
all:
4+
$(RUSTC) main.rs -C opt-level=1
5+
$(call RUN,main)

src/test/run-make/issue-46239/main.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn project<T>(x: &(T,)) -> &T { &x.0 }
12+
13+
fn dummy() {}
14+
15+
fn main() {
16+
let f = (dummy as fn(),);
17+
(*project(&f))();
18+
}

src/test/run-pass/issue-46519.rs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:--test -O
12+
13+
#[test]
14+
#[should_panic(expected = "creating inhabited type")]
15+
fn test() {
16+
FontLanguageOverride::system_font(SystemFont::new());
17+
}
18+
19+
pub enum FontLanguageOverride {
20+
Normal,
21+
Override(&'static str),
22+
System(SystemFont)
23+
}
24+
25+
pub enum SystemFont {}
26+
27+
impl FontLanguageOverride {
28+
fn system_font(f: SystemFont) -> Self {
29+
FontLanguageOverride::System(f)
30+
}
31+
}
32+
33+
impl SystemFont {
34+
fn new() -> Self {
35+
panic!("creating inhabited type")
36+
}
37+
}

0 commit comments

Comments
 (0)