mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
30 lines
563 B
Rust
30 lines
563 B
Rust
//@ known-bug: #146965
|
|
//@ compile-flags: --crate-type lib -C opt-level=3
|
|
|
|
fn conjure<T>() -> T {
|
|
panic!()
|
|
}
|
|
|
|
pub trait Ring {
|
|
type Element;
|
|
}
|
|
impl<T> Ring for T {
|
|
type Element = u16;
|
|
}
|
|
|
|
// Removing the : Ring bound makes it not ICE
|
|
fn map_coeff<T: Ring>(f: impl Fn(<T as Ring>::Element)) {
|
|
let c = conjure::<<T as Ring>::Element>();
|
|
f(c);
|
|
}
|
|
|
|
// Adding a : Ring bound makes it not ICE
|
|
fn gcd<T>() {
|
|
map_coeff::<T>(|_: u16| {});
|
|
}
|
|
|
|
// Removing the : Ring bound makes it not ICE
|
|
pub fn bivariate_factorization<T: Ring>() {
|
|
gcd::<T>();
|
|
}
|