mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 05:13:35 +00:00
fix: Resolve projection types before checking casts
This commit is contained in:
parent
ca47cddc31
commit
b7b4dd5afc
2 changed files with 36 additions and 0 deletions
|
|
@ -1129,4 +1129,39 @@ fn main() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn regression_18682() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
//- minicore: coerce_unsized
|
||||
struct Flexible {
|
||||
body: [u8],
|
||||
}
|
||||
|
||||
trait Field {
|
||||
type Type: ?Sized;
|
||||
}
|
||||
|
||||
impl Field for Flexible {
|
||||
type Type = [u8];
|
||||
}
|
||||
|
||||
trait KnownLayout {
|
||||
type MaybeUninit: ?Sized;
|
||||
}
|
||||
|
||||
|
||||
impl<T> KnownLayout for [T] {
|
||||
type MaybeUninit = [T];
|
||||
}
|
||||
|
||||
struct ZerocopyKnownLayoutMaybeUninit(<<Flexible as Field>::Type as KnownLayout>::MaybeUninit);
|
||||
|
||||
fn test(ptr: *mut [u8]) -> *mut ZerocopyKnownLayoutMaybeUninit {
|
||||
ptr as *mut _
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue