forked from rust-lang/glacier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust-lang/rust#100771 rust-lang/rust#100772 rust-lang/rust#100778 rust-lang/rust#100783 rust-lang/rust#100818
- Loading branch information
1 parent
e9eb072
commit 1dc3cb0
Showing
5 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
rustc -Zextra-const-ub-checks - <<'EOF' | ||
#[derive(PartialEq, Eq, Copy, Clone)] | ||
#[repr(packed)] | ||
struct Foo { | ||
field: (i64, u32, u32, u32), | ||
} | ||
const FOO: Foo = Foo { | ||
field: (5, 6, 7, 8), | ||
}; | ||
fn main() { | ||
match FOO { | ||
Foo { field: (5, 6, 7, 8) } => {}, | ||
FOO => unreachable!(), //~ WARNING unreachable pattern | ||
_ => unreachable!(), | ||
} | ||
} | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
rustc -Clto -Zsanitizer=cfi - <<'EOF' | ||
#![feature(allocator_api)] | ||
fn main() { | ||
Box::new_in(&[0, 1], &std::alloc::Global); | ||
} | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
rustc -Clto -Zsanitizer=cfi - <<'EOF' | ||
#![feature(adt_const_params, generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
pub type Matrix = [usize; 1]; | ||
const EMPTY_MATRIX: Matrix = [0; 1]; | ||
pub struct Walk<const REMAINING: Matrix> { } | ||
impl Walk<EMPTY_MATRIX> { | ||
pub const fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
fn main() { | ||
let _ = Walk::new(); | ||
} | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
rustc -Cdebuginfo=2 -Zsanitizer=cfi -Clto - <<'EOF' | ||
// run-pass | ||
trait Stream { type Item; } | ||
impl<'a> Stream for &'a str { type Item = u8; } | ||
fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) { | ||
(s, 42) | ||
} | ||
fn main() { | ||
let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item); | ||
assert_eq!(fx("hi"), ("hi", 42)); | ||
} | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(type_alias_impl_trait)] | ||
use std::future::Future; | ||
|
||
fn main() { | ||
type SomeFuture<'t> = impl 't + Future<Output = ()>; | ||
type SomeClosure = impl for<'t> FnOnce(&'t str) -> SomeFuture<'t>; | ||
fn coerce_closure(f: SomeClosure) {} | ||
coerce_closure(|x: &str| async move {}); | ||
} |