forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wfcheck: resolve the type-vars in
AdtField
types
Normalization can leave some type-vars unresolved in its return type. Make sure to resolve them so we have an infcx-independent type that can be used with `needs_drop`. Fixes rust-lang#61402.
- Loading branch information
Showing
2 changed files
with
23 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
21 changes: 21 additions & 0 deletions
21
src/test/run-pass/packed/packed-with-inference-vars-issue-61402.rs
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 @@ | ||
// If a struct is packed and its last field has drop glue, then that | ||
// field needs to be Sized (to allow it to be destroyed out-of-place). | ||
// | ||
// This is checked by the compiler during wfcheck. That check used | ||
// to have problems with associated types in the last field - test | ||
// that this doesn't ICE. | ||
|
||
#![allow(unused_imports, dead_code)] | ||
|
||
pub struct S; | ||
|
||
pub trait Trait<R> { type Assoc; } | ||
|
||
impl<X> Trait<X> for S { type Assoc = X; } | ||
|
||
#[repr(C, packed)] | ||
struct PackedAssocSized { | ||
pos: Box<<S as Trait<usize>>::Assoc>, | ||
} | ||
|
||
fn main() { println!("Hello, world!"); } |