diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index e7b2e4b1cb4b..bdb1879ec201 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -403,8 +403,8 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) { walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref); visitor.visit_ty(&mutable_type.ty) } - TyKind::Tup(tys) => { - walk_list!(visitor, visit_ty, tys); + TyKind::Tup(tuple_element_types) => { + walk_list!(visitor, visit_ty, tuple_element_types); } TyKind::BareFn(function_declaration) => { walk_list!(visitor, visit_generic_param, &function_declaration.generic_params); diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index fa8567eac609..d7767efa9841 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -131,7 +131,7 @@ pub fn print_crate<'a>( // Currently, in Rust 2018 we don't have `extern crate std;` at the crate // root, so this is not needed, and actually breaks things. - if edition.rust_2015() { + if edition.is_rust_2015() { // `#![no_std]` let fake_attr = attr::mk_attr_word(g, ast::AttrStyle::Inner, sym::no_std, DUMMY_SP); s.print_attribute(&fake_attr); diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs index 88d454fbc112..bad47db0de1d 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs @@ -29,16 +29,30 @@ pub fn expand_deriving_partial_eq( cx.span_bug(field.span, "not exactly 2 arguments in `derive(PartialEq)`"); }; - // We received `&T` arguments. Convert them to `T` by - // stripping `&` or adding `*`. This isn't necessary for - // type checking, but it results in much better error - // messages if something goes wrong. + // We received arguments of type `&T`. Convert them to type `T` by stripping + // any leading `&` or adding `*`. This isn't necessary for type checking, but + // it results in better error messages if something goes wrong. + // + // Note: for arguments that look like `&{ x }`, which occur with packed + // structs, this would cause expressions like `{ self.x } == { other.x }`, + // which isn't valid Rust syntax. This wouldn't break compilation because these + // AST nodes are constructed within the compiler. But it would mean that code + // printed by `-Zunpretty=expanded` (or `cargo expand`) would have invalid + // syntax, which would be suboptimal. So we wrap these in parens, giving + // `({ self.x }) == ({ other.x })`, which is valid syntax. let convert = |expr: &P<Expr>| { if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, inner) = &expr.kind { - inner.clone() + if let ExprKind::Block(..) = &inner.kind { + // `&{ x }` form: remove the `&`, add parens. + cx.expr_paren(field.span, inner.clone()) + } else { + // `&x` form: remove the `&`. + inner.clone() + } } else { + // No leading `&`: add a leading `*`. cx.expr_deref(field.span, expr.clone()) } }; diff --git a/compiler/rustc_error_messages/locales/en-US/parse.ftl b/compiler/rustc_error_messages/locales/en-US/parse.ftl index 1728ef70cba0..ee2d56570d8f 100644 --- a/compiler/rustc_error_messages/locales/en-US/parse.ftl +++ b/compiler/rustc_error_messages/locales/en-US/parse.ftl @@ -203,8 +203,9 @@ parse_inclusive_range_extra_equals = unexpected `=` after inclusive range .suggestion_remove_eq = use `..=` instead .note = inclusive ranges end with a single equals sign (`..=`) -parse_inclusive_range_match_arrow = unexpected `=>` after open range - .suggestion_add_space = add a space between the pattern and `=>` +parse_inclusive_range_match_arrow = unexpected `>` after inclusive range + .label = this is parsed as an inclusive range `..=` + .suggestion = add a space between the pattern and `=>` parse_inclusive_range_no_end = inclusive range with no end .suggestion_open_range = use `..` instead diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs index 9b16e79d49a9..6cd56852f9d6 100644 --- a/compiler/rustc_expand/src/build.rs +++ b/compiler/rustc_expand/src/build.rs @@ -272,6 +272,10 @@ impl<'a> ExtCtxt<'a> { self.expr(sp, ast::ExprKind::AddrOf(ast::BorrowKind::Ref, ast::Mutability::Not, e)) } + pub fn expr_paren(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> { + self.expr(sp, ast::ExprKind::Paren(e)) + } + pub fn expr_call( &self, span: Span, diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 554a70265d43..b5c2d14e8d15 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -60,7 +60,7 @@ use crate::traits::{ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorGuaranteed, IntoDiagnosticArg}; -use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString, MultiSpan}; +use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -1470,51 +1470,17 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { for (key, values) in types.iter() { let count = values.len(); let kind = key.descr(); - let mut returned_async_output_error = false; for &sp in values { - if sp.is_desugaring(DesugaringKind::Async) && !returned_async_output_error { - if [sp] != err.span.primary_spans() { - let mut span: MultiSpan = sp.into(); - span.push_span_label( - sp, - format!( - "checked the `Output` of this `async fn`, {}{} {}{}", - if count > 1 { "one of the " } else { "" }, - target, - kind, - pluralize!(count), - ), - ); - err.span_note( - span, - "while checking the return type of the `async fn`", - ); - } else { - err.span_label( - sp, - format!( - "checked the `Output` of this `async fn`, {}{} {}{}", - if count > 1 { "one of the " } else { "" }, - target, - kind, - pluralize!(count), - ), - ); - err.note("while checking the return type of the `async fn`"); - } - returned_async_output_error = true; - } else { - err.span_label( - sp, - format!( - "{}{} {}{}", - if count == 1 { "the " } else { "one of the " }, - target, - kind, - pluralize!(count), - ), - ); - } + err.span_label( + sp, + format!( + "{}{} {}{}", + if count == 1 { "the " } else { "one of the " }, + target, + kind, + pluralize!(count), + ), + ); } } } @@ -1537,7 +1503,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { // | // = note: expected unit type `()` // found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]` - if !self.ignore_span.overlaps(span) { + // + // Also ignore opaque `Future`s that come from async fns. + if !self.ignore_span.overlaps(span) + && !span.is_desugaring(DesugaringKind::Async) + { self.types.entry(kind).or_default().insert(span); } } diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index e63fc3c73b20..7a7c7e6a226c 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -667,13 +667,10 @@ pub(crate) struct InclusiveRangeExtraEquals { #[diag(parse_inclusive_range_match_arrow)] pub(crate) struct InclusiveRangeMatchArrow { #[primary_span] + pub arrow: Span, + #[label] pub span: Span, - #[suggestion( - suggestion_add_space, - style = "verbose", - code = " ", - applicability = "machine-applicable" - )] + #[suggestion(style = "verbose", code = " ", applicability = "machine-applicable")] pub after_pat: Span, } diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index f4c08031bcca..6596a06afab6 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -2394,7 +2394,7 @@ impl<'a> Parser<'a> { /// Some special error handling for the "top-level" patterns in a match arm, /// `for` loop, `let`, &c. (in contrast to subpatterns within such). - pub(crate) fn maybe_recover_colon_colon_in_pat_typo_or_anon_enum( + pub(crate) fn maybe_recover_colon_colon_in_pat_typo( &mut self, mut first_pat: P<Pat>, expected: Expected, @@ -2405,41 +2405,26 @@ impl<'a> Parser<'a> { if !matches!(first_pat.kind, PatKind::Ident(_, _, None) | PatKind::Path(..)) || !self.look_ahead(1, |token| token.is_ident() && !token.is_reserved_ident()) { - let mut snapshot_type = self.create_snapshot_for_diagnostic(); - snapshot_type.bump(); // `:` - match snapshot_type.parse_ty() { - Err(inner_err) => { - inner_err.cancel(); - } - Ok(ty) => { - let Err(mut err) = self.expected_one_of_not_found(&[], &[]) else { - return first_pat; - }; - err.span_label(ty.span, "specifying the type of a pattern isn't supported"); - self.restore_snapshot(snapshot_type); - let span = first_pat.span.to(ty.span); - first_pat = self.mk_pat(span, PatKind::Wild); - err.emit(); - } - } return first_pat; } // The pattern looks like it might be a path with a `::` -> `:` typo: // `match foo { bar:baz => {} }` - let colon_span = self.token.span; + let span = self.token.span; // We only emit "unexpected `:`" error here if we can successfully parse the // whole pattern correctly in that case. - let mut snapshot_pat = self.create_snapshot_for_diagnostic(); - let mut snapshot_type = self.create_snapshot_for_diagnostic(); + let snapshot = self.create_snapshot_for_diagnostic(); // Create error for "unexpected `:`". match self.expected_one_of_not_found(&[], &[]) { Err(mut err) => { - snapshot_pat.bump(); // Skip the `:`. - snapshot_type.bump(); // Skip the `:`. - match snapshot_pat.parse_pat_no_top_alt(expected) { + self.bump(); // Skip the `:`. + match self.parse_pat_no_top_alt(expected) { Err(inner_err) => { + // Carry on as if we had not done anything, callers will emit a + // reasonable error. inner_err.cancel(); + err.cancel(); + self.restore_snapshot(snapshot); } Ok(mut pat) => { // We've parsed the rest of the pattern. @@ -2503,8 +2488,8 @@ impl<'a> Parser<'a> { _ => {} } if show_sugg { - err.span_suggestion_verbose( - colon_span.until(self.look_ahead(1, |t| t.span)), + err.span_suggestion( + span, "maybe write a path separator here", "::", Applicability::MaybeIncorrect, @@ -2512,24 +2497,13 @@ impl<'a> Parser<'a> { } else { first_pat = self.mk_pat(new_span, PatKind::Wild); } - self.restore_snapshot(snapshot_pat); + err.emit(); } } - match snapshot_type.parse_ty() { - Err(inner_err) => { - inner_err.cancel(); - } - Ok(ty) => { - err.span_label(ty.span, "specifying the type of a pattern isn't supported"); - self.restore_snapshot(snapshot_type); - let new_span = first_pat.span.to(ty.span); - first_pat = self.mk_pat(new_span, PatKind::Wild); - } - } - err.emit(); } _ => { // Carry on as if we had not done anything. This should be unreachable. + self.restore_snapshot(snapshot); } }; first_pat diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 500d7d77071d..524654890584 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2716,6 +2716,14 @@ impl<'a> Parser<'a> { ); err.emit(); this.bump(); + } else if matches!( + (&this.prev_token.kind, &this.token.kind), + (token::DotDotEq, token::Gt) + ) { + // `error_inclusive_range_match_arrow` handles cases like `0..=> {}`, + // so we supress the error here + err.delay_as_bug(); + this.bump(); } else { return Err(err); } diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 53680a82bdc2..29e9769befb5 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2442,7 +2442,7 @@ impl<'a> Parser<'a> { /// We are parsing `async fn`. If we are on Rust 2015, emit an error. fn ban_async_in_2015(&self, span: Span) { - if span.rust_2015() { + if span.is_rust_2015() { let diag = self.diagnostic(); struct_span_err!(diag, span, E0670, "`async fn` is not permitted in Rust 2015") .span_label(span, "to use `async fn`, switch to Rust 2018 or later") diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 912f7cc14f6c..8363021f2ea6 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -118,8 +118,7 @@ impl<'a> Parser<'a> { // Check if the user wrote `foo:bar` instead of `foo::bar`. if ra == RecoverColon::Yes { - first_pat = - self.maybe_recover_colon_colon_in_pat_typo_or_anon_enum(first_pat, expected); + first_pat = self.maybe_recover_colon_colon_in_pat_typo(first_pat, expected); } if let Some(leading_vert_span) = leading_vert_span { @@ -777,7 +776,7 @@ impl<'a> Parser<'a> { self.error_inclusive_range_with_extra_equals(span_with_eq); } token::Gt if no_space => { - self.error_inclusive_range_match_arrow(span); + self.error_inclusive_range_match_arrow(span, tok.span); } _ => self.error_inclusive_range_with_no_end(span), } @@ -787,9 +786,9 @@ impl<'a> Parser<'a> { self.sess.emit_err(InclusiveRangeExtraEquals { span }); } - fn error_inclusive_range_match_arrow(&self, span: Span) { + fn error_inclusive_range_match_arrow(&self, span: Span, arrow: Span) { let after_pat = span.with_hi(span.hi() - rustc_span::BytePos(1)).shrink_to_hi(); - self.sess.emit_err(InclusiveRangeMatchArrow { span, after_pat }); + self.sess.emit_err(InclusiveRangeMatchArrow { span, arrow, after_pat }); } fn error_inclusive_range_with_no_end(&self, span: Span) { @@ -1013,12 +1012,15 @@ impl<'a> Parser<'a> { } ate_comma = false; - if self.check(&token::DotDot) || self.token == token::DotDotDot { + if self.check(&token::DotDot) + || self.check_noexpect(&token::DotDotDot) + || self.check_keyword(kw::Underscore) + { etc = true; let mut etc_sp = self.token.span; - self.recover_one_fewer_dotdot(); - self.bump(); // `..` || `...` + self.recover_bad_dot_dot(); + self.bump(); // `..` || `...` || `_` if self.token == token::CloseDelim(Delimiter::Brace) { etc_span = Some(etc_sp); @@ -1111,21 +1113,25 @@ impl<'a> Parser<'a> { Ok((fields, etc)) } - /// Recover on `...` as if it were `..` to avoid further errors. + /// Recover on `...` or `_` as if it were `..` to avoid further errors. /// See issue #46718. - fn recover_one_fewer_dotdot(&self) { - if self.token != token::DotDotDot { + fn recover_bad_dot_dot(&self) { + if self.token == token::DotDot { return; } - self.struct_span_err(self.token.span, "expected field pattern, found `...`") - .span_suggestion( - self.token.span, - "to omit remaining fields, use one fewer `.`", - "..", - Applicability::MachineApplicable, - ) - .emit(); + let token_str = pprust::token_to_string(&self.token); + self.struct_span_err( + self.token.span, + format!("expected field pattern, found `{token_str}`"), + ) + .span_suggestion_verbose( + self.token.span, + "to omit remaining fields, use `..`", + "..", + Applicability::MachineApplicable, + ) + .emit(); } fn parse_pat_field(&mut self, lo: Span, attrs: AttrVec) -> PResult<'a, PatField> { diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 8b4f0ab8feb8..6846b00fb7d1 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -11,7 +11,6 @@ use rustc_ast::{ self as ast, BareFnTy, FnRetTy, GenericBound, GenericBounds, GenericParam, Generics, Lifetime, MacCall, MutTy, Mutability, PolyTraitRef, TraitBoundModifier, TraitObjectSyntax, Ty, TyKind, }; -use rustc_ast_pretty::pprust; use rustc_errors::{pluralize, struct_span_err, Applicability, PResult}; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym, Ident}; @@ -44,24 +43,17 @@ pub(super) enum AllowPlus { No, } -#[derive(PartialEq, Clone, Copy)] +#[derive(PartialEq)] pub(super) enum RecoverQPath { Yes, No, } -#[derive(PartialEq, Clone, Copy)] pub(super) enum RecoverQuestionMark { Yes, No, } -#[derive(PartialEq, Clone, Copy)] -pub(super) enum RecoverAnonEnum { - Yes, - No, -} - /// Signals whether parsing a type should recover `->`. /// /// More specifically, when parsing a function like: @@ -94,7 +86,7 @@ impl RecoverReturnSign { } // Is `...` (`CVarArgs`) legal at this level of type parsing? -#[derive(PartialEq, Clone, Copy)] +#[derive(PartialEq)] enum AllowCVariadic { Yes, No, @@ -119,7 +111,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::Yes, None, RecoverQuestionMark::Yes, - RecoverAnonEnum::No, ) } @@ -134,7 +125,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::Yes, Some(ty_params), RecoverQuestionMark::Yes, - RecoverAnonEnum::No, ) } @@ -149,7 +139,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::Yes, None, RecoverQuestionMark::Yes, - RecoverAnonEnum::Yes, ) } @@ -167,7 +156,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::Yes, None, RecoverQuestionMark::Yes, - RecoverAnonEnum::No, ) } @@ -181,7 +169,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::Yes, None, RecoverQuestionMark::No, - RecoverAnonEnum::No, ) } @@ -193,7 +180,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::Yes, None, RecoverQuestionMark::No, - RecoverAnonEnum::No, ) } @@ -206,7 +192,6 @@ impl<'a> Parser<'a> { RecoverReturnSign::OnlyFatArrow, None, RecoverQuestionMark::Yes, - RecoverAnonEnum::No, ) } @@ -226,7 +211,6 @@ impl<'a> Parser<'a> { recover_return_sign, None, RecoverQuestionMark::Yes, - RecoverAnonEnum::Yes, )?; FnRetTy::Ty(ty) } else if recover_return_sign.can_recover(&self.token.kind) { @@ -248,7 +232,6 @@ impl<'a> Parser<'a> { recover_return_sign, None, RecoverQuestionMark::Yes, - RecoverAnonEnum::Yes, )?; FnRetTy::Ty(ty) } else { @@ -264,7 +247,6 @@ impl<'a> Parser<'a> { recover_return_sign: RecoverReturnSign, ty_generics: Option<&Generics>, recover_question_mark: RecoverQuestionMark, - recover_anon_enum: RecoverAnonEnum, ) -> PResult<'a, P<Ty>> { let allow_qpath_recovery = recover_qpath == RecoverQPath::Yes; maybe_recover_from_interpolated_ty_qpath!(self, allow_qpath_recovery); @@ -348,50 +330,9 @@ impl<'a> Parser<'a> { AllowPlus::Yes => self.maybe_recover_from_bad_type_plus(&ty)?, AllowPlus::No => self.maybe_report_ambiguous_plus(impl_dyn_multi, &ty), } - if RecoverQuestionMark::Yes == recover_question_mark { + if let RecoverQuestionMark::Yes = recover_question_mark { ty = self.maybe_recover_from_question_mark(ty); } - if recover_anon_enum == RecoverAnonEnum::Yes - && self.check_noexpect(&token::BinOp(token::Or)) - && self.look_ahead(1, |t| t.can_begin_type()) - { - let mut pipes = vec![self.token.span]; - let mut types = vec![ty]; - loop { - if !self.eat(&token::BinOp(token::Or)) { - break; - } - pipes.push(self.prev_token.span); - types.push(self.parse_ty_common( - allow_plus, - allow_c_variadic, - recover_qpath, - recover_return_sign, - ty_generics, - recover_question_mark, - RecoverAnonEnum::No, - )?); - } - let mut err = self.struct_span_err(pipes, "anonymous enums are not supported"); - for ty in &types { - err.span_label(ty.span, ""); - } - err.help(&format!( - "create a named `enum` and use it here instead:\nenum Name {{\n{}\n}}", - types - .iter() - .enumerate() - .map(|(i, t)| format!( - " Variant{}({}),", - i + 1, // Lets not confuse people with zero-indexing :) - pprust::to_string(|s| s.print_type(&t)), - )) - .collect::<Vec<_>>() - .join("\n"), - )); - err.emit(); - return Ok(self.mk_ty(lo.to(self.prev_token.span), TyKind::Err)); - } if allow_qpath_recovery { self.maybe_recover_from_bad_qpath(ty) } else { Ok(ty) } } @@ -702,7 +643,7 @@ impl<'a> Parser<'a> { /// Is a `dyn B0 + ... + Bn` type allowed here? fn is_explicit_dyn_type(&mut self) -> bool { self.check_keyword(kw::Dyn) - && (!self.token.uninterpolated_span().rust_2015() + && (self.token.uninterpolated_span().rust_2018() || self.look_ahead(1, |t| { (t.can_begin_bound() || t.kind == TokenKind::BinOp(token::Star)) && !can_continue_type_after_non_fn_ident(t) diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 84421dc1f622..2fb62ce53ba6 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -265,7 +265,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { let ident = path.segments.get(0).expect("empty path in visibility").ident; let crate_root = if ident.is_path_segment_keyword() { None - } else if ident.span.rust_2015() { + } else if ident.span.is_rust_2015() { Some(Segment::from_ident(Ident::new( kw::PathRoot, path.span.shrink_to_lo().with_ctxt(ident.span.ctxt()), @@ -435,10 +435,10 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { // appears, so imports in braced groups can have roots prepended independently. let is_glob = matches!(use_tree.kind, ast::UseTreeKind::Glob); let crate_root = match prefix_iter.peek() { - Some(seg) if !seg.ident.is_path_segment_keyword() && seg.ident.span.rust_2015() => { + Some(seg) if !seg.ident.is_path_segment_keyword() && seg.ident.span.is_rust_2015() => { Some(seg.ident.span.ctxt()) } - None if is_glob && use_tree.span.rust_2015() => Some(use_tree.span.ctxt()), + None if is_glob && use_tree.span.is_rust_2015() => Some(use_tree.span.ctxt()), _ => None, } .map(|ctxt| { diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 3bf041cebcb8..a08ae0f184bb 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -462,7 +462,9 @@ impl<'a> Resolver<'a> { let first_name = match path.get(0) { // In the 2018 edition this lint is a hard error, so nothing to do - Some(seg) if seg.ident.span.rust_2015() && self.session.rust_2015() => seg.ident.name, + Some(seg) if seg.ident.span.is_rust_2015() && self.session.is_rust_2015() => { + seg.ident.name + } _ => return, }; @@ -1717,7 +1719,7 @@ impl<'a> Resolver<'a> { Applicability::MaybeIncorrect, )), ) - } else if self.session.rust_2015() { + } else if self.session.is_rust_2015() { ( format!("maybe a missing crate `{ident}`?"), Some(( @@ -1996,7 +1998,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { mut path: Vec<Segment>, parent_scope: &ParentScope<'b>, ) -> Option<(Vec<Segment>, Option<String>)> { - if path[1].ident.span.rust_2015() { + if path[1].ident.span.is_rust_2015() { return None; } diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 1c985d43658a..d03ccf256fad 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -85,7 +85,7 @@ impl<'a> Resolver<'a> { // 4c. Standard library prelude (de-facto closed, controlled). // 6. Language prelude: builtin attributes (closed, controlled). - let rust_2015 = ctxt.edition().rust_2015(); + let rust_2015 = ctxt.edition().is_rust_2015(); let (ns, macro_kind, is_absolute_path) = match scope_set { ScopeSet::All(ns, _) => (ns, None, false), ScopeSet::AbsolutePath(ns) => (ns, None, true), @@ -1397,7 +1397,8 @@ impl<'a> Resolver<'a> { module = Some(ModuleOrUniformRoot::ExternPrelude); continue; } - if name == kw::PathRoot && ident.span.rust_2015() && self.session.rust_2018() { + if name == kw::PathRoot && ident.span.is_rust_2015() && self.session.rust_2018() + { // `::a::b` from 2015 macro on 2018 global edition module = Some(ModuleOrUniformRoot::CrateRootAndExternPrelude); continue; diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 83932c089b31..3ca10ac50baa 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -2145,7 +2145,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { let segments = &use_tree.prefix.segments; if !segments.is_empty() { let ident = segments[0].ident; - if ident.is_path_segment_keyword() || ident.span.rust_2015() { + if ident.is_path_segment_keyword() || ident.span.is_rust_2015() { return; } diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 37beff37c1fb..cee0a7f3c203 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1343,7 +1343,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { "!", Applicability::MaybeIncorrect, ); - if path_str == "try" && span.rust_2015() { + if path_str == "try" && span.is_rust_2015() { err.note("if you want the `try` keyword, you need Rust 2018 or later"); } } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 746e0f169bcf..dbd419c1406f 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -919,8 +919,8 @@ impl Session { } /// Is this edition 2015? - pub fn rust_2015(&self) -> bool { - self.edition().rust_2015() + pub fn is_rust_2015(&self) -> bool { + self.edition().is_rust_2015() } /// Are we allowed to use features from the Rust 2018 edition? diff --git a/compiler/rustc_span/src/edition.rs b/compiler/rustc_span/src/edition.rs index e66ec0790434..f16db69aae23 100644 --- a/compiler/rustc_span/src/edition.rs +++ b/compiler/rustc_span/src/edition.rs @@ -77,7 +77,7 @@ impl Edition { } /// Is this edition 2015? - pub fn rust_2015(self) -> bool { + pub fn is_rust_2015(self) -> bool { self == Edition::Edition2015 } diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 006102a5f2fc..e095cf3fda20 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -705,8 +705,8 @@ impl Span { } #[inline] - pub fn rust_2015(self) -> bool { - self.edition().rust_2015() + pub fn is_rust_2015(self) -> bool { + self.edition().is_rust_2015() } #[inline] diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs index 0009972cf425..2b135b670348 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs @@ -2,7 +2,7 @@ use super::apple_base::{opts, Arch}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions}; pub fn target() -> Target { - let llvm_target = "arm64-apple-ios14.0-macabi"; + let llvm_target = "arm64-apple-ios-macabi"; let arch = Arch::Arm64_macabi; let mut base = opts("ios", arch); @@ -22,7 +22,7 @@ pub fn target() -> Target { // These arguments are not actually invoked - they just have // to look right to pass App Store validation. bitcode_llvm_cmdline: "-triple\0\ - arm64-apple-ios14.0-macabi\0\ + arm64-apple-ios-macabi\0\ -emit-obj\0\ -disable-llvm-passes\0\ -Os\0" diff --git a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs index 0f3f85199637..5a3e2a79bb9c 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs @@ -2,7 +2,7 @@ use super::apple_base::{opts, Arch}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { - let llvm_target = "x86_64-apple-ios13.0-macabi"; + let llvm_target = "x86_64-apple-ios-macabi"; let arch = Arch::X86_64_macabi; let mut base = opts("ios", arch); diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index dad27c66a3de..ee988090ca33 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -814,8 +814,11 @@ so that we can apply CSS-filters to change the arrow color in themes */ background-repeat: no-repeat; background-size: 20px; background-position: calc(100% - 2px) 56%; - /* image is black color */ - background-image: url("down-arrow-927217e04c7463ac.svg"); + /* down arrow (image is black color) */ + background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \ + width="128" height="128" viewBox="-30 -20 176 176"><path d="M111,40.5L64,87.499L17,40.5" \ + fill="none" stroke="black" strike-linecap="square" stroke-miterlimit="10" stroke-width="12"/> \ + </svg>'); /* changes the arrow image color */ filter: var(--crate-search-div-filter); } @@ -1444,7 +1447,10 @@ details.toggle > summary.hideme > span { } details.toggle > summary::before { - background: url("toggle-plus-1092eb4930d581b0.svg") no-repeat top left; + /* toggle plus */ + background: url('data:image/svg+xml,<svg width="17" height="17" \ +shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \ +d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7M8.5 12V8.625v0V5"/></svg>') no-repeat top left; content: ""; cursor: pointer; width: 16px; @@ -1522,7 +1528,10 @@ details.toggle[open] > summary.hideme > span { } details.toggle[open] > summary::before { - background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left; + /* toggle minus */ + background: url('data:image/svg+xml,<svg width="17" height="17" \ +shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \ +d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7"/></svg>') no-repeat top left; } details.toggle[open] > summary::after { diff --git a/src/librustdoc/html/static/images/down-arrow.svg b/src/librustdoc/html/static/images/down-arrow.svg deleted file mode 100644 index 5d76a64e92c7..000000000000 --- a/src/librustdoc/html/static/images/down-arrow.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" width="128" height="128" enable-background="new 0 0 128 128" version="1.1" viewBox="-30 -20 176 176" xml:space="preserve"><g><line x1="111" x2="64" y1="40.5" y2="87.499" fill="none" stroke="#000000" stroke-linecap="square" stroke-miterlimit="10" stroke-width="12"/><line x1="64" x2="17" y1="87.499" y2="40.5" fill="none" stroke="#000000" stroke-linecap="square" stroke-miterlimit="10" stroke-width="12"/></g></svg> \ No newline at end of file diff --git a/src/librustdoc/html/static/images/toggle-minus.svg b/src/librustdoc/html/static/images/toggle-minus.svg deleted file mode 100644 index 73154788a0e8..000000000000 --- a/src/librustdoc/html/static/images/toggle-minus.svg +++ /dev/null @@ -1 +0,0 @@ -<svg width="17" height="17" shape-rendering="crispEdges" stroke="#000" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7"/></svg> \ No newline at end of file diff --git a/src/librustdoc/html/static/images/toggle-plus.svg b/src/librustdoc/html/static/images/toggle-plus.svg deleted file mode 100644 index 08b17033e164..000000000000 --- a/src/librustdoc/html/static/images/toggle-plus.svg +++ /dev/null @@ -1 +0,0 @@ -<svg width="17" height="17" shape-rendering="crispEdges" stroke="#000" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7M8.5 12V8.625v0V5"/></svg> \ No newline at end of file diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs index b48b82307ebc..767b974cc910 100644 --- a/src/librustdoc/html/static_files.rs +++ b/src/librustdoc/html/static_files.rs @@ -102,9 +102,6 @@ static_files! { scrape_examples_js => "static/js/scrape-examples.js", wheel_svg => "static/images/wheel.svg", clipboard_svg => "static/images/clipboard.svg", - down_arrow_svg => "static/images/down-arrow.svg", - toggle_minus_png => "static/images/toggle-minus.svg", - toggle_plus_png => "static/images/toggle-plus.svg", copyright => "static/COPYRIGHT.txt", license_apache => "static/LICENSE-APACHE.txt", license_mit => "static/LICENSE-MIT.txt", diff --git a/tests/ui/async-await/dont-suggest-missing-await.stderr b/tests/ui/async-await/dont-suggest-missing-await.stderr index 627bf05bba2d..8e2d42c8f138 100644 --- a/tests/ui/async-await/dont-suggest-missing-await.stderr +++ b/tests/ui/async-await/dont-suggest-missing-await.stderr @@ -6,11 +6,6 @@ LL | take_u32(x) | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/dont-suggest-missing-await.rs:7:24 - | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `u32` found opaque type `impl Future<Output = u32>` note: function defined here diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr index 963c6ba57adf..9fdb1ce47d7b 100644 --- a/tests/ui/async-await/generator-desc.stderr +++ b/tests/ui/async-await/generator-desc.stderr @@ -21,16 +21,6 @@ LL | fun(one(), two()); | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/generator-desc.rs:5:16 - | -LL | async fn one() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/generator-desc.rs:6:16 - | -LL | async fn two() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>) found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>) = help: consider `await`ing on both `Future`s diff --git a/tests/ui/async-await/issue-61076.rs b/tests/ui/async-await/issue-61076.rs index 3cde5cca3c3c..9c4acbe0a5bf 100644 --- a/tests/ui/async-await/issue-61076.rs +++ b/tests/ui/async-await/issue-61076.rs @@ -54,9 +54,6 @@ async fn struct_() -> Struct { } async fn tuple() -> Tuple { - //~^ NOTE checked the `Output` of this `async fn`, expected opaque type - //~| NOTE while checking the return type of the `async fn` - //~| NOTE in this expansion of desugaring of `async` block or function Tuple(1i32) } diff --git a/tests/ui/async-await/issue-61076.stderr b/tests/ui/async-await/issue-61076.stderr index 5a7316edd01f..b25b29bf50c1 100644 --- a/tests/ui/async-await/issue-61076.stderr +++ b/tests/ui/async-await/issue-61076.stderr @@ -11,7 +11,7 @@ LL | foo().await?; | ++++++ error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/issue-61076.rs:65:5 + --> $DIR/issue-61076.rs:62:5 | LL | t?; | ^^ the `?` operator cannot be applied to type `T` @@ -23,7 +23,7 @@ LL | t.await?; | ++++++ error[E0609]: no field `0` on type `impl Future<Output = Tuple>` - --> $DIR/issue-61076.rs:74:26 + --> $DIR/issue-61076.rs:71:26 | LL | let _: i32 = tuple().0; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -34,7 +34,7 @@ LL | let _: i32 = tuple().await.0; | ++++++ error[E0609]: no field `a` on type `impl Future<Output = Struct>` - --> $DIR/issue-61076.rs:78:28 + --> $DIR/issue-61076.rs:75:28 | LL | let _: i32 = struct_().a; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -45,7 +45,7 @@ LL | let _: i32 = struct_().await.a; | ++++++ error[E0599]: no method named `method` found for opaque type `impl Future<Output = Struct>` in the current scope - --> $DIR/issue-61076.rs:82:15 + --> $DIR/issue-61076.rs:79:15 | LL | struct_().method(); | ^^^^^^ method not found in `impl Future<Output = Struct>` @@ -56,7 +56,7 @@ LL | struct_().await.method(); | ++++++ error[E0308]: mismatched types - --> $DIR/issue-61076.rs:91:9 + --> $DIR/issue-61076.rs:88:9 | LL | match tuple() { | ------- this expression has type `impl Future<Output = Tuple>` @@ -64,11 +64,6 @@ LL | LL | Tuple(_) => {} | ^^^^^^^^ expected opaque type, found `Tuple` | -note: while checking the return type of the `async fn` - --> $DIR/issue-61076.rs:56:21 - | -LL | async fn tuple() -> Tuple { - | ^^^^^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future<Output = Tuple>` found struct `Tuple` help: consider `await`ing on the `Future` diff --git a/tests/ui/async-await/issue-98634.stderr b/tests/ui/async-await/issue-98634.stderr index 08ea5bdc574f..4c5dfeed9ba5 100644 --- a/tests/ui/async-await/issue-98634.stderr +++ b/tests/ui/async-await/issue-98634.stderr @@ -4,11 +4,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu LL | StructAsync { callback }.await; | ^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>` found opaque type `impl Future<Output = ()>` note: required by a bound in `StructAsync` @@ -23,11 +18,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu LL | StructAsync { callback }.await; | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>` found opaque type `impl Future<Output = ()>` note: required by a bound in `StructAsync` @@ -42,11 +32,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu LL | StructAsync { callback }.await; | ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>` found opaque type `impl Future<Output = ()>` note: required by a bound in `StructAsync` diff --git a/tests/ui/async-await/issues/issue-102206.stderr b/tests/ui/async-await/issues/issue-102206.stderr index eef711910a1a..ebb80f6e07e7 100644 --- a/tests/ui/async-await/issues/issue-102206.stderr +++ b/tests/ui/async-await/issues/issue-102206.stderr @@ -8,11 +8,6 @@ LL | std::mem::size_of_val(foo()); | | help: consider borrowing here: `&foo()` | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/issue-102206.rs:3:16 - | -LL | async fn foo() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected reference `&_` found opaque type `impl Future<Output = ()>` note: function defined here diff --git a/tests/ui/async-await/suggest-missing-await-closure.stderr b/tests/ui/async-await/suggest-missing-await-closure.stderr index a5958baffbaf..e47325cb4aea 100644 --- a/tests/ui/async-await/suggest-missing-await-closure.stderr +++ b/tests/ui/async-await/suggest-missing-await-closure.stderr @@ -6,11 +6,6 @@ LL | take_u32(x) | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await-closure.rs:8:24 - | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `u32` found opaque type `impl Future<Output = u32>` note: function defined here diff --git a/tests/ui/async-await/suggest-missing-await.stderr b/tests/ui/async-await/suggest-missing-await.stderr index 2db0666f1ae6..4ed0272ac1a1 100644 --- a/tests/ui/async-await/suggest-missing-await.stderr +++ b/tests/ui/async-await/suggest-missing-await.stderr @@ -6,11 +6,6 @@ LL | take_u32(x) | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:5:24 - | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `u32` found opaque type `impl Future<Output = u32>` note: function defined here @@ -29,11 +24,6 @@ error[E0308]: mismatched types LL | dummy() | ^^^^^^^ expected `()`, found opaque type | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected unit type `()` found opaque type `impl Future<Output = ()>` help: consider `await`ing on the `Future` @@ -60,11 +50,6 @@ LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future<Output = ()>` found unit type `()` help: consider `await`ing on the `Future` @@ -87,11 +72,6 @@ LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future<Output = ()>` found unit type `()` help: consider `await`ing on the `Future` @@ -108,11 +88,6 @@ LL | let _x = match dummy() { LL | () => {} | ^^ expected opaque type, found `()` | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future<Output = ()>` found unit type `()` help: consider `await`ing on the `Future` @@ -129,11 +104,6 @@ LL | match dummy_result() { LL | Ok(_) => {} | ^^^^^ expected opaque type, found `Result<_, _>` | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:57:28 - | -LL | async fn dummy_result() -> Result<(), ()> { - | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future<Output = Result<(), ()>>` found enum `Result<_, _>` help: consider `await`ing on the `Future` @@ -150,11 +120,6 @@ LL | match dummy_result() { LL | Err(_) => {} | ^^^^^^ expected opaque type, found `Result<_, _>` | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:57:28 - | -LL | async fn dummy_result() -> Result<(), ()> { - | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future<Output = Result<(), ()>>` found enum `Result<_, _>` help: consider `await`ing on the `Future` diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout index b4874cef134f..8e238a509d2f 100644 --- a/tests/ui/deriving/deriving-all-codegen.stdout +++ b/tests/ui/deriving/deriving-all-codegen.stdout @@ -209,7 +209,7 @@ impl ::core::marker::StructuralPartialEq for PackedPoint { } impl ::core::cmp::PartialEq for PackedPoint { #[inline] fn eq(&self, other: &PackedPoint) -> bool { - { self.x } == { other.x } && { self.y } == { other.y } + ({ self.x }) == ({ other.x }) && ({ self.y }) == ({ other.y }) } } #[automatically_derived] @@ -718,8 +718,8 @@ impl<T: ::core::cmp::PartialEq + ::core::marker::Copy + Trait, ::core::marker::Copy { #[inline] fn eq(&self, other: &PackedGeneric<T, U>) -> bool { - { self.0 } == { other.0 } && { self.1 } == { other.1 } && - { self.2 } == { other.2 } + ({ self.0 }) == ({ other.0 }) && ({ self.1 }) == ({ other.1 }) && + ({ self.2 }) == ({ other.2 }) } } #[automatically_derived] diff --git a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr index bfe1ed32859b..589b2c378492 100644 --- a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr +++ b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr @@ -2,7 +2,12 @@ error: expected field pattern, found `...` --> $DIR/issue-46718-struct-pattern-dotdotdot.rs:11:55 | LL | PersonalityInventory { expressivity: exp, ... } => exp - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + | ^^^ + | +help: to omit remaining fields, use `..` + | +LL | PersonalityInventory { expressivity: exp, .. } => exp + | ~~ error: aborting due to previous error diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs index 7ba2b6d857cd..30173b1b4be0 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs @@ -2,7 +2,8 @@ fn main() { let x = 42; match x { 0..=73 => {}, - 74..=> {}, //~ ERROR unexpected `=>` after open range - //~^ ERROR expected one of `=>`, `if`, or `|`, found `>` + 74..=> {}, + //~^ ERROR unexpected `>` after inclusive range + //~| NOTE this is parsed as an inclusive range `..=` } } diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr index 9ba6d15113cd..cb7f998df7a5 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr @@ -1,19 +1,15 @@ -error: unexpected `=>` after open range - --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:11 +error: unexpected `>` after inclusive range + --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14 | LL | 74..=> {}, - | ^^^ + | ---^ + | | + | this is parsed as an inclusive range `..=` | help: add a space between the pattern and `=>` | LL | 74.. => {}, | + -error: expected one of `=>`, `if`, or `|`, found `>` - --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14 - | -LL | 74..=> {}, - | ^ expected one of `=>`, `if`, or `|` - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.stderr index 4dfd772222e5..3ec62020e6c8 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.stderr @@ -24,16 +24,6 @@ LL | async fn owo(_: u8) {} | expected `()`, found `u8` | help: change the parameter type to match the trait: `()` | -note: while checking the return type of the `async fn` - --> $DIR/method-signature-matches.rs:20:25 - | -LL | async fn owo(_: u8) {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/method-signature-matches.rs:20:25 - | -LL | async fn owo(_: u8) {} - | ^ checked the `Output` of this `async fn`, found opaque type note: type in trait --> $DIR/method-signature-matches.rs:16:21 | diff --git a/tests/ui/impl-trait/issue-102605.stderr b/tests/ui/impl-trait/issue-102605.stderr index 6cf0c33ad919..8ff08968008b 100644 --- a/tests/ui/impl-trait/issue-102605.stderr +++ b/tests/ui/impl-trait/issue-102605.stderr @@ -6,11 +6,6 @@ LL | convert_result(foo()) | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/issue-102605.rs:3:19 - | -LL | async fn foo() -> Result<(), String> { - | ^^^^^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected enum `Result<(), _>` found opaque type `impl Future<Output = Result<(), String>>` note: function defined here diff --git a/tests/ui/impl-trait/issue-99914.stderr b/tests/ui/impl-trait/issue-99914.stderr index 3b4e130fdebd..a4b7fc1f5bc7 100644 --- a/tests/ui/impl-trait/issue-99914.stderr +++ b/tests/ui/impl-trait/issue-99914.stderr @@ -4,11 +4,6 @@ error[E0308]: mismatched types LL | t.and_then(|t| -> _ { bar(t) }); | ^^^^^^ expected `Result<_, Error>`, found opaque type | -note: while checking the return type of the `async fn` - --> $DIR/issue-99914.rs:13:23 - | -LL | async fn bar(t: Okay) {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected enum `Result<_, Error>` found opaque type `impl Future<Output = ()>` help: try wrapping the expression in `Ok` diff --git a/tests/ui/parser/anon-enums-are-ambiguous.rs b/tests/ui/parser/anon-enums-are-ambiguous.rs new file mode 100644 index 000000000000..b0173cf98e0a --- /dev/null +++ b/tests/ui/parser/anon-enums-are-ambiguous.rs @@ -0,0 +1,26 @@ +// check-pass + +macro_rules! test_expr { + ($expr:expr) => {}; +} + +macro_rules! test_ty { + ($a:ty | $b:ty) => {}; +} + +fn main() { + test_expr!(a as fn() -> B | C); + // Do not break the `|` operator. + + test_expr!(|_: fn() -> B| C | D); + // Do not break `-> Ret` in closure args. + + test_ty!(A | B); + // We can't support anon enums in arbitrary positions. + + test_ty!(fn() -> A | B); + // Don't break fn ptrs. + + test_ty!(impl Fn() -> A | B); + // Don't break parenthesized generics. +} diff --git a/tests/ui/parser/anon-enums.rs b/tests/ui/parser/anon-enums.rs deleted file mode 100644 index 56b8a3d43bed..000000000000 --- a/tests/ui/parser/anon-enums.rs +++ /dev/null @@ -1,17 +0,0 @@ -fn foo(x: bool | i32) -> i32 | f64 { -//~^ ERROR anonymous enums are not supported -//~| ERROR anonymous enums are not supported - match x { - x: i32 => x, //~ ERROR expected - true => 42., - false => 0.333, - } -} - -fn main() { - match foo(true) { - 42: i32 => (), //~ ERROR expected - _: f64 => (), //~ ERROR expected - x: i32 => (), //~ ERROR expected - } -} diff --git a/tests/ui/parser/anon-enums.stderr b/tests/ui/parser/anon-enums.stderr deleted file mode 100644 index 841582256609..000000000000 --- a/tests/ui/parser/anon-enums.stderr +++ /dev/null @@ -1,68 +0,0 @@ -error: anonymous enums are not supported - --> $DIR/anon-enums.rs:1:16 - | -LL | fn foo(x: bool | i32) -> i32 | f64 { - | ---- ^ --- - | - = help: create a named `enum` and use it here instead: - enum Name { - Variant1(bool), - Variant2(i32), - } - -error: anonymous enums are not supported - --> $DIR/anon-enums.rs:1:30 - | -LL | fn foo(x: bool | i32) -> i32 | f64 { - | --- ^ --- - | - = help: create a named `enum` and use it here instead: - enum Name { - Variant1(i32), - Variant2(f64), - } - -error: expected one of `@` or `|`, found `:` - --> $DIR/anon-enums.rs:5:10 - | -LL | x: i32 => x, - | ^ --- specifying the type of a pattern isn't supported - | | - | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | x::i32 => x, - | ~~ - -error: expected one of `...`, `..=`, `..`, or `|`, found `:` - --> $DIR/anon-enums.rs:13:11 - | -LL | 42: i32 => (), - | ^ --- specifying the type of a pattern isn't supported - | | - | expected one of `...`, `..=`, `..`, or `|` - -error: expected `|`, found `:` - --> $DIR/anon-enums.rs:14:10 - | -LL | _: f64 => (), - | ^ --- specifying the type of a pattern isn't supported - | | - | expected `|` - -error: expected one of `@` or `|`, found `:` - --> $DIR/anon-enums.rs:15:10 - | -LL | x: i32 => (), - | ^ --- specifying the type of a pattern isn't supported - | | - | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | x::i32 => (), - | ~~ - -error: aborting due to 6 previous errors - diff --git a/tests/ui/parser/fake-anon-enums-in-macros.rs b/tests/ui/parser/fake-anon-enums-in-macros.rs deleted file mode 100644 index 38fe8dee2382..000000000000 --- a/tests/ui/parser/fake-anon-enums-in-macros.rs +++ /dev/null @@ -1,20 +0,0 @@ -// build-pass -macro_rules! check_ty { - ($Z:ty) => { compile_error!("triggered"); }; - ($X:ty | $Y:ty) => { $X }; -} - -macro_rules! check { - ($Z:ty) => { compile_error!("triggered"); }; - ($X:ty | $Y:ty) => { }; -} - -check! { i32 | u8 } - -fn foo(x: check_ty! { i32 | u8 }) -> check_ty! { i32 | u8 } { - x -} -fn main() { - let x: check_ty! { i32 | u8 } = 42; - let _: check_ty! { i32 | u8 } = foo(x); -} diff --git a/tests/ui/parser/issue-102806.stderr b/tests/ui/parser/issue-102806.stderr index 6872b8bc0afe..ba8174a823b2 100644 --- a/tests/ui/parser/issue-102806.stderr +++ b/tests/ui/parser/issue-102806.stderr @@ -32,7 +32,12 @@ error: expected field pattern, found `...` --> $DIR/issue-102806.rs:21:22 | LL | let V3 { z: val, ... } = v; - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + | ^^^ + | +help: to omit remaining fields, use `..` + | +LL | let V3 { z: val, .. } = v; + | ~~ error[E0063]: missing fields `x` and `y` in initializer of `V3` --> $DIR/issue-102806.rs:17:13 diff --git a/tests/ui/parser/issues/issue-63135.stderr b/tests/ui/parser/issues/issue-63135.stderr index 80e9ac5bedf1..e0dc356d5467 100644 --- a/tests/ui/parser/issues/issue-63135.stderr +++ b/tests/ui/parser/issues/issue-63135.stderr @@ -20,7 +20,12 @@ error: expected field pattern, found `...` --> $DIR/issue-63135.rs:3:8 | LL | fn i(n{...,f # - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + | ^^^ + | +help: to omit remaining fields, use `..` + | +LL | fn i(n{..,f # + | ~~ error: expected `}`, found `,` --> $DIR/issue-63135.rs:3:11 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.rs b/tests/ui/parser/issues/issue-87086-colon-path-sep.rs index e1ea38f2795d..0b7b67496d6f 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.rs +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.rs @@ -68,6 +68,7 @@ fn main() { Foo:Bar::Baz => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here + //~| ERROR: failed to resolve: `Bar` is a variant, not a module } match myfoo { Foo::Bar => {} diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index 63b072ac4cdc..2050a16beb34 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -2,118 +2,89 @@ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:17:12 | LL | Foo:Bar => {} - | ^--- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | Foo::Bar => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 | LL | qux::Foo:Bar => {} - | ^--- specifying the type of a pattern isn't supported + | ^ | | | expected one of 8 possible tokens - | -help: maybe write a path separator here - | -LL | qux::Foo::Bar => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 | LL | qux:Foo::Baz => {} - | ^-------- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | qux::Foo::Baz => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 | LL | qux: Foo::Baz if true => {} - | ^ -------- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | qux::Foo::Baz if true => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 | LL | if let Foo:Bar = f() { - | ^--- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | if let Foo::Bar = f() { - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:48:16 | LL | ref qux: Foo::Baz => {} - | ^ -------- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | ref qux::Foo::Baz => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:57:16 | LL | mut qux: Foo::Baz => {} - | ^ -------- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | mut qux::Foo::Baz => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:68:12 | LL | Foo:Bar::Baz => {} - | ^-------- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` - | -help: maybe write a path separator here - | -LL | Foo::Bar::Baz => {} - | ~~ + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:74:12 + --> $DIR/issue-87086-colon-path-sep.rs:75:12 | LL | Foo:Bar => {} - | ^--- specifying the type of a pattern isn't supported + | ^ | | | expected one of `@` or `|` + | help: maybe write a path separator here: `::` + +error[E0433]: failed to resolve: `Bar` is a variant, not a module + --> $DIR/issue-87086-colon-path-sep.rs:68:13 | -help: maybe write a path separator here - | -LL | Foo::Bar => {} - | ~~ +LL | Foo:Bar::Baz => {} + | ^^^ `Bar` is a variant, not a module -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/proc-macro/crt-static.rs b/tests/ui/proc-macro/crt-static.rs index 6103acb7b6bd..020128fa2144 100644 --- a/tests/ui/proc-macro/crt-static.rs +++ b/tests/ui/proc-macro/crt-static.rs @@ -5,6 +5,9 @@ // ignore-wasm32 // ignore-sgx no support for proc-macro crate type // build-pass +// force-host +// no-prefer-dynamic + #![crate_type = "proc-macro"] // FIXME: This don't work when crate-type is specified by attribute diff --git a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs index c30b8a1e1f1a..b569993c6143 100644 --- a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs +++ b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs @@ -7,6 +7,5 @@ fn main() { let foo = Some(Foo::Other); if let Some(Foo::Bar {_}) = foo {} - //~^ ERROR expected identifier, found reserved identifier `_` - //~| ERROR pattern does not mention field `bar` [E0027] + //~^ ERROR expected field pattern, found `_` } diff --git a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr index 16f751444a55..2f3a150e5cba 100644 --- a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr +++ b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr @@ -1,24 +1,13 @@ -error: expected identifier, found reserved identifier `_` +error: expected field pattern, found `_` --> $DIR/struct-enum-ignoring-field-with-underscore.rs:9:27 | LL | if let Some(Foo::Bar {_}) = foo {} - | ^ expected identifier, found reserved identifier - -error[E0027]: pattern does not mention field `bar` - --> $DIR/struct-enum-ignoring-field-with-underscore.rs:9:17 - | -LL | if let Some(Foo::Bar {_}) = foo {} - | ^^^^^^^^^^^^ missing field `bar` - | -help: include the missing field in the pattern + | ^ | -LL | if let Some(Foo::Bar {_, bar }) = foo {} - | ~~~~~~~ -help: if you don't care about this missing field, you can explicitly ignore it +help: to omit remaining fields, use `..` | -LL | if let Some(Foo::Bar {_, .. }) = foo {} - | ~~~~~~ +LL | if let Some(Foo::Bar {..}) = foo {} + | ~~ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0027`. diff --git a/tests/ui/suggestions/if-then-neeing-semi.rs b/tests/ui/suggestions/if-then-neeing-semi.rs index b487f013d270..7be4312bfbac 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.rs +++ b/tests/ui/suggestions/if-then-neeing-semi.rs @@ -15,18 +15,9 @@ fn extra_semicolon() { }; } -async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE checked the `Output` of this `async fn`, expected opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function +async fn async_dummy() {} + +async fn async_dummy2() {} async fn async_extra_semicolon_same() { let _ = if true { diff --git a/tests/ui/suggestions/if-then-neeing-semi.stderr b/tests/ui/suggestions/if-then-neeing-semi.stderr index d7c5818abbd5..567deb405fcc 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.stderr +++ b/tests/ui/suggestions/if-then-neeing-semi.stderr @@ -1,5 +1,5 @@ error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:37:9 + --> $DIR/if-then-neeing-semi.rs:28:9 | LL | let _ = if true { | _____________- @@ -15,11 +15,6 @@ LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:18:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected unit type `()` found opaque type `impl Future<Output = ()>` help: consider `await`ing on the `Future` @@ -33,7 +28,7 @@ LL + async_dummy() | error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:50:9 + --> $DIR/if-then-neeing-semi.rs:41:9 | LL | let _ = if true { | _____________- @@ -49,11 +44,6 @@ LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:24:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected unit type `()` found opaque type `impl Future<Output = ()>` help: consider `await`ing on the `Future` @@ -69,7 +59,7 @@ LL ~ Box::new(async_dummy2()) | error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:63:9 + --> $DIR/if-then-neeing-semi.rs:54:9 | LL | let _ = if true { | _____________- @@ -85,18 +75,8 @@ LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:18:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:24:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:18:24>) - found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:24:25>) + found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:20:25>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/issue-81839.stderr b/tests/ui/suggestions/issue-81839.stderr index fae474cedb88..4af7cc9f8ec8 100644 --- a/tests/ui/suggestions/issue-81839.stderr +++ b/tests/ui/suggestions/issue-81839.stderr @@ -14,11 +14,6 @@ LL | | _ => cx.answer_str("hi"), LL | | } | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/auxiliary/issue-81839.rs:6:49 - | -LL | pub async fn answer_str(&self, _s: &str) -> Test { - | ^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected unit type `()` found opaque type `impl Future<Output = Test>` diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.rs b/tests/ui/suggestions/match-prev-arm-needing-semi.rs index 8c8abe047c2a..3f863cb104e0 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.rs +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.rs @@ -13,18 +13,9 @@ fn extra_semicolon() { }; } -async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE checked the `Output` of this `async fn`, expected opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function +async fn async_dummy() {} + +async fn async_dummy2() {} async fn async_extra_semicolon_same() { let _ = match true { //~ NOTE `match` arms have incompatible types diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr index 8d735b71f827..df18c7b0b23c 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -1,5 +1,5 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:35:18 + --> $DIR/match-prev-arm-needing-semi.rs:26:18 | LL | let _ = match true { | _____________- @@ -15,11 +15,6 @@ LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:16:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected unit type `()` found opaque type `impl Future<Output = ()>` help: consider `await`ing on the `Future` @@ -33,7 +28,7 @@ LL + async_dummy() | error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:48:18 + --> $DIR/match-prev-arm-needing-semi.rs:39:18 | LL | let _ = match true { | _____________- @@ -49,11 +44,6 @@ LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:22:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected unit type `()` found opaque type `impl Future<Output = ()>` help: consider `await`ing on the `Future` @@ -69,7 +59,7 @@ LL ~ false => Box::new(async_dummy2()), | error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:59:18 + --> $DIR/match-prev-arm-needing-semi.rs:50:18 | LL | let _ = match true { | _____________- @@ -83,18 +73,8 @@ LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:16:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:22:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>) - found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:22:25>) + found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:18:25>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/type-alias-impl-trait/issue-98604.stderr b/tests/ui/type-alias-impl-trait/issue-98604.stderr index c5a4b5217d7a..bb9dd2365ea0 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98604.stderr @@ -4,11 +4,6 @@ error[E0271]: expected `test` to be a fn item that returns `Pin<Box<dyn Future<O LL | Box::new(test) as AsyncFnPtr; | ^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type | -note: while checking the return type of the `async fn` - --> $DIR/issue-98604.rs:5:17 - | -LL | async fn test() {} - | ^ checked the `Output` of this `async fn`, found opaque type = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>` found opaque type `impl Future<Output = ()>` = note: required for the cast from `fn() -> impl Future<Output = ()> {test}` to the object type `dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>>`