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#100689 rust-lang/rust#100672 rust-lang/rust#100612 rust-lang/rust#100550 rust-lang/rust#100463
- Loading branch information
1 parent
f913963
commit 2291d39
Showing
5 changed files
with
120 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,14 @@ | ||
struct Foo<T> { | ||
inner: Vec<T>, | ||
} | ||
|
||
impl<T> Foo<T> { | ||
fn get(&self) -> impl Iterator<Item = &T> { | ||
self.inner.iter() | ||
} | ||
} | ||
|
||
fn main() { | ||
let foo: Foo<()> = Foo { inner: Vec::new() }; | ||
let vals: Vec<_> = foo.get(); | ||
} |
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,31 @@ | ||
#!/bin/bash | ||
|
||
rustc -Copt-level=2 --crate-type lib - <<'EOF' | ||
pub trait Trait { | ||
type Associated; | ||
} | ||
impl<T> Trait for T { | ||
type Associated = T; | ||
} | ||
pub struct Struct<T>(<T as Trait>::Associated); | ||
pub fn foo<T>() -> Struct<T> | ||
where | ||
T: Trait, | ||
{ | ||
bar() | ||
} | ||
#[inline] | ||
fn bar<T>() -> Struct<T> { | ||
Struct(baz()) | ||
} | ||
fn baz<T>() -> T { | ||
unimplemented!() | ||
} | ||
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,25 @@ | ||
#!/bin/bash | ||
|
||
rustc "-Cdebuginfo=2" - <<'EOF' | ||
// run-pass | ||
#![feature(repr128, arbitrary_enum_discriminant)] | ||
//~^ WARN the feature `repr128` is incomplete | ||
#[derive(PartialEq, Debug)] | ||
#[repr(i128)] | ||
enum Test { | ||
A(Box<u64>) = 0, | ||
B(usize) = u64::MAX as i128 + 1, | ||
} | ||
fn main() { | ||
assert_ne!(Test::A(Box::new(2)), Test::B(0)); | ||
// This previously caused a segfault. | ||
// | ||
// See https://github.com/rust-lang/rust/issues/70509#issuecomment-620654186 | ||
// for a detailed explanation. | ||
} | ||
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,15 @@ | ||
#![feature(generic_associated_types)] | ||
|
||
trait Bar<'a> { | ||
type Ref<'b> | ||
where | ||
'a: 'b; | ||
fn uwu(f: impl Fn(Self::Ref<'_>)); | ||
} | ||
|
||
impl<'a> Bar<'a> for () { | ||
type Ref<'b> = () where 'a: 'b; | ||
fn uwu(f: impl Fn(())) {} | ||
} | ||
|
||
pub fn main() {} |
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,35 @@ | ||
#![feature(generic_associated_types)] | ||
|
||
struct Foo<'a> { | ||
foo: &'a mut usize, | ||
} | ||
|
||
trait Bar<'a> { | ||
type FooRef<'b> | ||
where | ||
'a : 'b, | ||
; | ||
fn uwu ( | ||
foo: Foo<'a>, | ||
f: impl for<'b> FnMut(Self::FooRef<'b>), | ||
) | ||
; | ||
} | ||
impl<'a> Bar<'a> for () { | ||
type FooRef<'b> | ||
= | ||
&'b Foo<'a> | ||
where | ||
'a : 'b, | ||
; | ||
|
||
fn uwu ( | ||
foo: Foo<'a>, | ||
mut f: impl for<'b> FnMut(&'b Foo<'a>), //relevant part | ||
) | ||
{ | ||
f(&foo); | ||
} | ||
} | ||
|
||
fn main() {} |