-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize struct types in confirm_builtin_unsize_candidate
- Loading branch information
1 parent
6153d3c
commit 7893ca7
Showing
3 changed files
with
58 additions
and
3 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
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,21 @@ | ||
// check-pass | ||
|
||
use std::fmt::Debug; | ||
use std::marker::PhantomData; | ||
|
||
trait Foo { | ||
type Gat<'a>: ?Sized where Self: 'a; | ||
} | ||
|
||
struct Bar<'a, T: Foo + 'a>(T::Gat<'a>); | ||
|
||
struct Baz<T: ?Sized>(PhantomData<T>); | ||
|
||
impl<T: ?Sized> Foo for Baz<T> { | ||
type Gat<'a> = T where Self: 'a; | ||
} | ||
|
||
fn main() { | ||
let x = Bar::<'_, Baz<()>>(()); | ||
let y: &Bar<'_, Baz<dyn Debug>> = &x; | ||
} |
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,18 @@ | ||
// check-pass | ||
|
||
trait Trait {} | ||
impl<T> Trait for T {} | ||
|
||
trait Noop { | ||
type Assoc: ?Sized; | ||
} | ||
impl<T: ?Sized> Noop for T { | ||
type Assoc = T; | ||
} | ||
|
||
struct NoopNewtype<T: ?Sized + Noop>(T::Assoc); | ||
fn coerce_newtype<T: Trait>(x: &NoopNewtype<T>) -> &NoopNewtype<dyn Trait + '_> { | ||
x | ||
} | ||
|
||
fn main() {} |