rust/tests/ui/layout/unconstrained-param-ice-137308.rs
David Wood cb711504bd
tests: update tests with unconstrained parameters
With the addition of new bounds to the unconstrained parameters, there
are more errors which just need blessed.
2025-06-16 23:04:35 +00:00

21 lines
536 B
Rust

//! Regression test for <https://github.com/rust-lang/rust/issues/137308>.
//!
//! This used to ICE in layout computation, because `<u8 as A>::B` fails to normalize
//! due to the unconstrained param on the impl.
#![feature(rustc_attrs)]
#![crate_type = "lib"]
trait A {
const B: usize;
}
impl<C: ?Sized> A for u8 { //~ ERROR: the type parameter `C` is not constrained
const B: usize = 42;
}
#[rustc_layout(debug)]
struct S([u8; <u8 as A>::B]);
//~^ ERROR: the type has an unknown layout
//~| ERROR: type annotations needed