repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix factor_out_conditional_operation heuristics for constants
[official-gcc.git]
/
gcc
/
testsuite
/
rust
/
execute
/
torture
/
slice1.rs
blob
2683179c75866ab59e646a7c8b1aa2071eb86737
1
// { dg-additional-options "-w" }
2
#[lang = "sized"]
3
pub trait Sized {}
4
5
struct FatPtr<T> {
6
data: *const T,
7
len: usize,
8
}
9
10
union Repr<T> {
11
rust: *const [T],
12
rust_mut: *mut [T],
13
raw: FatPtr<T>,
14
}
15
16
const fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] {
17
unsafe {
18
Repr {
19
raw: FatPtr { data, len },
20
}
21
.rust
22
}
23
}
24
25
fn main() -> i32 {
26
let a = 123;
27
let b: *const i32 = &a;
28
let c = slice_from_raw_parts(b, 1);
29
30
0
31
}