diff options
| author | bors <bors@rust-lang.org> | 2018-01-04 09:54:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-01-04 09:54:15 +0000 |
| commit | 4cd918c4caf90ef87d687c02f23b06c581054de3 (patch) | |
| tree | 7f1bc6eef6567e9c320274efada9f9c42f993efb /src/test | |
| parent | 78f24d86b84882a02c15f27768e831d0342a3f5d (diff) | |
| parent | 6536d363d5365b0cb2584227b9a919dc287e1424 (diff) | |
Auto merge of #47147 - projektir:to_ptr_cast, r=eddyb
Force appropriate extension when converting from int to ptr #43291 Fixes #43291. Looking for feedback if I've missed something and/or need to add more tests. @eddyb @retep998 @nagisa @oli-obk
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/issue-43291.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-43291.rs b/src/test/run-pass/issue-43291.rs new file mode 100644 index 00000000000..98de8f78859 --- /dev/null +++ b/src/test/run-pass/issue-43291.rs @@ -0,0 +1,18 @@ +// Copyright 2018 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. + +pub fn main() { + assert_eq!(!0usize as *const (), foo(0, 1)); + assert_eq!(!0usize as *const (), (0i8 - 1) as *const ()); +} + +pub fn foo(a: i8, b: i8) -> *const () { + (a - b) as *const () +} |
