diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-12-21 19:43:33 +0200 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-12-22 00:23:30 +0200 |
| commit | d6a5946c63daa75aeb0c5c6b205662f74527bb84 (patch) | |
| tree | a03a8c6118302cb1dd74588fb4a3a5d6446909aa | |
| parent | 13f0d454e051510ffad9be14acb89d902570f9ac (diff) | |
| download | rust-d6a5946c63daa75aeb0c5c6b205662f74527bb84.tar.gz rust-d6a5946c63daa75aeb0c5c6b205662f74527bb84.zip | |
re-add tests from fixed regressions
This should make sure that they stay fixed.
| -rw-r--r-- | src/test/codegen/packed.rs | 11 | ||||
| -rw-r--r-- | src/test/run-make/issue-46239/Makefile | 5 | ||||
| -rw-r--r-- | src/test/run-make/issue-46239/main.rs | 18 | ||||
| -rw-r--r-- | src/test/run-pass/issue-46519.rs | 37 |
4 files changed, 71 insertions, 0 deletions
diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index 99e6e38a3bf..189b4230ecb 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -60,3 +60,14 @@ pub fn pkd_pair(pair1: &mut PackedPair, pair2: &mut PackedPair) { // CHECK: store i32 [[V2]], i32* {{.*}}, align 1 *pair2 = *pair1; } + +#[repr(packed)] +#[derive(Copy, Clone)] +pub struct PackedNestedPair((u32, u32)); + +// CHECK-LABEL: @pkd_nested_pair +#[no_mangle] +pub fn pkd_nested_pair(pair1: &mut PackedNestedPair, pair2: &mut PackedNestedPair) { +// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 8, i32 1, i1 false) + *pair2 = *pair1; +} diff --git a/src/test/run-make/issue-46239/Makefile b/src/test/run-make/issue-46239/Makefile new file mode 100644 index 00000000000..698a605f7e9 --- /dev/null +++ b/src/test/run-make/issue-46239/Makefile @@ -0,0 +1,5 @@ +-include ../tools.mk + +all: + $(RUSTC) main.rs -C opt-level=1 + $(call RUN,main) diff --git a/src/test/run-make/issue-46239/main.rs b/src/test/run-make/issue-46239/main.rs new file mode 100644 index 00000000000..3b3289168ab --- /dev/null +++ b/src/test/run-make/issue-46239/main.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn project<T>(x: &(T,)) -> &T { &x.0 } + +fn dummy() {} + +fn main() { + let f = (dummy as fn(),); + (*project(&f))(); +} diff --git a/src/test/run-pass/issue-46519.rs b/src/test/run-pass/issue-46519.rs new file mode 100644 index 00000000000..878cae4e387 --- /dev/null +++ b/src/test/run-pass/issue-46519.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:--test -O + +#[test] +#[should_panic(expected = "creating inhabited type")] +fn test() { + FontLanguageOverride::system_font(SystemFont::new()); +} + +pub enum FontLanguageOverride { + Normal, + Override(&'static str), + System(SystemFont) +} + +pub enum SystemFont {} + +impl FontLanguageOverride { + fn system_font(f: SystemFont) -> Self { + FontLanguageOverride::System(f) + } +} + +impl SystemFont { + fn new() -> Self { + panic!("creating inhabited type") + } +} |
