2021-07-03 10:56:09 -05:00
|
|
|
// Regression test for the ICE described in #86820.
|
|
|
|
|
2022-05-05 11:44:54 -05:00
|
|
|
#![allow(unused, dead_code)]
|
2021-07-03 10:56:09 -05:00
|
|
|
use std::ops::BitAnd;
|
|
|
|
|
|
|
|
const C: fn() = || is_set();
|
|
|
|
fn is_set() {
|
|
|
|
0xffu8.bit::<0>();
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Bits {
|
2022-05-05 11:44:54 -05:00
|
|
|
fn bit<const I: u8>(self) -> bool;
|
2021-07-03 10:56:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Bits for u8 {
|
2022-05-05 11:44:54 -05:00
|
|
|
fn bit<const I: usize>(self) -> bool {
|
2022-05-06 05:37:22 -05:00
|
|
|
//~^ ERROR: method `bit` has an incompatible generic parameter for trait `Bits` [E0053]
|
2021-07-03 10:56:09 -05:00
|
|
|
let i = 1 << I;
|
|
|
|
let mask = u8::from(i);
|
|
|
|
mask & self == mask
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|