// rustfmt-inline_attribute_width: 40 #![crate_type = "lib"] #![feature(cfg_attribute_in_where)] use std::marker::PhantomData; #[cfg(a)] trait TraitA {} #[cfg(b)] trait TraitB {} trait A where #[cfg = a_very_long_attribute_name] T: TraitA, #[cfg = another_very_long_attribute_name] T: TraitB, { type B where #[cfg = a] // line comment after the attribute U: TraitA, #[cfg = b] /* block comment after the attribute */ U: TraitB, #[cfg = a] // short U: TraitA, #[cfg = b] /* short */ U: TraitB; fn foo(&self) where /// line doc comment before the attribute U: TraitA, /** line doc block comment before the attribute */ U: TraitB; } impl A for T where #[doc = "line doc before the attribute"] T: TraitA, /** short doc */ T: TraitB, { type B = () where #[doc = "short"] U: TraitA, #[doc = "short"] #[cfg = a] U: TraitB; fn foo(&self) where #[cfg = a] #[cfg = b] U: TraitA, /// line doc #[cfg = c] U: TraitB, { } } struct C where #[cfg = a] T: TraitA, #[cfg = b] T: TraitB, { _t: PhantomData, } union D where #[cfg = a] T: TraitA, #[cfg = b] T: TraitB, { _t: PhantomData, } enum E where #[cfg = a] T: TraitA, #[cfg = b] T: TraitB, { E(PhantomData), } #[allow(type_alias_bounds)] type F where #[cfg = a] T: TraitA, #[cfg = b] T: TraitB, = T; impl C where #[cfg = a] T: TraitA, #[cfg = b] T: TraitB, { fn new() where #[cfg = a] U: TraitA, #[cfg = b] U: TraitB, { } } fn foo() where #[cfg = a] T: TraitA, #[cfg = b] T: TraitB, { }