Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ fn visit_implementation_of_unpin(checker: &Checker<'_>) -> Result<(), ErrorGuara
}));
}
ty::Adt(_, _) => {}
// `extern type`s have no fields, so they can't be structurally pinned.
ty::Foreign(_) => {}
_ => {
return Err(tcx.dcx().span_delayed_bug(span, "impl of `Unpin` for a non-adt type"));
}
Expand Down
11 changes: 0 additions & 11 deletions tests/crashes/155053.rs

This file was deleted.

18 changes: 18 additions & 0 deletions tests/ui/pin-ergonomics/impl-unpin-extern-type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Verify that a local `extern type` can manually implement `Unpin` with `pin_ergonomics` enabled.
//! Unlike a `#[pin_v2]` ADT, an extern type has no fields that could be structually pinned.
//!
//! Regression test for <https://github.com/rust-lang/rust/issues/155053>.

//@ check-pass

#![feature(pin_ergonomics)]
#![feature(extern_types)]
#![allow(incomplete_features)]

unsafe extern "C" {
type ExternType;
}

impl Unpin for ExternType {}

fn main() {}
Loading