Auto merge of #118655 - compiler-errors:rollup-vrngyzn, r=compiler-errors
Rollup of 9 pull requests Successful merges: - #117793 (Update variable name to fix `unused_variables` warning) - #118123 (Add support for making lib features internal) - #118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always) - #118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence) - #118350 (Simplify Default for tuples) - #118450 (Use OnceCell in cell module documentation) - #118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`) - #118587 (Cleanup error handlers some more) - #118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
1dd4db5062
53 changed files with 552 additions and 572 deletions
|
@ -304,23 +304,25 @@ impl<'a> Parser<'a> {
|
|||
if self.may_recover()
|
||||
&& (self.eat_keyword_noexpect(kw::Impl) || self.eat_keyword_noexpect(kw::Dyn))
|
||||
{
|
||||
let kw = self.prev_token.ident().unwrap().0.name;
|
||||
let mut err = self.sess.create_err(errors::TransposeDynOrImpl {
|
||||
span: self.prev_token.span,
|
||||
kw: kw.as_str(),
|
||||
sugg: errors::TransposeDynOrImplSugg {
|
||||
removal_span: self.prev_token.span.with_hi(self.token.span.lo()),
|
||||
insertion_span: for_span.shrink_to_lo(),
|
||||
kw: kw.as_str(),
|
||||
},
|
||||
});
|
||||
let kw = self.prev_token.ident().unwrap().0;
|
||||
let removal_span = kw.span.with_hi(self.token.span.lo());
|
||||
let path = self.parse_path(PathStyle::Type)?;
|
||||
let parse_plus = allow_plus == AllowPlus::Yes && self.check_plus();
|
||||
let kind =
|
||||
self.parse_remaining_bounds_path(lifetime_defs, path, lo, parse_plus)?;
|
||||
let mut err = self.sess.create_err(errors::TransposeDynOrImpl {
|
||||
span: kw.span,
|
||||
kw: kw.name.as_str(),
|
||||
sugg: errors::TransposeDynOrImplSugg {
|
||||
removal_span,
|
||||
insertion_span: for_span.shrink_to_lo(),
|
||||
kw: kw.name.as_str(),
|
||||
},
|
||||
});
|
||||
|
||||
// Take the parsed bare trait object and turn it either
|
||||
// into a `dyn` object or an `impl Trait`.
|
||||
let kind = match (kind, kw) {
|
||||
let kind = match (kind, kw.name) {
|
||||
(TyKind::TraitObject(bounds, _), kw::Dyn) => {
|
||||
TyKind::TraitObject(bounds, TraitObjectSyntax::Dyn)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue