File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
src/tools/rust-analyzer/crates
ide-diagnostics/src/handlers Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,7 @@ enum PointerKind {
374374
375375fn pointer_kind ( ty : & Ty , table : & mut InferenceTable < ' _ > ) -> Result < Option < PointerKind > , ( ) > {
376376 let ty = table. resolve_ty_shallow ( ty) ;
377+ let ty = table. normalize_associated_types_in ( ty) ;
377378
378379 if table. is_sized ( & ty) {
379380 return Ok ( Some ( PointerKind :: Thin ) ) ;
Original file line number Diff line number Diff line change @@ -1129,4 +1129,39 @@ fn main() {
11291129 "# ,
11301130 ) ;
11311131 }
1132+
1133+ #[ test]
1134+ fn regression_18682 ( ) {
1135+ check_diagnostics (
1136+ r#"
1137+ //- minicore: coerce_unsized
1138+ struct Flexible {
1139+ body: [u8],
1140+ }
1141+
1142+ trait Field {
1143+ type Type: ?Sized;
1144+ }
1145+
1146+ impl Field for Flexible {
1147+ type Type = [u8];
1148+ }
1149+
1150+ trait KnownLayout {
1151+ type MaybeUninit: ?Sized;
1152+ }
1153+
1154+
1155+ impl<T> KnownLayout for [T] {
1156+ type MaybeUninit = [T];
1157+ }
1158+
1159+ struct ZerocopyKnownLayoutMaybeUninit(<<Flexible as Field>::Type as KnownLayout>::MaybeUninit);
1160+
1161+ fn test(ptr: *mut [u8]) -> *mut ZerocopyKnownLayoutMaybeUninit {
1162+ ptr as *mut _
1163+ }
1164+ "# ,
1165+ ) ;
1166+ }
11321167}
You can’t perform that action at this time.
0 commit comments