From 3b1c95d20757ecbf9197f3e10dc1e06103c4d12d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 30 Aug 2022 16:51:29 -0700 Subject: [PATCH 1/4] [beta] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index ded089921b138..4bcb3c65e440a 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit ded089921b138fb0c3dcfb9f0645c237bdc6c5c0 +Subproject commit 4bcb3c65e440a12044092b85ffea8fac6cb96f42 From b4b39cd970a0ea74eac944b9439e47fbd3b8c4c7 Mon Sep 17 00:00:00 2001 From: bors Date: Sat, 6 Aug 2022 12:29:11 +0000 Subject: [PATCH 2/4] Auto merge of #99893 - compiler-errors:issue-99387, r=davidtwco Delay formatting trimmed path until lint/error is emitted Fixes #99387 r? `@davidtwco` --- compiler/rustc_errors/src/diagnostic.rs | 20 ++++++++++++++++++++ compiler/rustc_errors/src/lib.rs | 4 ++-- compiler/rustc_privacy/src/errors.rs | 11 ++++++----- compiler/rustc_privacy/src/lib.rs | 19 ++++++++----------- src/test/ui/lint/issue-99387.rs | 24 ++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 src/test/ui/lint/issue-99387.rs diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 2a4f609a2d8a4..17e6c9e9575fd 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -40,6 +40,26 @@ pub trait IntoDiagnosticArg { fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>; } +pub struct DiagnosticArgFromDisplay<'a>(pub &'a dyn fmt::Display); + +impl IntoDiagnosticArg for DiagnosticArgFromDisplay<'_> { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + self.0.to_string().into_diagnostic_arg() + } +} + +impl<'a> From<&'a dyn fmt::Display> for DiagnosticArgFromDisplay<'a> { + fn from(t: &'a dyn fmt::Display) -> Self { + DiagnosticArgFromDisplay(t) + } +} + +impl<'a, T: fmt::Display> From<&'a T> for DiagnosticArgFromDisplay<'a> { + fn from(t: &'a T) -> Self { + DiagnosticArgFromDisplay(t) + } +} + macro_rules! into_diagnostic_arg_using_display { ($( $ty:ty ),+ $(,)?) => { $( diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index d7fad8fb9ee63..2409c0b5a7894 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -371,8 +371,8 @@ impl fmt::Display for ExplicitBug { impl error::Error for ExplicitBug {} pub use diagnostic::{ - AddSubdiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgValue, DiagnosticId, - DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic, + AddSubdiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgFromDisplay, + DiagnosticArgValue, DiagnosticId, DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic, }; pub use diagnostic_builder::{DiagnosticBuilder, EmissionGuarantee, LintDiagnosticBuilder}; use std::backtrace::Backtrace; diff --git a/compiler/rustc_privacy/src/errors.rs b/compiler/rustc_privacy/src/errors.rs index b0fac91f6ebc3..aca7d770f3495 100644 --- a/compiler/rustc_privacy/src/errors.rs +++ b/compiler/rustc_privacy/src/errors.rs @@ -1,3 +1,4 @@ +use rustc_errors::DiagnosticArgFromDisplay; use rustc_macros::{LintDiagnostic, SessionDiagnostic, SessionSubdiagnostic}; use rustc_span::{Span, Symbol}; @@ -35,7 +36,7 @@ pub struct ItemIsPrivate<'a> { #[label] pub span: Span, pub kind: &'a str, - pub descr: String, + pub descr: DiagnosticArgFromDisplay<'a>, } #[derive(SessionDiagnostic)] @@ -55,7 +56,7 @@ pub struct InPublicInterfaceTraits<'a> { pub span: Span, pub vis_descr: &'static str, pub kind: &'a str, - pub descr: String, + pub descr: DiagnosticArgFromDisplay<'a>, #[label(privacy::visibility_label)] pub vis_span: Span, } @@ -69,7 +70,7 @@ pub struct InPublicInterface<'a> { pub span: Span, pub vis_descr: &'static str, pub kind: &'a str, - pub descr: String, + pub descr: DiagnosticArgFromDisplay<'a>, #[label(privacy::visibility_label)] pub vis_span: Span, } @@ -78,7 +79,7 @@ pub struct InPublicInterface<'a> { #[lint(privacy::from_private_dep_in_public_interface)] pub struct FromPrivateDependencyInPublicInterface<'a> { pub kind: &'a str, - pub descr: String, + pub descr: DiagnosticArgFromDisplay<'a>, pub krate: Symbol, } @@ -87,5 +88,5 @@ pub struct FromPrivateDependencyInPublicInterface<'a> { pub struct PrivateInPublicLint<'a> { pub vis_descr: &'static str, pub kind: &'a str, - pub descr: String, + pub descr: DiagnosticArgFromDisplay<'a>, } diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 7d4ee832974dc..c28d0569d4ce9 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1079,11 +1079,7 @@ impl<'tcx> TypePrivacyVisitor<'tcx> { fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { let is_error = !self.item_is_accessible(def_id); if is_error { - self.tcx.sess.emit_err(ItemIsPrivate { - span: self.span, - kind, - descr: descr.to_string(), - }); + self.tcx.sess.emit_err(ItemIsPrivate { span: self.span, kind, descr: descr.into() }); } is_error } @@ -1255,7 +1251,9 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> { }; let kind = kind.descr(def_id); let _ = match name { - Some(name) => sess.emit_err(ItemIsPrivate { span, kind, descr: name }), + Some(name) => { + sess.emit_err(ItemIsPrivate { span, kind, descr: (&name).into() }) + } None => sess.emit_err(UnnamedItemIsPrivate { span, kind }), }; return; @@ -1723,7 +1721,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { self.tcx.def_span(self.item_def_id.to_def_id()), FromPrivateDependencyInPublicInterface { kind, - descr: descr.to_string(), + descr: descr.into(), krate: self.tcx.crate_name(def_id.krate), }, ); @@ -1750,7 +1748,6 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { } }; let span = self.tcx.def_span(self.item_def_id.to_def_id()); - let descr = descr.to_string(); if self.has_old_errors || self.in_assoc_ty || self.tcx.resolutions(()).has_pub_restricted @@ -1761,7 +1758,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { span, vis_descr, kind, - descr, + descr: descr.into(), vis_span, }); } else { @@ -1769,7 +1766,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { span, vis_descr, kind, - descr, + descr: descr.into(), vis_span, }); } @@ -1778,7 +1775,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> { lint::builtin::PRIVATE_IN_PUBLIC, hir_id, span, - PrivateInPublicLint { vis_descr, kind, descr }, + PrivateInPublicLint { vis_descr, kind, descr: descr.into() }, ); } } diff --git a/src/test/ui/lint/issue-99387.rs b/src/test/ui/lint/issue-99387.rs new file mode 100644 index 0000000000000..616eb935e93d4 --- /dev/null +++ b/src/test/ui/lint/issue-99387.rs @@ -0,0 +1,24 @@ +// check-pass + +#![feature(type_alias_impl_trait)] +#![allow(private_in_public)] + +pub type Successors<'a> = impl Iterator; + +pub fn f<'a>() -> Successors<'a> { + None.into_iter() +} + +trait Tr { + type Item; +} + +impl<'a> Tr for &'a () { + type Item = Successors<'a>; +} + +pub fn ohno<'a>() -> <&'a () as Tr>::Item { + None.into_iter() +} + +fn main() {} From 116e19f863f3eb0e68fbdf57f0677c35d36ce2aa Mon Sep 17 00:00:00 2001 From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> Date: Fri, 5 Aug 2022 21:54:33 +0530 Subject: [PATCH 3/4] Rollup merge of #100155 - compiler-errors:issue-100154, r=jackh726 Use `node_type_opt` to skip over generics that were not expected Fixes #100154 --- .../rustc_typeck/src/check/fn_ctxt/checks.rs | 14 ++++---- .../ui/argument-suggestions/issue-100154.rs | 7 ++++ .../argument-suggestions/issue-100154.stderr | 35 +++++++++++++++++++ src/test/ui/transmutability/references.stderr | 4 +-- 4 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 src/test/ui/argument-suggestions/issue-100154.rs create mode 100644 src/test/ui/argument-suggestions/issue-100154.stderr diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index 33a3f825ac271..660e7e4e39931 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -1761,13 +1761,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .filter_map(|seg| seg.args.as_ref()) .flat_map(|a| a.args.iter()) { - if let hir::GenericArg::Type(hir_ty) = &arg { - let ty = self.resolve_vars_if_possible( - self.typeck_results.borrow().node_type(hir_ty.hir_id), - ); - if ty == predicate.self_ty() { - error.obligation.cause.span = hir_ty.span; - } + if let hir::GenericArg::Type(hir_ty) = &arg + && let Some(ty) = + self.typeck_results.borrow().node_type_opt(hir_ty.hir_id) + && self.resolve_vars_if_possible(ty) == predicate.self_ty() + { + error.obligation.cause.span = hir_ty.span; + break; } } } diff --git a/src/test/ui/argument-suggestions/issue-100154.rs b/src/test/ui/argument-suggestions/issue-100154.rs new file mode 100644 index 0000000000000..4446b4bc2fcf3 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-100154.rs @@ -0,0 +1,7 @@ +fn foo(i: impl std::fmt::Display) {} + +fn main() { + foo::<()>(()); + //~^ ERROR this function takes 0 generic arguments but 1 generic argument was supplied + //~| ERROR `()` doesn't implement `std::fmt::Display` +} diff --git a/src/test/ui/argument-suggestions/issue-100154.stderr b/src/test/ui/argument-suggestions/issue-100154.stderr new file mode 100644 index 0000000000000..1499229c3ced2 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-100154.stderr @@ -0,0 +1,35 @@ +error[E0107]: this function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-100154.rs:4:5 + | +LL | foo::<()>(()); + | ^^^------ help: remove these generics + | | + | expected 0 generic arguments + | +note: function defined here, with 0 generic parameters + --> $DIR/issue-100154.rs:1:4 + | +LL | fn foo(i: impl std::fmt::Display) {} + | ^^^ + = note: `impl Trait` cannot be explicitly specified as a generic argument + +error[E0277]: `()` doesn't implement `std::fmt::Display` + --> $DIR/issue-100154.rs:4:15 + | +LL | foo::<()>(()); + | --------- ^^ `()` cannot be formatted with the default formatter + | | + | required by a bound introduced by this call + | + = help: the trait `std::fmt::Display` is not implemented for `()` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `foo` + --> $DIR/issue-100154.rs:1:16 + | +LL | fn foo(i: impl std::fmt::Display) {} + | ^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0107, E0277. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/transmutability/references.stderr b/src/test/ui/transmutability/references.stderr index 17ffcf64177e3..b1359ea586583 100644 --- a/src/test/ui/transmutability/references.stderr +++ b/src/test/ui/transmutability/references.stderr @@ -1,8 +1,8 @@ error[E0277]: `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. - --> $DIR/references.rs:19:52 + --> $DIR/references.rs:19:37 | LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); - | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. + | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. | = help: the trait `BikeshedIntrinsicFrom<&'static Unit, assert::Context, true, true, true, true>` is not implemented for `&'static Unit` note: required by a bound in `is_maybe_transmutable` From cff90fee12e69855cad0751b393ef1d5725b25ac Mon Sep 17 00:00:00 2001 From: bors Date: Thu, 18 Aug 2022 15:41:30 +0000 Subject: [PATCH 4/4] Auto merge of #99860 - oli-obk:revert_97346, r=pnkfelix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert "Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, … …r=oli-obk" This reverts commit c703d11dccb4a895c7aead3b2fcd8cea8c483184, reversing changes made to 64eb9ab869bc3f9ef3645302fbf22e706eea16cf. it didn't apply cleanly, so now it works the same for RPIT and for TAIT instead of just working for RPIT, but we should keep those in sync anyway. It also exposed a TAIT bug (see the feature gated test that now ICEs). r? `@pnkfelix` fixes #99536 --- .../rustc_infer/src/infer/opaque_types.rs | 14 ++++++----- .../src/traits/project.rs | 18 ++++++++++--- src/test/ui/impl-trait/issues/issue-86800.rs | 9 ++++++- .../ui/impl-trait/issues/issue-86800.stderr | 25 +++++++++++++------ .../ui/impl-trait/nested-return-type2-tait.rs | 10 +++++--- .../nested-return-type2-tait.stderr | 16 ------------ .../impl-trait/nested-return-type2-tait2.rs | 2 +- .../nested-return-type2-tait2.stderr | 8 +++--- .../impl-trait/nested-return-type2-tait3.rs | 2 +- .../nested-return-type2-tait3.stderr | 8 +++--- src/test/ui/impl-trait/nested-return-type2.rs | 8 ++++-- .../ui/impl-trait/nested-return-type2.stderr | 16 ------------ 12 files changed, 69 insertions(+), 67 deletions(-) delete mode 100644 src/test/ui/impl-trait/nested-return-type2-tait.stderr delete mode 100644 src/test/ui/impl-trait/nested-return-type2.stderr diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index a1c7b70bd9cdf..e579afbf38954 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -40,15 +40,17 @@ pub struct OpaqueTypeDecl<'tcx> { } impl<'a, 'tcx> InferCtxt<'a, 'tcx> { - pub fn replace_opaque_types_with_inference_vars( + /// This is a backwards compatibility hack to prevent breaking changes from + /// lazy TAIT around RPIT handling. + pub fn replace_opaque_types_with_inference_vars>( &self, - ty: Ty<'tcx>, + value: T, body_id: HirId, span: Span, param_env: ty::ParamEnv<'tcx>, - ) -> InferOk<'tcx, Ty<'tcx>> { - if !ty.has_opaque_types() { - return InferOk { value: ty, obligations: vec![] }; + ) -> InferOk<'tcx, T> { + if !value.has_opaque_types() { + return InferOk { value, obligations: vec![] }; } let mut obligations = vec![]; let replace_opaque_type = |def_id: DefId| { @@ -56,7 +58,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .as_local() .map_or(false, |def_id| self.opaque_type_origin(def_id, span).is_some()) }; - let value = ty.fold_with(&mut ty::fold::BottomUpFolder { + let value = value.fold_with(&mut ty::fold::BottomUpFolder { tcx: self.tcx, lt_op: |lt| lt, ct_op: |ct| ct, diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index adf47ece69d99..c4e80e1ba8b1d 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -252,10 +252,20 @@ fn project_and_unify_type<'cx, 'tcx>( Err(InProgress) => return ProjectAndUnifyResult::Recursive, }; debug!(?normalized, ?obligations, "project_and_unify_type result"); - match infcx - .at(&obligation.cause, obligation.param_env) - .eq(normalized, obligation.predicate.term) - { + let actual = obligation.predicate.term; + // For an example where this is neccessary see src/test/ui/impl-trait/nested-return-type2.rs + // This allows users to omit re-mentioning all bounds on an associated type and just use an + // `impl Trait` for the assoc type to add more bounds. + let InferOk { value: actual, obligations: new } = + selcx.infcx().replace_opaque_types_with_inference_vars( + actual, + obligation.cause.body_id, + obligation.cause.span, + obligation.param_env, + ); + obligations.extend(new); + + match infcx.at(&obligation.cause, obligation.param_env).eq(normalized, actual) { Ok(InferOk { obligations: inferred_obligations, value: () }) => { obligations.extend(inferred_obligations); ProjectAndUnifyResult::Holds(obligations) diff --git a/src/test/ui/impl-trait/issues/issue-86800.rs b/src/test/ui/impl-trait/issues/issue-86800.rs index 19edeaffc496f..351243c6727da 100644 --- a/src/test/ui/impl-trait/issues/issue-86800.rs +++ b/src/test/ui/impl-trait/issues/issue-86800.rs @@ -1,6 +1,14 @@ #![feature(type_alias_impl_trait)] // edition:2021 +// unset-rustc-env:RUST_BACKTRACE +// compile-flags:-Z treat-err-as-bug=1 +// error-pattern:stack backtrace: +// failure-status:101 +// normalize-stderr-test "note: .*" -> "" +// normalize-stderr-test "thread 'rustc' .*" -> "" +// normalize-stderr-test " +[0-9]+:.*\n" -> "" +// normalize-stderr-test " +at .*\n" -> "" use std::future::Future; @@ -23,7 +31,6 @@ struct Context { type TransactionResult = Result; type TransactionFuture<'__, O> = impl '__ + Future>; -//~^ ERROR unconstrained opaque type fn execute_transaction_fut<'f, F, O>( f: F, diff --git a/src/test/ui/impl-trait/issues/issue-86800.stderr b/src/test/ui/impl-trait/issues/issue-86800.stderr index 787aecc5b84bf..135d06d44adae 100644 --- a/src/test/ui/impl-trait/issues/issue-86800.stderr +++ b/src/test/ui/impl-trait/issues/issue-86800.stderr @@ -1,10 +1,19 @@ -error: unconstrained opaque type - --> $DIR/issue-86800.rs:25:34 - | -LL | type TransactionFuture<'__, O> = impl '__ + Future>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `TransactionFuture` must be used in combination with a concrete type within the same module -error: aborting due to previous error +stack backtrace: +error: internal compiler error: unexpected panic + + + + + + + + + +query stack during panic: +#0 [mir_borrowck] borrow-checking `execute_transaction_fut` +#1 [type_of] computing type of `TransactionFuture::{opaque#0}` +#2 [check_mod_item_types] checking item types in top-level module +#3 [analysis] running analysis passes on this crate +end of query stack diff --git a/src/test/ui/impl-trait/nested-return-type2-tait.rs b/src/test/ui/impl-trait/nested-return-type2-tait.rs index a2a49c5535d3d..42613d5ccd9a4 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait.rs +++ b/src/test/ui/impl-trait/nested-return-type2-tait.rs @@ -1,5 +1,7 @@ #![feature(type_alias_impl_trait)] +// check-pass + trait Duh {} impl Duh for i32 {} @@ -17,13 +19,13 @@ impl R> Trait for F { type Sendable = impl Send; -// The `Sendable` here is then later compared against the inference var -// created, causing the inference var to be set to `Sendable` instead of +// The `Sendable` here is converted to an inference var and then later compared +// against the inference var created, causing the inference var to be set to +// the hidden type of `Sendable` instead of // the hidden type. We already have obligations registered on the inference // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque -// type does not implement `Duh`, even if its hidden type does. So we error out. +// type does not implement `Duh`, but if its hidden type does. fn foo() -> impl Trait { - //~^ ERROR `Sendable: Duh` is not satisfied || 42 } diff --git a/src/test/ui/impl-trait/nested-return-type2-tait.stderr b/src/test/ui/impl-trait/nested-return-type2-tait.stderr deleted file mode 100644 index 1079a86ce9e73..0000000000000 --- a/src/test/ui/impl-trait/nested-return-type2-tait.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: the trait bound `Sendable: Duh` is not satisfied - --> $DIR/nested-return-type2-tait.rs:25:13 - | -LL | fn foo() -> impl Trait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `Sendable` - | - = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:27:5: 27:7]` - --> $DIR/nested-return-type2-tait.rs:14:31 - | -LL | impl R> Trait for F { - | ^^^^^ ^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/nested-return-type2-tait2.rs b/src/test/ui/impl-trait/nested-return-type2-tait2.rs index fcc077ec18ece..af8e066305471 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait2.rs +++ b/src/test/ui/impl-trait/nested-return-type2-tait2.rs @@ -24,8 +24,8 @@ type Traitable = impl Trait; // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque // type does not implement `Duh`, even if its hidden type does. So we error out. fn foo() -> Traitable { - //~^ ERROR `Sendable: Duh` is not satisfied || 42 + //~^ ERROR `Sendable: Duh` is not satisfied } fn main() { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait2.stderr b/src/test/ui/impl-trait/nested-return-type2-tait2.stderr index 847b940008531..fe1ae4fcb08b1 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait2.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Sendable: Duh` is not satisfied - --> $DIR/nested-return-type2-tait2.rs:26:13 + --> $DIR/nested-return-type2-tait2.rs:27:5 | -LL | fn foo() -> Traitable { - | ^^^^^^^^^ the trait `Duh` is not implemented for `Sendable` +LL | || 42 + | ^^^^^ the trait `Duh` is not implemented for `Sendable` | = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:28:5: 28:7]` +note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7]` --> $DIR/nested-return-type2-tait2.rs:14:31 | LL | impl R> Trait for F { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait3.rs b/src/test/ui/impl-trait/nested-return-type2-tait3.rs index 665c7a8cab91f..74fd8a9dda0bf 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait3.rs +++ b/src/test/ui/impl-trait/nested-return-type2-tait3.rs @@ -23,8 +23,8 @@ type Traitable = impl Trait; // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque // type does not implement `Duh`, even if its hidden type does. So we error out. fn foo() -> Traitable { - //~^ ERROR `impl Send: Duh` is not satisfied || 42 + //~^ ERROR `impl Send: Duh` is not satisfied } fn main() { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait3.stderr b/src/test/ui/impl-trait/nested-return-type2-tait3.stderr index 7b7f06b8e13e1..c0695d627eb6d 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait3.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait3.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `impl Send: Duh` is not satisfied - --> $DIR/nested-return-type2-tait3.rs:25:13 + --> $DIR/nested-return-type2-tait3.rs:26:5 | -LL | fn foo() -> Traitable { - | ^^^^^^^^^ the trait `Duh` is not implemented for `impl Send` +LL | || 42 + | ^^^^^ the trait `Duh` is not implemented for `impl Send` | = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:27:5: 27:7]` +note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7]` --> $DIR/nested-return-type2-tait3.rs:14:31 | LL | impl R> Trait for F { diff --git a/src/test/ui/impl-trait/nested-return-type2.rs b/src/test/ui/impl-trait/nested-return-type2.rs index 279641a46c3d0..39928d543e15d 100644 --- a/src/test/ui/impl-trait/nested-return-type2.rs +++ b/src/test/ui/impl-trait/nested-return-type2.rs @@ -1,3 +1,5 @@ +// check-pass + trait Duh {} impl Duh for i32 {} @@ -18,9 +20,11 @@ impl R> Trait for F { // the hidden type. We already have obligations registered on the inference // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque // type does not implement `Duh`, even if its hidden type does. +// Lazy TAIT would error out, but we inserted a hack to make it work again, +// keeping backwards compatibility. fn foo() -> impl Trait { - //~^ ERROR `impl Send: Duh` is not satisfied || 42 } -fn main() {} +fn main() { +} diff --git a/src/test/ui/impl-trait/nested-return-type2.stderr b/src/test/ui/impl-trait/nested-return-type2.stderr deleted file mode 100644 index f28a084af89a4..0000000000000 --- a/src/test/ui/impl-trait/nested-return-type2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: the trait bound `impl Send: Duh` is not satisfied - --> $DIR/nested-return-type2.rs:21:13 - | -LL | fn foo() -> impl Trait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `impl Send` - | - = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2.rs:23:5: 23:7]` - --> $DIR/nested-return-type2.rs:12:31 - | -LL | impl R> Trait for F { - | ^^^^^ ^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`.