Skip to content

Commit 66f9198

Browse files
committed
Use Arena inside hir::TraitMethod.
1 parent deac631 commit 66f9198

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
850850
visitor.visit_ty(ty);
851851
walk_list!(visitor, visit_nested_body, default);
852852
}
853-
TraitItemKind::Method(ref sig, TraitMethod::Required(ref param_names)) => {
853+
TraitItemKind::Method(ref sig, TraitMethod::Required(param_names)) => {
854854
visitor.visit_id(trait_item.hir_id);
855855
visitor.visit_fn_decl(&sig.decl);
856856
for &param_name in param_names {

src/librustc/hir/lowering/item.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
787787
}
788788
AssocItemKind::Fn(ref sig, None) => {
789789
let names = self.lower_fn_params_to_names(&sig.decl);
790+
let names: &[Ident] = self.arena.alloc_from_iter(names.into_iter());
790791
let (generics, sig) =
791792
self.lower_method_sig(&i.generics, sig, trait_item_def_id, false, None);
792793
(generics, hir::TraitItemKind::Method(sig, hir::TraitMethod::Required(names)))

src/librustc/hir/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,9 +1946,9 @@ pub struct TraitItem<'hir> {
19461946

19471947
/// Represents a trait method's body (or just argument names).
19481948
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
1949-
pub enum TraitMethod {
1949+
pub enum TraitMethod<'hir> {
19501950
/// No default body in the trait, just a signature.
1951-
Required(HirVec<Ident>),
1951+
Required(&'hir [Ident]),
19521952

19531953
/// Both signature and body are provided in the trait.
19541954
Provided(BodyId),
@@ -1960,7 +1960,7 @@ pub enum TraitItemKind<'hir> {
19601960
/// An associated constant with an optional value (otherwise `impl`s must contain a value).
19611961
Const(&'hir Ty, Option<BodyId>),
19621962
/// A method with an optional body.
1963-
Method(FnSig<'hir>, TraitMethod),
1963+
Method(FnSig<'hir>, TraitMethod<'hir>),
19641964
/// An associated type with (possibly empty) bounds and optional concrete
19651965
/// type.
19661966
Type(GenericBounds, Option<&'hir Ty>),

src/librustc_lint/nonstandard_style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
336336
}
337337

338338
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::TraitItem<'_>) {
339-
if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = &item.kind {
339+
if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = item.kind {
340340
self.check_snake_case(cx, "trait method", &item.ident);
341341
for param_name in pnames {
342342
self.check_snake_case(cx, "variable", param_name);

0 commit comments

Comments
 (0)