Rollup merge of #128226 - oli-obk:option_vs_empty_slice, r=petrochenkov
Remove redundant option that was just encoding that a slice was empty
There is already a sanity check ensuring we don't put empty attribute lists into the HIR:
6ef11b81c2/compiler/rustc_ast_lowering/src/lib.rs (L661-L667)
This commit is contained in:
@@ -913,15 +913,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
ret
|
||||
}
|
||||
|
||||
fn lower_attrs(&mut self, id: HirId, attrs: &[Attribute]) -> Option<&'hir [Attribute]> {
|
||||
fn lower_attrs(&mut self, id: HirId, attrs: &[Attribute]) -> &'hir [Attribute] {
|
||||
if attrs.is_empty() {
|
||||
None
|
||||
&[]
|
||||
} else {
|
||||
debug_assert_eq!(id.owner, self.current_hir_id_owner);
|
||||
let ret = self.arena.alloc_from_iter(attrs.iter().map(|a| self.lower_attr(a)));
|
||||
debug_assert!(!ret.is_empty());
|
||||
self.attrs.insert(id.local_id, ret);
|
||||
Some(ret)
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user