File tree Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ description = "A flake for rust development" ;
3+
4+ inputs = {
5+ nixpkgs . url = "github:nixos/nixpkgs?ref=nixos-unstable" ;
6+ flake-utils . url = "github:numtide/flake-utils" ;
7+ } ;
8+
9+ outputs = {
10+ self ,
11+ nixpkgs ,
12+ flake-utils ,
13+ } :
14+ flake-utils . lib . eachDefaultSystem (
15+ system : let
16+ pkgs = nixpkgs . legacyPackages . ${ system } ;
17+ libs = with pkgs . stdenv . cc ; {
18+ ccLib = cc . lib ;
19+ libc = libc ;
20+ libcDev = libc . dev ;
21+ libcStatic = libc . static ;
22+ libgcc = cc . libgcc ;
23+ } ;
24+ in
25+ with pkgs ; {
26+ devShells . default = mkShell {
27+ name = "rust-dev-gcc" ;
28+
29+ # Make clang aware of a few headers
30+ BINDGEN_EXTRA_CLANG_ARGS = ''-isystem ${ libs . libcDev } /include'' ;
31+
32+ # libc dynamic libraries
33+ LD_LIBRARY_PATH = lib . makeLibraryPath [
34+ libs . ccLib
35+ libs . libc
36+ libs . libgcc
37+ zlib
38+ ] ;
39+
40+ # libc static libraries
41+ LIBRARY_PATH = lib . makeLibraryPath [ libs . libcStatic ] ;
42+
43+ nativeBuildInputs = [
44+ cmake
45+ curl
46+ python3
47+ pkg-config
48+ ] ;
49+
50+ shellHook = ''
51+ alias x_wrapped="setarch $(uname -m) $(pwd)/x"
52+ no_randomize=$(setarch --show | grep "ADDR_NO_RANDOMIZE")
53+ if [ -n no_randomize ];
54+ then
55+ echo 'The ADDR_NO_RANDOMIZE flag is set.'
56+ echo "Use the \"setarch\" program to unset this flag: \"setarch $(uname -m) ./x ...\"."
57+ echo "Alternatively, you can use the following alias: \"x_wrapped\"."
58+ fi;
59+ '' ;
60+ } ;
61+ }
62+ ) ;
63+ }
Original file line number Diff line number Diff line change 1+ // Regression test for #149143.
2+ // The compiler did not check for a coercion from intrinsics
3+ // to fn ptrs in all possible code paths that could lead to such a coercion.
4+ // This caused an ICE during a later sanity check.
5+
6+ use std:: mem:: transmute;
7+
8+ fn main ( ) {
9+ unsafe {
10+ let f = if true { transmute } else { safe_transmute } ;
11+ //~^ ERROR `if` and `else` have incompatible type
12+
13+ let _: i64 = f ( 5i64 ) ;
14+ }
15+ }
16+
17+ unsafe fn safe_transmute < A , B > ( x : A ) -> B {
18+ panic ! ( )
19+ }
Original file line number Diff line number Diff line change 1+ error[E0308]: `if` and `else` have incompatible types
2+ --> $DIR/intrinsic-in-unifying-coercion-149143.rs:10:46
3+ |
4+ LL | let f = if true { transmute } else { safe_transmute };
5+ | --------- ^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
6+ | |
7+ | expected because of this
8+ |
9+ = note: expected fn item `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
10+ found fn item `unsafe fn(_) -> _ {safe_transmute::<_, _>}`
11+ = note: different fn items have unique types, even if their signatures are the same
12+
13+ error: aborting due to 1 previous error
14+
15+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments