Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

add 2 (4) ices #1319

Merged
merged 1 commit into from
Jun 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ices/97098.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#![feature(type_alias_impl_trait)]
#![feature(generic_associated_types)]

pub trait Trait {
type Assoc<'a>;
}

pub type Foo = impl for<'a> Trait<Assoc<'a> = FooAssoc<'a>>;
pub type FooAssoc<'a> = impl Sized;

struct Struct;
impl Trait for Struct {
type Assoc<'a> = &'a u32;
}

const FOO: Foo = Struct;
12 changes: 12 additions & 0 deletions ices/97099-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pub trait Trait<'a> {
type Assoc;
}

struct Struct;
impl<'a> Trait<'a> for Struct {
type Assoc = &'a u32;
}

fn blah() -> impl for<'a> Trait<'a, Assoc = impl Sized> {
Struct
}
17 changes: 17 additions & 0 deletions ices/97099-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
trait Trait<E> {
type Assoc;
}

struct Foo;

impl<'a> Trait<&'a ()> for Foo {
type Assoc = ();
}

fn foo() -> impl for<'a> Trait<&'a ()> {
Foo
}

fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> {
foo()
}
25 changes: 25 additions & 0 deletions ices/98476-1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

rustc --edition=2021 -Zdrop-tracking - <<'EOF'

fn main() {
let _ = foo();
}

async fn from_config(_: Config) {}

async fn foo() {
from_config(Config {
nickname: None,
..Default::default()
})
.await;
}

#[derive(Default)]
struct Config {
nickname: Option<Box<u8>>,
}

EOF

34 changes: 34 additions & 0 deletions ices/98476-2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

rustc --edition=2021 -Zdrop-tracking - <<'EOF'

fn main() {
let _ = foo();
}

async fn from_config(x: Config) {
async {}.await;
drop(x);
}

async fn foo() {
from_config(Config {
nickname: NonCopy,
..Default::default()
})
.await;
}

#[derive(Default)]
struct NonCopy;
impl Drop for NonCopy {
fn drop(&mut self) {}
}

#[derive(Default)]
struct Config {
nickname: NonCopy,
}

EOF