diff options
| author | bors <bors@rust-lang.org> | 2022-08-16 18:07:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-16 18:07:02 +0000 |
| commit | 5746c752f4e3f294cd252f7dd611a1908b12dd8e (patch) | |
| tree | 4165b48259f23bcc95afeffef17655138dfd2e44 /compiler/rustc_parse/src/parser | |
| parent | a39bdb1d6b9eaf23f2636baee0949d67890abcd8 (diff) | |
| parent | 35bd1d64cfe8efe8c99cb1d413d88603d1fbd56c (diff) | |
| download | rust-5746c752f4e3f294cd252f7dd611a1908b12dd8e.tar.gz rust-5746c752f4e3f294cd252f7dd611a1908b12dd8e.zip | |
Auto merge of #100626 - Dylan-DPC:rollup-mwbm7kj, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #99942 (Fix nonsense non-tupled `Fn` trait error) - #100609 (Extend invalid floating point literal suffix suggestion) - #100610 (Ast and parser tweaks) - #100613 (compiletest: fix typo in runtest.rs) - #100616 (:arrow_up: rust-analyzer) - #100622 (Support 128-bit atomics on all aarch64 targets) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 14 |
2 files changed, 5 insertions, 10 deletions
diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 1acfd93d86f..5e5f2fd7d9f 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -314,7 +314,6 @@ impl<'a> Parser<'a> { span: lo.to(self.prev_token.span), lhs_ty: ty, rhs_ty, - id: ast::DUMMY_NODE_ID, })) } else { self.maybe_recover_bounds_doubled_colon(&ty)?; diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 8332c171a9c..fc7fb866f11 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -527,7 +527,7 @@ impl<'a> Parser<'a> { Ok(ident_gen_args) => ident_gen_args, Err(()) => return Ok(Some(AngleBracketedArg::Arg(arg))), }; - if binder.is_some() { + if binder { // FIXME(compiler-errors): this could be improved by suggesting lifting // this up to the trait, at least before this becomes real syntax. // e.g. `Trait<for<'a> Assoc = Ty>` -> `for<'a> Trait<Assoc = Ty>` @@ -720,28 +720,24 @@ impl<'a> Parser<'a> { /// Given a arg inside of generics, we try to destructure it as if it were the LHS in /// `LHS = ...`, i.e. an associated type binding. - /// This returns (optionally, if they are present) any `for<'a, 'b>` binder args, the + /// This returns a bool indicating if there are any `for<'a, 'b>` binder args, the /// identifier, and any GAT arguments. fn get_ident_from_generic_arg( &self, gen_arg: &GenericArg, - ) -> Result<(Option<Vec<ast::GenericParam>>, Ident, Option<GenericArgs>), ()> { + ) -> Result<(bool, Ident, Option<GenericArgs>), ()> { if let GenericArg::Type(ty) = gen_arg { if let ast::TyKind::Path(qself, path) = &ty.kind && qself.is_none() && let [seg] = path.segments.as_slice() { - return Ok((None, seg.ident, seg.args.as_deref().cloned())); + return Ok((false, seg.ident, seg.args.as_deref().cloned())); } else if let ast::TyKind::TraitObject(bounds, ast::TraitObjectSyntax::None) = &ty.kind && let [ast::GenericBound::Trait(trait_ref, ast::TraitBoundModifier::None)] = bounds.as_slice() && let [seg] = trait_ref.trait_ref.path.segments.as_slice() { - return Ok(( - Some(trait_ref.bound_generic_params.clone()), - seg.ident, - seg.args.as_deref().cloned(), - )); + return Ok((true, seg.ident, seg.args.as_deref().cloned())); } } Err(()) |
