-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #101831 - compiler-errors:issue-75899, r=jackh726
Normalize struct field types in `confirm_builtin_unsize_candidate` Fixes #75899 --- edited to move the normalization into `confirm_builtin_unsize_candidate` instead of the coercion code.
- Loading branch information
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() {} |