diff options
| author | bors <bors@rust-lang.org> | 2025-03-12 08:00:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-12 08:00:53 +0000 |
| commit | 57a4736e9f4b7e8089b2db60583607f3b550c862 (patch) | |
| tree | e099f9d62fdcf622699932fd7e46cdd5f076b655 /compiler/rustc_parse/src/parser | |
| parent | a21d9789e24c8e0a070cf58830422f5b1c68a1f2 (diff) | |
| parent | 76f9cda260d07ee0467860c390f2839f8234a03b (diff) | |
| download | rust-57a4736e9f4b7e8089b2db60583607f3b550c862.tar.gz rust-57a4736e9f4b7e8089b2db60583607f3b550c862.zip | |
Auto merge of #138388 - matthiaskrgr:rollup-kbax8sz, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #138161 (Add PeekMut::refresh) - #138174 (Elaborate trait assumption in `receiver_is_dispatchable`) - #138313 (Update books) - #138347 (Reduce `kw::Empty` usage, part 2) - #138360 (Fix false-positive in `expr_or_init` and in the `invalid_from_utf8` lint) - #138372 (Refactor `pick2_mut` & `pick3_mut` to use `get_disjoint_mut`) - #138376 (Item-related cleanups) - #138377 (Remove unnecessary lifetime from `PatInfo`.) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index e309f144b4f..9e6cdfe59bb 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -646,7 +646,7 @@ impl<'a> Parser<'a> { let impl_items = self.parse_item_list(attrs, |p| p.parse_impl_item(ForceCollect::No))?; - let item_kind = match ty_second { + let (of_trait, self_ty) = match ty_second { Some(ty_second) => { // impl Trait for Type if !has_for { @@ -679,31 +679,20 @@ impl<'a> Parser<'a> { }; let trait_ref = TraitRef { path, ref_id: ty_first.id }; - ItemKind::Impl(Box::new(Impl { - safety, - polarity, - defaultness, - constness, - generics, - of_trait: Some(trait_ref), - self_ty: ty_second, - items: impl_items, - })) - } - None => { - // impl Type - ItemKind::Impl(Box::new(Impl { - safety, - polarity, - defaultness, - constness, - generics, - of_trait: None, - self_ty: ty_first, - items: impl_items, - })) + (Some(trait_ref), ty_second) } + None => (None, ty_first), // impl Type }; + let item_kind = ItemKind::Impl(Box::new(Impl { + safety, + polarity, + defaultness, + constness, + generics, + of_trait, + self_ty, + items: impl_items, + })); Ok((Ident::empty(), item_kind)) } |
