Urgau
Request for Comments (RFC)
rustc --check-cfg 'values(name, "value1", "value2", ... "valueN")'values(name) // the empty value?rustc --check-cfg 'values(name)'
--check-cfg 'values(name, "test")'#[cfg(name = "test")] // expected
#[cfg(name)] // also expected?
// ambiguity in the syntax// explicit none
values(none())lint = tool to help improve your source code think of warnings, errors
all in the same PR
pub enum IrTyKind<'a, I: Interner> {
/// Doc comment for AdtKind
AdtKind(&'a I::Adt),
/// and another one for TyKind
TyKind(I::Adt, I::Ty),
// no comment
StructKind { a: I::Adt, },
}
pub type TyKind<'a> = IrTyKind<'a, TyCtxt>;no more
I::$ rustc -
$ rustdoc -$ curl code.rs | rustdoc - && \
open doc/*/index.html/// Calculates the middle point of `self` and `rhs`.
///
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
/// sufficiently-large signed integer type. This implies that the
/// result is always rounded towards zero and that no overflow will
/// ever occur.
impl i{8,16,32,64,128,size} {
pub const fn midpoint(self, rhs: Self) -> Self;
}
impl u{8,16,32,64,128,size} {
pub const fn midpoint(self, rhs: Self) -> Self;
}
impl f{32,64} {
pub const fn midpoint(self, rhs: Self) -> Self;
}// in u32::midpoint, we use u64!
((a as u64 + b as u64) / 2) as u32// HashMap
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;for check-cfg we have to register 7 target cfgs for >300 targets
// in HashMap (will be stable in 1.86.0)
pub fn get_disjoint_mut<Q, const N: usize>(
&mut self,
ks: [&Q; N],
) -> [Option<&mut V>; N]
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized;// in check-cfg implementation
let [
Some(values_target_abi),
Some(values_target_arch),
Some(values_target_endian),
Some(values_target_env),
Some(values_target_family),
Some(values_target_os),
Some(values_target_pointer_width),
Some(values_target_vendor),
] = self.expecteds.get_disjoint_mut(VALUES)
else {
panic!("unable to get all the check-cfg values buckets");
};Projects from:
after years of work!