diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index f03d0f8a88529..bfcfa019026b0 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1,7 +1,9 @@ use crate::autoderef::Autoderef; +use crate::collect::CollectItemTypesVisitor; use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter}; use crate::errors; +use hir::intravisit::Visitor; use rustc_ast as ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, ErrorGuaranteed}; @@ -225,6 +227,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<() ?item.owner_id, item.name = ? tcx.def_path_str(def_id) ); + CollectItemTypesVisitor { tcx }.visit_item(item); let res = match item.kind { // Right now we check that every default trait implementation @@ -248,6 +251,8 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<() let header = tcx.impl_trait_header(def_id); let is_auto = header .is_some_and(|header| tcx.trait_is_auto(header.skip_binder().trait_ref.def_id)); + + crate::impl_wf_check::check_impl_wf(tcx, def_id)?; let mut res = Ok(()); if let (hir::Defaultness::Default { .. }, true) = (impl_.defaultness, is_auto) { let sp = impl_.of_trait.as_ref().map_or(item.span, |t| t.path.span); @@ -334,9 +339,14 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<() res } -fn check_foreign_item(tcx: TyCtxt<'_>, item: &hir::ForeignItem<'_>) -> Result<(), ErrorGuaranteed> { +fn check_foreign_item<'tcx>( + tcx: TyCtxt<'tcx>, + item: &'tcx hir::ForeignItem<'tcx>, +) -> Result<(), ErrorGuaranteed> { let def_id = item.owner_id.def_id; + CollectItemTypesVisitor { tcx }.visit_foreign_item(item); + debug!( ?item.owner_id, item.name = ? tcx.def_path_str(def_id) @@ -353,12 +363,14 @@ fn check_foreign_item(tcx: TyCtxt<'_>, item: &hir::ForeignItem<'_>) -> Result<() } } -fn check_trait_item( - tcx: TyCtxt<'_>, - trait_item: &hir::TraitItem<'_>, +fn check_trait_item<'tcx>( + tcx: TyCtxt<'tcx>, + trait_item: &'tcx hir::TraitItem<'tcx>, ) -> Result<(), ErrorGuaranteed> { let def_id = trait_item.owner_id.def_id; + CollectItemTypesVisitor { tcx }.visit_trait_item(trait_item); + let (method_sig, span) = match trait_item.kind { hir::TraitItemKind::Fn(ref sig, _) => (Some(sig), trait_item.span), hir::TraitItemKind::Type(_bounds, Some(ty)) => (None, ty.span), @@ -895,7 +907,12 @@ fn check_object_unsafe_self_trait_by_name(tcx: TyCtxt<'_>, item: &hir::TraitItem } } -fn check_impl_item(tcx: TyCtxt<'_>, impl_item: &hir::ImplItem<'_>) -> Result<(), ErrorGuaranteed> { +fn check_impl_item<'tcx>( + tcx: TyCtxt<'tcx>, + impl_item: &'tcx hir::ImplItem<'tcx>, +) -> Result<(), ErrorGuaranteed> { + CollectItemTypesVisitor { tcx }.visit_impl_item(impl_item); + let (method_sig, span) = match impl_item.kind { hir::ImplItemKind::Fn(ref sig, _) => (Some(sig), impl_item.span), // Constrain binding and overflow error spans to `` in `type foo = `. diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 642009dfa48a8..dec0bb8b51295 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -20,7 +20,7 @@ use rustc_data_structures::unord::UnordMap; use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, StashKey}; use rustc_hir as hir; use rustc_hir::def::DefKind; -use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; +use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{GenericParamKind, Node}; use rustc_infer::infer::{InferCtxt, TyCtxtInferExt}; @@ -52,11 +52,6 @@ mod resolve_bound_vars; mod type_of; /////////////////////////////////////////////////////////////////////////// -// Main entry point - -fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { - tcx.hir().visit_item_likes_in_module(module_def_id, &mut CollectItemTypesVisitor { tcx }); -} pub fn provide(providers: &mut Providers) { resolve_bound_vars::provide(providers); @@ -82,7 +77,6 @@ pub fn provide(providers: &mut Providers) { impl_trait_header, coroutine_kind, coroutine_for_closure, - collect_mod_item_types, is_type_alias_impl_trait, find_field, ..*providers @@ -155,8 +149,8 @@ impl<'v> Visitor<'v> for HirPlaceholderCollector { } } -struct CollectItemTypesVisitor<'tcx> { - tcx: TyCtxt<'tcx>, +pub struct CollectItemTypesVisitor<'tcx> { + pub tcx: TyCtxt<'tcx>, } /// If there are any placeholder types (`_`), emit an error explaining that this is not allowed @@ -1025,7 +1019,19 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> { let is_anonymous = item.ident.name == kw::Empty; let repr = if is_anonymous { - tcx.adt_def(tcx.local_parent(def_id)).repr() + let mut def_id = def_id; + loop { + def_id = tcx.local_parent(def_id); + if let Node::Item(_) = tcx.hir_node_by_def_id(def_id) { + break; + } else { + tcx.dcx().span_delayed_bug( + tcx.def_span(def_id), + "invalid anonymous adt position, already got rejected in ast validation", + ); + } + } + tcx.adt_def(def_id).repr() } else { tcx.repr_options_of_def(def_id) }; diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check.rs b/compiler/rustc_hir_analysis/src/impl_wf_check.rs index 9d7866fe3e0cb..caa85092415b9 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check.rs @@ -14,8 +14,7 @@ use min_specialization::check_min_specialization; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir::def::DefKind; -use rustc_hir::def_id::{LocalDefId, LocalModDefId}; -use rustc_middle::query::Providers; +use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt}; use rustc_span::{ErrorGuaranteed, Span, Symbol}; @@ -51,23 +50,16 @@ mod min_specialization; /// impl<'a> Trait for Bar { type X = &'a i32; } /// // ^ 'a is unused and appears in assoc type, error /// ``` -fn check_mod_impl_wf(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) -> Result<(), ErrorGuaranteed> { +pub fn check_impl_wf(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) -> Result<(), ErrorGuaranteed> { let min_specialization = tcx.features().min_specialization; - let module = tcx.hir_module_items(module_def_id); let mut res = Ok(()); - for id in module.items() { - if matches!(tcx.def_kind(id.owner_id), DefKind::Impl { .. }) { - res = res.and(enforce_impl_params_are_constrained(tcx, id.owner_id.def_id)); - if min_specialization { - res = res.and(check_min_specialization(tcx, id.owner_id.def_id)); - } - } + debug_assert!(matches!(tcx.def_kind(impl_def_id), DefKind::Impl { .. })); + res = res.and(enforce_impl_params_are_constrained(tcx, impl_def_id)); + if min_specialization { + res = res.and(check_min_specialization(tcx, impl_def_id)); } - res -} -pub fn provide(providers: &mut Providers) { - *providers = Providers { check_mod_impl_wf, ..*providers }; + res } fn enforce_impl_params_are_constrained( diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 7cb103626da77..e056c0e84cf42 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -153,27 +153,20 @@ pub fn provide(providers: &mut Providers) { check_unused::provide(providers); variance::provide(providers); outlives::provide(providers); - impl_wf_check::provide(providers); hir_wf_check::provide(providers); } pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { let _prof_timer = tcx.sess.timer("type_check_crate"); - // this ensures that later parts of type checking can assume that items - // have valid types and not error - tcx.sess.time("type_collecting", || { - tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module)) - }); - if tcx.features().rustc_attrs { tcx.sess.time("outlives_testing", || outlives::test::test_inferred_outlives(tcx))?; } tcx.sess.time("coherence_checking", || { - // Check impls constrain their parameters - let res = - tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)); + tcx.hir().par_for_each_module(|module| { + let _ = tcx.ensure().check_mod_type_wf(module); + }); for &trait_def_id in tcx.all_local_trait_impls(()).keys() { let _ = tcx.ensure().coherent_trait(trait_def_id); @@ -181,19 +174,12 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { // these queries are executed for side-effects (error reporting): let _ = tcx.ensure().crate_inherent_impls(()); let _ = tcx.ensure().crate_inherent_impls_overlap_check(()); - res - })?; + }); if tcx.features().rustc_attrs { tcx.sess.time("variance_testing", || variance::test::test_variance(tcx))?; } - tcx.sess.time("wf_checking", || { - tcx.hir().par_for_each_module(|module| { - let _ = tcx.ensure().check_mod_type_wf(module); - }) - }); - if tcx.features().rustc_attrs { collect::test_opaque_hidden_types(tcx)?; } diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index e87bc581e6eab..cbb356e3d6192 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -772,6 +772,7 @@ rustc_queries! { desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) } cache_on_disk_if { def_id.is_local() } separate_provide_extern + cycle_delay_bug } /// Maps from thee `DefId` of a type to its (inferred) outlives. @@ -964,20 +965,11 @@ rustc_queries! { desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) } } - query check_mod_impl_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> { - desc { |tcx| "checking that impls are well-formed in {}", describe_as_module(key, tcx) } - ensure_forwards_result_if_red - } - query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> { desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) } ensure_forwards_result_if_red } - query collect_mod_item_types(key: LocalModDefId) { - desc { |tcx| "collecting item types in {}", describe_as_module(key, tcx) } - } - /// Caches `CoerceUnsized` kinds for impls on custom types. query coerce_unsized_info(key: DefId) -> Result { desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) } diff --git a/compiler/rustc_middle/src/values.rs b/compiler/rustc_middle/src/values.rs index 27b48f46e75a2..f7a3879a7d40c 100644 --- a/compiler/rustc_middle/src/values.rs +++ b/compiler/rustc_middle/src/values.rs @@ -131,6 +131,27 @@ impl<'tcx> Value> for ty::EarlyBinder> } } +impl<'tcx> Value> for &[ty::Variance] { + fn from_cycle_error( + tcx: TyCtxt<'tcx>, + cycle_error: &CycleError, + _guar: ErrorGuaranteed, + ) -> Self { + if let Some(frame) = cycle_error.cycle.get(0) + && frame.query.dep_kind == dep_kinds::variances_of + && let Some(def_id) = frame.query.def_id + { + let n = tcx.generics_of(def_id).params.len(); + vec![ty::Variance::Bivariant; n].leak() + } else { + span_bug!( + cycle_error.usage.as_ref().unwrap().0, + "only `variances_of` returns `&[ty::Variance]`" + ); + } + } +} + // Take a cycle of `Q` and try `try_cycle` on every permutation, falling back to `otherwise`. fn search_for_cycle_permutation( cycle: &[Q], diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 2f4da29133f1b..0a77722cc66fc 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -2597,10 +2597,18 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { let span = *entry.get(); let err = ResolutionError::NameAlreadyUsedInParameterList(ident.name, span); self.report_error(param.ident.span, err); - if let GenericParamKind::Lifetime = param.kind { - // Record lifetime res, so lowering knows there is something fishy. - self.record_lifetime_param(param.id, LifetimeRes::Error); - } + let rib = match param.kind { + GenericParamKind::Lifetime => { + // Record lifetime res, so lowering knows there is something fishy. + self.record_lifetime_param(param.id, LifetimeRes::Error); + continue; + } + GenericParamKind::Type { .. } => &mut function_type_rib, + GenericParamKind::Const { .. } => &mut function_value_rib, + }; + + self.r.record_partial_res(param.id, PartialRes::new(Res::Err)); + rib.bindings.insert(ident, Res::Err); continue; } Entry::Vacant(entry) => { diff --git a/compiler/rustc_traits/src/codegen.rs b/compiler/rustc_traits/src/codegen.rs index f3fae63ecc7b2..b6a796f577ddb 100644 --- a/compiler/rustc_traits/src/codegen.rs +++ b/compiler/rustc_traits/src/codegen.rs @@ -6,7 +6,7 @@ use rustc_infer::infer::TyCtxtInferExt; use rustc_infer::traits::{FulfillmentErrorCode, TraitEngineExt as _}; use rustc_middle::traits::CodegenObligationError; -use rustc_middle::ty::{self, TyCtxt}; +use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt}; use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt; use rustc_trait_selection::traits::{ ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, TraitEngineExt, @@ -72,6 +72,10 @@ pub fn codegen_select_candidate<'tcx>( let impl_source = infcx.resolve_vars_if_possible(impl_source); let impl_source = infcx.tcx.erase_regions(impl_source); + if impl_source.has_infer() { + infcx.tcx.dcx().has_errors().unwrap(); + return Err(CodegenObligationError::FulfillmentError); + } Ok(&*tcx.arena.alloc(impl_source)) } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index c662f054d0524..bba28dc88abf3 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -315,21 +315,10 @@ pub(crate) fn run_global_ctxt( // typeck function bodies or run the default rustc lints. // (see `override_queries` in the `config`) - // HACK(jynelson) this calls an _extremely_ limited subset of `typeck` - // and might break if queries change their assumptions in the future. - tcx.sess.time("type_collecting", || { - tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module)) - }); - // NOTE: These are copy/pasted from typeck/lib.rs and should be kept in sync with those changes. let _ = tcx.sess.time("wf_checking", || { tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module)) }); - tcx.sess.time("item_types_checking", || { - tcx.hir().for_each_module(|module| { - let _ = tcx.ensure().check_mod_type_wf(module); - }); - }); if let Some(guar) = tcx.dcx().has_errors() { return Err(guar); diff --git a/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs index 16e2c7d60b834..9f7d6db5d26e9 100644 --- a/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs +++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs @@ -12,7 +12,7 @@ struct DefaultAllocator; // `::Buffer` to be ambiguous, // which caused an ICE with `-Znormalize-docs`. impl Allocator for DefaultAllocator { - //~^ ERROR: type annotations needed + //~^ ERROR: the type parameter `T` is not constrained type Buffer = (); } diff --git a/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr b/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr index 01034018e22df..55ab144b92419 100644 --- a/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr +++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr @@ -1,9 +1,9 @@ -error[E0282]: type annotations needed - --> $DIR/not-wf-ambiguous-normalization.rs:14:23 +error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates + --> $DIR/not-wf-ambiguous-normalization.rs:14:6 | LL | impl Allocator for DefaultAllocator { - | ^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` + | ^ unconstrained type parameter error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr index a2ad4cbde01ca..a495e94bd9ab3 100644 --- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr @@ -26,17 +26,11 @@ note: ...which requires computing normalized predicates of `Foo`... LL | struct Foo { | ^^^^^^^^^^ = note: ...which again requires computing predicates of `Foo`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/cycle-iat-inside-of-adt.rs:3:1 +note: cycle used when checking that `Foo` is well-formed + --> $DIR/cycle-iat-inside-of-adt.rs:7:1 | -LL | / #![feature(inherent_associated_types)] -LL | | #![allow(incomplete_features)] -LL | | // FIXME(inherent_associated_types): This should pass. -LL | | -... | -LL | | -LL | | fn main() {} - | |____________^ +LL | struct Foo { + | ^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr index b3d55fea14b5a..e7292c08ebd0c 100644 --- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr @@ -20,19 +20,23 @@ note: ...which requires computing normalized predicates of `user`... LL | fn user() where S::P: std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires computing predicates of `user`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/cycle-iat-inside-of-where-predicate.rs:3:1 - | -LL | / #![feature(inherent_associated_types)] -LL | | #![allow(incomplete_features)] -LL | | -LL | | // FIXME(inherent_associated_types): This shouldn't lead to a cycle error. -... | -LL | | -LL | | fn main() {} - | |____________^ +note: cycle used when checking that `user` is well-formed + --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 + | +LL | fn user() where S::P: std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 1 previous error +error[E0392]: type parameter `T` is never used + --> $DIR/cycle-iat-inside-of-where-predicate.rs:10:10 + | +LL | struct S; + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0391`. +Some errors have detailed explanations: E0391, E0392. +For more information about an error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr index b8366b15a8ae4..72d3f5c6d4d42 100644 --- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr +++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr @@ -20,16 +20,6 @@ help: add missing generic argument LL | impl Windows { | +++ -error[E0658]: inherent associated types are unstable - --> $DIR/issue-109071.rs:8:5 - | -LL | type Item = &[T]; - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #8995 for more information - = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0223]: ambiguous associated type --> $DIR/issue-109071.rs:15:22 | @@ -43,6 +33,16 @@ LL | fn T() -> Option< as IntoAsyncIterator>::Item> {} LL | fn T() -> Option< as IntoIterator>::Item> {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +error[E0658]: inherent associated types are unstable + --> $DIR/issue-109071.rs:8:5 + | +LL | type Item = &[T]; + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #8995 for more information + = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error: aborting due to 4 previous errors Some errors have detailed explanations: E0107, E0223, E0637, E0658. diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr index 9816d11a40a8b..6345ef4b79860 100644 --- a/tests/ui/associated-type-bounds/duplicate.stderr +++ b/tests/ui/associated-type-bounds/duplicate.stderr @@ -198,6 +198,17 @@ LL | fn FRPIT1() -> impl Iterator { | | | `Item` bound here first +error[E0282]: type annotations needed + --> $DIR/duplicate.rs:136:5 + | +LL | iter::empty() + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` + | +help: consider specifying the generic argument + | +LL | iter::empty::() + | +++++ + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:139:42 | @@ -206,6 +217,17 @@ LL | fn FRPIT2() -> impl Iterator { | | | `Item` bound here first +error[E0282]: type annotations needed + --> $DIR/duplicate.rs:141:5 + | +LL | iter::empty() + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` + | +help: consider specifying the generic argument + | +LL | iter::empty::() + | +++++ + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:144:45 | @@ -214,6 +236,17 @@ LL | fn FRPIT3() -> impl Iterator { | | | `Item` bound here first +error[E0282]: type annotations needed + --> $DIR/duplicate.rs:146:5 + | +LL | iter::empty() + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` + | +help: consider specifying the generic argument + | +LL | iter::empty::() + | +++++ + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:149:40 | @@ -376,6 +409,16 @@ LL | trait TRS1: Iterator {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:197:34 + | +LL | trait TRS1: Iterator {} + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:201:34 | @@ -394,6 +437,16 @@ LL | trait TRS2: Iterator {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:201:34 + | +LL | trait TRS2: Iterator {} + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:205:37 | @@ -412,6 +465,16 @@ LL | trait TRS3: Iterator {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:205:37 + | +LL | trait TRS3: Iterator {} + | ------------- ^^^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:211:29 | @@ -454,6 +517,16 @@ LL | Self: Iterator, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:229:32 + | +LL | Self: Iterator, + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:237:32 | @@ -472,6 +545,16 @@ LL | Self: Iterator, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:237:32 + | +LL | Self: Iterator, + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:245:35 | @@ -490,6 +573,16 @@ LL | Self: Iterator, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate.rs:245:35 + | +LL | Self: Iterator, + | ------------- ^^^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/duplicate.rs:252:34 | @@ -514,99 +607,6 @@ LL | type A: Iterator; | | | `Item` bound here first -error[E0282]: type annotations needed - --> $DIR/duplicate.rs:136:5 - | -LL | iter::empty() - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` - | -help: consider specifying the generic argument - | -LL | iter::empty::() - | +++++ - -error[E0282]: type annotations needed - --> $DIR/duplicate.rs:141:5 - | -LL | iter::empty() - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` - | -help: consider specifying the generic argument - | -LL | iter::empty::() - | +++++ - -error[E0282]: type annotations needed - --> $DIR/duplicate.rs:146:5 - | -LL | iter::empty() - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` - | -help: consider specifying the generic argument - | -LL | iter::empty::() - | +++++ - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:197:34 - | -LL | trait TRS1: Iterator {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:201:34 - | -LL | trait TRS2: Iterator {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:205:37 - | -LL | trait TRS3: Iterator {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:229:32 - | -LL | Self: Iterator, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:237:32 - | -LL | Self: Iterator, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:245:35 - | -LL | Self: Iterator, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 72 previous errors Some errors have detailed explanations: E0282, E0719. diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr index d361643f024d1..c5260adbed43a 100644 --- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr +++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr @@ -9,6 +9,23 @@ help: if there were a type named `Example` that implemented `Get`, you could use LL | fn get(x: T, y: U) -> ::Value {} | ~~~~~~~~~~~~~~~~~~~~~~~ +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:13:23 + | +LL | fn grab(&self) -> Grab::Value; + | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Value` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:16:22 + | +LL | fn get(&self) -> Get::Value; + | ^^^^^^^^^^ + | +help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path + | +LL | fn get(&self) -> ::Value; + | ~~~~~~~~~~~~~~~~~~~~~~~ + error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:22:17 | @@ -33,23 +50,6 @@ LL | type X = ::Target; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ and N other candidates -error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:13:23 - | -LL | fn grab(&self) -> Grab::Value; - | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Value` - -error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:16:22 - | -LL | fn get(&self) -> Get::Value; - | ^^^^^^^^^^ - | -help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path - | -LL | fn get(&self) -> ::Value; - | ~~~~~~~~~~~~~~~~~~~~~~~ - error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index acf6bb2810c99..f1c8f83e30c8f 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -1,22 +1,3 @@ -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:23:17 - | -LL | #[derive(Debug, Copy, Clone)] - | ^^^^ the trait `NotNull` is not implemented for `::SqlType`, which is required by `::SqlType: IntoNullable` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting the associated type - | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull, - | +++++++++++++++++++++++++++++++++++++++ - error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 | @@ -129,6 +110,25 @@ LL | impl IntoNullable for T { = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied + --> $DIR/issue-38821.rs:23:17 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^ the trait `NotNull` is not implemented for `::SqlType`, which is required by `::SqlType: IntoNullable` + | +note: required for `::SqlType` to implement `IntoNullable` + --> $DIR/issue-38821.rs:9:18 + | +LL | impl IntoNullable for T { + | ------- ^^^^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting the associated type + | +LL | Expr: Expression::Nullable>, ::SqlType: NotNull, + | +++++++++++++++++++++++++++++++++++++++ + error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:17 | diff --git a/tests/ui/coherence/coherence-orphan.stderr b/tests/ui/coherence/coherence-orphan.stderr index b1bb75bfe5162..48843f7cd1818 100644 --- a/tests/ui/coherence/coherence-orphan.stderr +++ b/tests/ui/coherence/coherence-orphan.stderr @@ -10,17 +10,6 @@ LL | impl TheTrait for isize {} | = note: define and implement a trait or new type instead -error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-orphan.rs:20:1 - | -LL | impl !Send for Vec {} - | ^^^^^^^^^^^^^^^---------- - | | | - | | `Vec` is not defined in the current crate - | impl doesn't use only types from inside the current crate - | - = note: define and implement a trait or new type instead - error[E0046]: not all trait items implemented, missing: `the_fn` --> $DIR/coherence-orphan.rs:10:1 | @@ -45,6 +34,17 @@ LL | impl TheTrait for TheType {} | = help: implement the missing item: `fn the_fn(&self) { todo!() }` +error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate + --> $DIR/coherence-orphan.rs:20:1 + | +LL | impl !Send for Vec {} + | ^^^^^^^^^^^^^^^---------- + | | | + | | `Vec` is not defined in the current crate + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + error: aborting due to 5 previous errors Some errors have detailed explanations: E0046, E0117. diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr index b32018a6a2d22..fcac95732d12e 100644 --- a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr +++ b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr @@ -74,26 +74,6 @@ LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::(0); | not allowed in type signatures | help: replace with the correct type: `Bar` -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/in-signature.rs:35:21 - | -LL | const ARR: [u8; _]; - | ^ not allowed in type signatures - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/in-signature.rs:39:25 - | -LL | const ARR: Bar; - | ^ not allowed in type signatures - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/in-signature.rs:43:20 - | -LL | const ARR: Bar<_, _>; - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/in-signature.rs:51:23 | @@ -114,6 +94,26 @@ LL | type Assoc = Bar<_, _>; | | | not allowed in type signatures +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants + --> $DIR/in-signature.rs:35:21 + | +LL | const ARR: [u8; _]; + | ^ not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants + --> $DIR/in-signature.rs:39:25 + | +LL | const ARR: Bar; + | ^ not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants + --> $DIR/in-signature.rs:43:20 + | +LL | const ARR: Bar<_, _>; + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/const-generics/issues/issue-68366.full.stderr b/tests/ui/const-generics/issues/issue-68366.full.stderr index ca9eb801dfce7..dc20af7731068 100644 --- a/tests/ui/const-generics/issues/issue-68366.full.stderr +++ b/tests/ui/const-generics/issues/issue-68366.full.stderr @@ -1,5 +1,14 @@ +error: `Option` is forbidden as the type of a const generic parameter + --> $DIR/issue-68366.rs:9:25 + | +LL | struct Collatz>; + | ^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-68366.rs:11:7 + --> $DIR/issue-68366.rs:12:7 | LL | impl Collatz<{Some(N)}> {} | ^^^^^^^^^^^^^^ unconstrained const parameter @@ -8,7 +17,7 @@ LL | impl Collatz<{Some(N)}> {} = note: proving the result of expressions other than the parameter are unique is not supported error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-68366.rs:17:6 + --> $DIR/issue-68366.rs:19:6 | LL | impl Foo {} | ^^^^^^^^^^^^^^ unconstrained const parameter @@ -16,6 +25,17 @@ LL | impl Foo {} = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported -error: aborting due to 2 previous errors +error: overly complex generic constant + --> $DIR/issue-68366.rs:12:31 + | +LL | impl Collatz<{Some(N)}> {} + | ^-------^ + | | + | struct/enum construction is not supported in generic constants + | + = help: consider moving this anonymous constant into a `const` function + = note: this operation may be supported in the future + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/const-generics/issues/issue-68366.min.stderr b/tests/ui/const-generics/issues/issue-68366.min.stderr index ecf24a356deef..78e49f46e1a4b 100644 --- a/tests/ui/const-generics/issues/issue-68366.min.stderr +++ b/tests/ui/const-generics/issues/issue-68366.min.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/issue-68366.rs:11:37 + --> $DIR/issue-68366.rs:12:37 | LL | impl Collatz<{Some(N)}> {} | ^ cannot perform const operation using `N` @@ -7,8 +7,17 @@ LL | impl Collatz<{Some(N)}> {} = help: const parameters may only be used as standalone arguments, i.e. `N` = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions +error: `Option` is forbidden as the type of a const generic parameter + --> $DIR/issue-68366.rs:9:25 + | +LL | struct Collatz>; + | ^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types + error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-68366.rs:11:7 + --> $DIR/issue-68366.rs:12:7 | LL | impl Collatz<{Some(N)}> {} | ^^^^^^^^^^^^^^ unconstrained const parameter @@ -17,7 +26,7 @@ LL | impl Collatz<{Some(N)}> {} = note: proving the result of expressions other than the parameter are unique is not supported error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-68366.rs:17:6 + --> $DIR/issue-68366.rs:19:6 | LL | impl Foo {} | ^^^^^^^^^^^^^^ unconstrained const parameter @@ -25,6 +34,6 @@ LL | impl Foo {} = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/const-generics/issues/issue-68366.rs b/tests/ui/const-generics/issues/issue-68366.rs index d3e57a021a682..d9d5e21857b13 100644 --- a/tests/ui/const-generics/issues/issue-68366.rs +++ b/tests/ui/const-generics/issues/issue-68366.rs @@ -7,10 +7,12 @@ #![cfg_attr(full, allow(incomplete_features))] struct Collatz>; +//~^ ERROR: `Option` is forbidden impl Collatz<{Some(N)}> {} //~^ ERROR the const parameter //[min]~^^ generic parameters may not be used in const operations +//[full]~^^^ ERROR overly complex struct Foo; diff --git a/tests/ui/consts/issue-103790.stderr b/tests/ui/consts/issue-103790.stderr index 55bc9675401b1..abe7366483b05 100644 --- a/tests/ui/consts/issue-103790.stderr +++ b/tests/ui/consts/issue-103790.stderr @@ -48,17 +48,11 @@ note: ...which requires computing type of `S::S`... LL | struct S; | ^ = note: ...which again requires computing type of `S`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/issue-103790.rs:1:1 +note: cycle used when checking that `S` is well-formed + --> $DIR/issue-103790.rs:4:1 | -LL | / #![feature(generic_const_exprs)] -LL | | #![allow(incomplete_features)] -LL | | -LL | | struct S; -... | -LL | | -LL | | fn main() {} - | |____________^ +LL | struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: `()` is forbidden as the type of a const generic parameter diff --git a/tests/ui/consts/issue-36163.stderr b/tests/ui/consts/issue-36163.stderr index de70a457f16f2..8a7a0981f4154 100644 --- a/tests/ui/consts/issue-36163.stderr +++ b/tests/ui/consts/issue-36163.stderr @@ -20,17 +20,11 @@ note: ...which requires const-evaluating + checking `A`... LL | const A: isize = Foo::B as isize; | ^^^^^^^^^^^^^^^ = note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/issue-36163.rs:1:1 +note: cycle used when checking that `Foo` is well-formed + --> $DIR/issue-36163.rs:3:1 | -LL | / const A: isize = Foo::B as isize; -LL | | -LL | | enum Foo { -LL | | B = A, -LL | | } -LL | | -LL | | fn main() {} - | |____________^ +LL | enum Foo { + | ^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr index e8be9b0b91350..c0b935567f814 100644 --- a/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr +++ b/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr @@ -5,15 +5,11 @@ LL | trait Foo> { | ^^^ | = note: ...which immediately requires computing type of `Foo::X` again -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `Foo` is well-formed --> $DIR/cycle-trait-default-type-trait.rs:4:1 | -LL | / trait Foo> { -LL | | -LL | | } -LL | | -LL | | fn main() { } - | |_____________^ +LL | trait Foo> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr index 8645b4ebccf51..2e11a59c3a492 100644 --- a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr +++ b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr @@ -5,7 +5,7 @@ LL | trait Chromosome: Chromosome { | ^^^^^^^^^^ | = note: ...which immediately requires computing the super predicates of `Chromosome` again -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `Chromosome` is well-formed --> $DIR/cycle-trait-supertrait-direct.rs:3:1 | LL | / trait Chromosome: Chromosome { diff --git a/tests/ui/cycle-trait/issue-12511.stderr b/tests/ui/cycle-trait/issue-12511.stderr index bc56b9904f5a7..0246bf219831a 100644 --- a/tests/ui/cycle-trait/issue-12511.stderr +++ b/tests/ui/cycle-trait/issue-12511.stderr @@ -10,7 +10,7 @@ note: ...which requires computing the super predicates of `T2`... LL | trait T2 : T1 { | ^^ = note: ...which again requires computing the super predicates of `T1`, completing the cycle -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `T1` is well-formed --> $DIR/issue-12511.rs:1:1 | LL | / trait T1 : T2 { diff --git a/tests/ui/delegation/not-supported.stderr b/tests/ui/delegation/not-supported.stderr index f235767d50afc..324b79f3c535a 100644 --- a/tests/ui/delegation/not-supported.stderr +++ b/tests/ui/delegation/not-supported.stderr @@ -70,14 +70,14 @@ LL | fn foo(&self, x: i32) -> i32 { x } LL | reuse Trait::foo; | ^^^ -error: delegation with early bound generics is not supported yet +error[E0049]: method `foo2` has 0 type parameters but its trait declaration has 1 type parameter --> $DIR/not-supported.rs:49:22 | LL | fn foo2(&self, x: T) -> T { x } - | ---------------------------- callee defined here + | - expected 1 type parameter ... LL | reuse Trait::foo2 { &self.0 } - | ^^^^ + | ^^^^ found 0 type parameters error: delegation with early bound generics is not supported yet --> $DIR/not-supported.rs:52:29 @@ -88,6 +88,15 @@ LL | fn foo3<'a: 'a>(_: &'a u32) {} LL | reuse ::foo3; | ^^^^ +error[E0195]: lifetime parameters or bounds on method `foo3` do not match the trait declaration + --> $DIR/not-supported.rs:52:29 + | +LL | fn foo3<'a: 'a>(_: &'a u32) {} + | -------- lifetimes in impl do not match this method in trait +... +LL | reuse ::foo3; + | ^^^^ lifetimes do not match method in trait + error: delegation with early bound generics is not supported yet --> $DIR/not-supported.rs:59:22 | @@ -97,6 +106,15 @@ LL | fn foo(&self, x: i32) -> i32 { x } LL | reuse Trait::foo { &self.0 } | ^^^ +error: delegation with early bound generics is not supported yet + --> $DIR/not-supported.rs:49:22 + | +LL | fn foo2(&self, x: T) -> T { x } + | ---------------------------- callee defined here +... +LL | reuse Trait::foo2 { &self.0 } + | ^^^^ + error: delegation with early bound generics is not supported yet --> $DIR/not-supported.rs:74:21 | @@ -160,24 +178,6 @@ LL | pub reuse to_reuse2::foo; LL | reuse to_reuse1::foo; | ^^^ -error[E0049]: method `foo2` has 0 type parameters but its trait declaration has 1 type parameter - --> $DIR/not-supported.rs:49:22 - | -LL | fn foo2(&self, x: T) -> T { x } - | - expected 1 type parameter -... -LL | reuse Trait::foo2 { &self.0 } - | ^^^^ found 0 type parameters - -error[E0195]: lifetime parameters or bounds on method `foo3` do not match the trait declaration - --> $DIR/not-supported.rs:52:29 - | -LL | fn foo3<'a: 'a>(_: &'a u32) {} - | -------- lifetimes in impl do not match this method in trait -... -LL | reuse ::foo3; - | ^^^^ lifetimes do not match method in trait - error: aborting due to 19 previous errors; 1 warning emitted Some errors have detailed explanations: E0049, E0195. diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr index dc93762c9b19f..b349332bcb9c3 100644 --- a/tests/ui/did_you_mean/bad-assoc-ty.stderr +++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr @@ -272,6 +272,17 @@ help: use type parameters instead LL | struct L(F) where F: Fn() -> T; | +++ ~ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/bad-assoc-ty.rs:82:38 + | +LL | fn foo(_: F) where F: Fn() -> _ {} + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn foo(_: F) where F: Fn() -> T {} + | +++ ~ + error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/bad-assoc-ty.rs:62:30 | @@ -305,28 +316,6 @@ help: use type parameters instead LL | union O where F: Fn() -> T { | +++ ~ -error[E0121]: the placeholder `_` is not allowed within types on item signatures for traits - --> $DIR/bad-assoc-ty.rs:77:29 - | -LL | trait P where F: Fn() -> _ { - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | trait P where F: Fn() -> T { - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/bad-assoc-ty.rs:82:38 - | -LL | fn foo(_: F) where F: Fn() -> _ {} - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn foo(_: F) where F: Fn() -> T {} - | +++ ~ - error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/bad-assoc-ty.rs:73:5 | @@ -339,6 +328,17 @@ help: wrap the field type in `ManuallyDrop<...>` LL | foo: std::mem::ManuallyDrop, | +++++++++++++++++++++++ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for traits + --> $DIR/bad-assoc-ty.rs:77:29 + | +LL | trait P where F: Fn() -> _ { + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | trait P where F: Fn() -> T { + | +++ ~ + error: aborting due to 29 previous errors; 1 warning emitted Some errors have detailed explanations: E0121, E0223, E0740. diff --git a/tests/ui/duplicate/duplicate-type-parameter.rs b/tests/ui/duplicate/duplicate-type-parameter.rs index 2751b3c8dc0ac..c2064b423f194 100644 --- a/tests/ui/duplicate/duplicate-type-parameter.rs +++ b/tests/ui/duplicate/duplicate-type-parameter.rs @@ -23,7 +23,6 @@ trait Qux {} impl Qux for Option {} //~^ ERROR the name `T` is already used -//~^^ ERROR the type parameter `T` is not constrained fn main() { } diff --git a/tests/ui/duplicate/duplicate-type-parameter.stderr b/tests/ui/duplicate/duplicate-type-parameter.stderr index 628f898d5c879..f23f2460a8acf 100644 --- a/tests/ui/duplicate/duplicate-type-parameter.stderr +++ b/tests/ui/duplicate/duplicate-type-parameter.stderr @@ -54,13 +54,6 @@ LL | impl Qux for Option {} | | | first use of `T` -error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/duplicate-type-parameter.rs:24:8 - | -LL | impl Qux for Option {} - | ^ unconstrained type parameter - -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0207, E0403. -For more information about an error, try `rustc --explain E0207`. +For more information about this error, try `rustc --explain E0403`. diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr index 77f351b28ef24..71eec4c16fd34 100644 --- a/tests/ui/error-codes/E0374.stderr +++ b/tests/ui/error-codes/E0374.stderr @@ -1,3 +1,11 @@ +error[E0392]: type parameter `T` is never used + --> $DIR/E0374.rs:4:12 + | +LL | struct Foo { + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures --> $DIR/E0374.rs:8:1 | @@ -7,14 +15,6 @@ LL | | where T: CoerceUnsized {} | = note: expected a single field to be coerced, none found -error[E0392]: type parameter `T` is never used - --> $DIR/E0374.rs:4:12 - | -LL | struct Foo { - | ^ unused type parameter - | - = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - error: aborting due to 2 previous errors Some errors have detailed explanations: E0374, E0392. diff --git a/tests/ui/error-codes/E0375.stderr b/tests/ui/error-codes/E0375.stderr index d5340022d68ce..af720bd40e7e3 100644 --- a/tests/ui/error-codes/E0375.stderr +++ b/tests/ui/error-codes/E0375.stderr @@ -1,12 +1,3 @@ -error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions - --> $DIR/E0375.rs:10:12 - | -LL | impl CoerceUnsized> for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions - | - = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced - = note: currently, 2 fields need coercions: `b` (`T` to `U`), `c` (`U` to `T`) - error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/E0375.rs:6:8 | @@ -32,6 +23,15 @@ help: the `Box` type always has a statically known size and allocates its conten LL | b: Box, | ++++ + +error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions + --> $DIR/E0375.rs:10:12 + | +LL | impl CoerceUnsized> for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions + | + = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced + = note: currently, 2 fields need coercions: `b` (`T` to `U`), `c` (`U` to `T`) + error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0375. diff --git a/tests/ui/error-codes/E0719.stderr b/tests/ui/error-codes/E0719.stderr index f048a8aabd449..7e8329db1f48f 100644 --- a/tests/ui/error-codes/E0719.stderr +++ b/tests/ui/error-codes/E0719.stderr @@ -16,14 +16,6 @@ LL | trait Foo: Iterator {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/E0719.rs:8:42 - | -LL | fn test() -> Box> { - | --------- ^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/E0719.rs:1:33 | @@ -34,6 +26,14 @@ LL | trait Foo: Iterator {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/E0719.rs:8:42 + | +LL | fn test() -> Box> { + | --------- ^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified --> $DIR/E0719.rs:14:38 | diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr index 7dfd79c728641..d8a85c8838d4d 100644 --- a/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr +++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_assoc_type.stderr @@ -18,6 +18,14 @@ LL | type Bop = impl std::fmt::Debug; = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +error: unconstrained opaque type + --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:6:16 + | +LL | type Bar = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: `Bar` must be used in combination with a concrete type within the same impl + error[E0658]: inherent associated types are unstable --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:5 | @@ -28,14 +36,6 @@ LL | type Bop = impl std::fmt::Debug; = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: unconstrained opaque type - --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:6:16 - | -LL | type Bar = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: `Bar` must be used in combination with a concrete type within the same impl - error: unconstrained opaque type --> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:16 | diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 5d598ec2969fc..c3f161469e308 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -56,26 +56,6 @@ LL | impl Fn<()> for Foo { | = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable -error[E0183]: manual implementations of `FnOnce` are experimental - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 - | -LL | impl FnOnce() for Foo1 { - | ^^^^^^^^ manual implementations of `FnOnce` are experimental - | - = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable - -error[E0229]: associated type bindings are not allowed here - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 - | -LL | impl FnOnce() for Foo1 { - | ^^^^^^^^ associated type not allowed here - | -help: parenthesized trait syntax expands to `FnOnce<(), Output=()>` - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 - | -LL | impl FnOnce() for Foo1 { - | ^^^^^^^^ - error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:6 | @@ -94,24 +74,6 @@ LL | impl FnMut<()> for Bar { | = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable -error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:6 - | -LL | impl FnOnce<()> for Baz { - | ^^^^^^^^^^ - | - = note: see issue #29625 for more information - = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0183]: manual implementations of `FnOnce` are experimental - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:6 - | -LL | impl FnOnce<()> for Baz { - | ^^^^^^^^^^ manual implementations of `FnOnce` are experimental - | - = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable - error[E0277]: expected a `FnMut()` closure, found `Foo` --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:17 | @@ -135,6 +97,44 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} = note: expected signature `extern "rust-call" fn(&Foo, ()) -> _` found signature `extern "rust-call" fn(Foo, ())` +error[E0183]: manual implementations of `FnOnce` are experimental + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 + | +LL | impl FnOnce() for Foo1 { + | ^^^^^^^^ manual implementations of `FnOnce` are experimental + | + = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable + +error[E0229]: associated type bindings are not allowed here + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 + | +LL | impl FnOnce() for Foo1 { + | ^^^^^^^^ associated type not allowed here + | +help: parenthesized trait syntax expands to `FnOnce<(), Output=()>` + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 + | +LL | impl FnOnce() for Foo1 { + | ^^^^^^^^ + +error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:6 + | +LL | impl FnOnce<()> for Baz { + | ^^^^^^^^^^ + | + = note: see issue #29625 for more information + = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0183]: manual implementations of `FnOnce` are experimental + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:6 + | +LL | impl FnOnce<()> for Baz { + | ^^^^^^^^^^ manual implementations of `FnOnce` are experimental + | + = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable + error[E0046]: not all trait items implemented, missing: `Output` --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:1 | diff --git a/tests/ui/generic-associated-types/bugs/issue-87735.stderr b/tests/ui/generic-associated-types/bugs/issue-87735.stderr index b80e3e798bd41..d80050652389d 100644 --- a/tests/ui/generic-associated-types/bugs/issue-87735.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-87735.stderr @@ -4,6 +4,91 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self LL | impl<'b, T, U> AsRef2 for Foo | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0309]: the parameter type `U` may not live long enough + --> $DIR/issue-87735.rs:34:21 + | +LL | type Output<'a> = FooRef<'a, U> where Self: 'a; + | -- ^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds... + | | + | the parameter type `U` must be valid for the lifetime `'a` as defined here... + | +note: ...that is required by this bound + --> $DIR/issue-87735.rs:23:22 + | +LL | struct FooRef<'a, U>(&'a [U]); + | ^^^^^^^ +help: consider adding an explicit lifetime bound + | +LL | type Output<'a> = FooRef<'a, U> where Self: 'a, U: 'a; + | +++++++ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/issue-87735.rs:31:15 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... +... +LL | T: AsRef2 = &'b [U]>, + | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/issue-87735.rs:7:31 + | +LL | type Output<'a> where Self: 'a; + | ^^ +help: consider adding an explicit lifetime bound + | +LL | T: AsRef2 = &'b [U]> + 'b, + | ++++ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/issue-87735.rs:36:31 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... +... +LL | fn as_ref2<'a>(&'a self) -> Self::Output<'a> { + | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/issue-87735.rs:7:31 + | +LL | type Output<'a> where Self: 'a; + | ^^ +help: consider adding an explicit lifetime bound + | +LL | T: AsRef2 = &'b [U]> + 'b, + | ++++ + +error: lifetime may not live long enough + --> $DIR/issue-87735.rs:37:5 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- lifetime `'b` defined here +... +LL | fn as_ref2<'a>(&'a self) -> Self::Output<'a> { + | -- lifetime `'a` defined here +LL | FooRef(self.0.as_ref2()) + | ^^^^^^^^^^^^^^^^^^^^^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + +error: lifetime may not live long enough + --> $DIR/issue-87735.rs:37:12 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- lifetime `'b` defined here +... +LL | fn as_ref2<'a>(&'a self) -> Self::Output<'a> { + | -- lifetime `'a` defined here +LL | FooRef(self.0.as_ref2()) + | ^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'b` + | + = help: consider adding the following bound: `'a: 'b` + +help: `'b` and `'a` must be the same: replace one with the other + +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0309. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/generic-associated-types/bugs/issue-88526.stderr b/tests/ui/generic-associated-types/bugs/issue-88526.stderr index ba87ac9185d30..5da3e3ff64ab9 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88526.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88526.stderr @@ -4,6 +4,20 @@ error[E0207]: the type parameter `I` is not constrained by the impl trait, self LL | impl<'q, Q, I, F> A for TestB | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0309]: the parameter type `F` may not live long enough + --> $DIR/issue-88526.rs:16:18 + | +LL | type I<'a> = &'a F; + | -- ^^^^^ ...so that the reference type `&'a F` does not outlive the data it points at + | | + | the parameter type `F` must be valid for the lifetime `'a` as defined here... + | +help: consider adding an explicit lifetime bound + | +LL | type I<'a> = &'a F where F: 'a; + | +++++++++++ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0309. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr index 8589d008a6b89..65854ed71587b 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr @@ -1,3 +1,23 @@ +error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/gat-trait-path-missing-lifetime.rs:8:10 + | +LL | fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t } + | -- expected 0 type parameters +... +LL | fn foo<'a, T1: X>(t : T1) -> T1::Y<'a> { + | ^^ ^^ + | | + | found 1 type parameter + +error[E0046]: not all trait items implemented, missing: `Y` + --> $DIR/gat-trait-path-missing-lifetime.rs:7:1 + | +LL | type Y<'a>; + | ---------- `Y` from trait +... +LL | impl X for T { + | ^^^^^^^^^^^^^^^ missing `Y` in implementation + error[E0107]: missing generics for associated type `X::Y` --> $DIR/gat-trait-path-missing-lifetime.rs:8:20 | @@ -31,26 +51,6 @@ help: add missing lifetime argument LL | fn foo<'a, T1: X = T1>>(t : T1) -> T1::Y<'a> { | ++++ -error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/gat-trait-path-missing-lifetime.rs:8:10 - | -LL | fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t } - | -- expected 0 type parameters -... -LL | fn foo<'a, T1: X>(t : T1) -> T1::Y<'a> { - | ^^ ^^ - | | - | found 1 type parameter - -error[E0046]: not all trait items implemented, missing: `Y` - --> $DIR/gat-trait-path-missing-lifetime.rs:7:1 - | -LL | type Y<'a>; - | ---------- `Y` from trait -... -LL | impl X for T { - | ^^^^^^^^^^^^^^^ missing `Y` in implementation - error: lifetime may not live long enough --> $DIR/gat-trait-path-missing-lifetime.rs:8:3 | diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index bad2ae9c9183c..fcd3e7d9aace8 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -53,22 +53,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 - | -LL | fn bar<'a>(arg: Box>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ -- -help: add missing lifetime argument - | -LL | fn bar<'a>(arg: Box>) {} - | ++ - error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | @@ -154,6 +138,22 @@ LL | type Y<'a>; | ^ ...because it contains the generic associated type `Y` = help: consider moving `Y` to another trait +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 + | +LL | fn bar<'a>(arg: Box>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 + | +LL | type Y<'a>; + | ^ -- +help: add missing lifetime argument + | +LL | fn bar<'a>(arg: Box>) {} + | ++ + error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 | diff --git a/tests/ui/generic-associated-types/issue-80433.stderr b/tests/ui/generic-associated-types/issue-80433.stderr index 2bbf87ff1ff4f..1ca080f5df26b 100644 --- a/tests/ui/generic-associated-types/issue-80433.stderr +++ b/tests/ui/generic-associated-types/issue-80433.stderr @@ -1,3 +1,14 @@ +error: missing required bound on `Output` + --> $DIR/issue-80433.rs:7:5 + | +LL | type Output<'a>; + | ^^^^^^^^^^^^^^^- + | | + | help: add the required where clause: `where Self: 'a` + | + = note: this bound is currently required to ensure that impls have maximum flexibility + = note: we are soliciting feedback, see issue #87479 for more information + error[E0107]: missing generics for associated type `TestMut::Output` --> $DIR/issue-80433.rs:21:47 | @@ -14,17 +25,6 @@ help: add missing lifetime argument LL | fn test_simpler<'a>(dst: &'a mut impl TestMut = &'a mut f32>) | ++++ -error: missing required bound on `Output` - --> $DIR/issue-80433.rs:7:5 - | -LL | type Output<'a>; - | ^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` - | - = note: this bound is currently required to ensure that impls have maximum flexibility - = note: we are soliciting feedback, see issue #87479 for more information - error[E0499]: cannot borrow `*dst` as mutable more than once at a time --> $DIR/issue-80433.rs:25:10 | diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.stderr b/tests/ui/generic-associated-types/missing_lifetime_args.stderr index 5980c60c51c6a..18c2d8c7eedf2 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_args.stderr @@ -14,42 +14,6 @@ help: add missing lifetime arguments LL | fn foo<'c, 'd>(_arg: Box = (&'c u32, &'d u32)>>) {} | ++++++++ -error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied - --> $DIR/missing_lifetime_args.rs:17:26 - | -LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} - | ^^^ -- -- supplied 2 lifetime arguments - | | - | expected 3 lifetime arguments - | -note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` - --> $DIR/missing_lifetime_args.rs:5:8 - | -LL | struct Foo<'a, 'b, 'c> { - | ^^^ -- -- -- -help: add missing lifetime argument - | -LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {} - | ++++ - -error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/missing_lifetime_args.rs:20:16 - | -LL | fn f<'a>(_arg: Foo<'a>) {} - | ^^^ -- supplied 1 lifetime argument - | | - | expected 3 lifetime arguments - | -note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` - --> $DIR/missing_lifetime_args.rs:5:8 - | -LL | struct Foo<'a, 'b, 'c> { - | ^^^ -- -- -- -help: add missing lifetime arguments - | -LL | fn f<'a>(_arg: Foo<'a, 'a, 'a>) {} - | ++++++++ - error[E0107]: missing generics for associated type `X::Y` --> $DIR/missing_lifetime_args.rs:11:32 | @@ -99,6 +63,42 @@ LL | type Y<'a, 'b>; | ^ ...because it contains the generic associated type `Y` = help: consider moving `Y` to another trait +error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied + --> $DIR/missing_lifetime_args.rs:17:26 + | +LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} + | ^^^ -- -- supplied 2 lifetime arguments + | | + | expected 3 lifetime arguments + | +note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` + --> $DIR/missing_lifetime_args.rs:5:8 + | +LL | struct Foo<'a, 'b, 'c> { + | ^^^ -- -- -- +help: add missing lifetime argument + | +LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {} + | ++++ + +error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied + --> $DIR/missing_lifetime_args.rs:20:16 + | +LL | fn f<'a>(_arg: Foo<'a>) {} + | ^^^ -- supplied 1 lifetime argument + | | + | expected 3 lifetime arguments + | +note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` + --> $DIR/missing_lifetime_args.rs:5:8 + | +LL | struct Foo<'a, 'b, 'c> { + | ^^^ -- -- -- +help: add missing lifetime arguments + | +LL | fn f<'a>(_arg: Foo<'a, 'a, 'a>) {} + | ++++++++ + error: aborting due to 6 previous errors Some errors have detailed explanations: E0038, E0107. diff --git a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs index cd3acf9bc41b1..f74d7cf281116 100644 --- a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs +++ b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs @@ -1,16 +1,10 @@ trait Foo { + //~^ ERROR cycle detected type Context<'c> where Self: 'c; } impl Foo for Box {} -//~^ ERROR `Foo` cannot be made into an object -//~| ERROR `Foo` cannot be made into an object -//~| ERROR cycle detected -//~| ERROR cycle detected -//~| ERROR cycle detected -//~| ERROR the trait bound `Box<(dyn Foo + 'static)>: Foo` is not satisfied -//~| ERROR not all trait items implemented fn main() {} diff --git a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr index 8e6b69f7461d9..29b226f16cb28 100644 --- a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr +++ b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr @@ -1,119 +1,22 @@ -error[E0391]: cycle detected when computing type of `` - --> $DIR/unknown-lifetime-ice-119827.rs:7:1 - | -LL | impl Foo for Box {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: ...which requires finding trait impls of `Foo`... +error[E0391]: cycle detected when finding trait impls of `Foo` --> $DIR/unknown-lifetime-ice-119827.rs:1:1 | LL | trait Foo { | ^^^^^^^^^ - = note: ...which again requires computing type of ``, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/unknown-lifetime-ice-119827.rs:1:1 | -LL | / trait Foo { -LL | | type Context<'c> -LL | | where -LL | | Self: 'c; -... | -LL | | -LL | | fn main() {} - | |____________^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error[E0391]: cycle detected when computing type of `` - --> $DIR/unknown-lifetime-ice-119827.rs:7:1 +note: ...which requires computing type of ``... + --> $DIR/unknown-lifetime-ice-119827.rs:8:1 | LL | impl Foo for Box {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module + = note: ...which again requires finding trait impls of `Foo`, completing the cycle +note: cycle used when checking that `Foo` is well-formed --> $DIR/unknown-lifetime-ice-119827.rs:1:1 | -LL | / trait Foo { -LL | | type Context<'c> -LL | | where -LL | | Self: 'c; -... | -LL | | -LL | | fn main() {} - | |____________^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error[E0391]: cycle detected when computing type of `` - --> $DIR/unknown-lifetime-ice-119827.rs:7:1 - | -LL | impl Foo for Box {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module - --> $DIR/unknown-lifetime-ice-119827.rs:1:1 - | -LL | / trait Foo { -LL | | type Context<'c> -LL | | where -LL | | Self: 'c; -... | -LL | | -LL | | fn main() {} - | |____________^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/unknown-lifetime-ice-119827.rs:7:22 - | -LL | impl Foo for Box {} - | ^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/unknown-lifetime-ice-119827.rs:2:10 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | type Context<'c> - | ^^^^^^^ ...because it contains the generic associated type `Context` - = help: consider moving `Context` to another trait - = help: only type `{type error}` implements the trait, consider using it directly instead - -error[E0277]: the trait bound `Box<(dyn Foo + 'static)>: Foo` is not satisfied - --> $DIR/unknown-lifetime-ice-119827.rs:7:14 - | -LL | impl Foo for Box {} - | ^^^^^^^^^^^^ the trait `Foo` is not implemented for `Box<(dyn Foo + 'static)>` - | - = help: the trait `Foo` is implemented for `Box<(dyn Foo + 'static)>` - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/unknown-lifetime-ice-119827.rs:7:14 - | -LL | impl Foo for Box {} - | ^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/unknown-lifetime-ice-119827.rs:2:10 - | LL | trait Foo { - | --- this trait cannot be made into an object... -LL | type Context<'c> - | ^^^^^^^ ...because it contains the generic associated type `Context` - = help: consider moving `Context` to another trait - = help: only type `std::boxed::Box<(dyn Foo + 'static)>` implements the trait, consider using it directly instead - -error[E0046]: not all trait items implemented, missing: `Context` - --> $DIR/unknown-lifetime-ice-119827.rs:7:1 - | -LL | type Context<'c> - | ---------------- `Context` from trait -... -LL | impl Foo for Box {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Context` in implementation + | ^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 7 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0038, E0046, E0277, E0391. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr index ebab994049314..959d6577d9a60 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr @@ -22,6 +22,15 @@ note: lifetime declared here LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { | ^ +error: lifetime may not live long enough + --> $DIR/impl-fn-hrtb-bounds.rs:6:9 + | +LL | |x| x + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is impl Debug + '2 + | has type `&'1 u8` + error: higher kinded lifetime bounds on nested opaque types are not supported yet --> $DIR/impl-fn-hrtb-bounds.rs:10:52 | @@ -34,6 +43,15 @@ note: lifetime declared here LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) { | ^^ +error: lifetime may not live long enough + --> $DIR/impl-fn-hrtb-bounds.rs:12:9 + | +LL | |x| x + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is impl Debug + '2 + | has type `&'1 u8` + error: higher kinded lifetime bounds on nested opaque types are not supported yet --> $DIR/impl-fn-hrtb-bounds.rs:16:52 | @@ -46,24 +64,6 @@ note: lifetime declared here LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { | ^^ -error: lifetime may not live long enough - --> $DIR/impl-fn-hrtb-bounds.rs:6:9 - | -LL | |x| x - | -- ^ returning this value requires that `'1` must outlive `'2` - | || - | |return type of closure is impl Debug + '2 - | has type `&'1 u8` - -error: lifetime may not live long enough - --> $DIR/impl-fn-hrtb-bounds.rs:12:9 - | -LL | |x| x - | -- ^ returning this value requires that `'1` must outlive `'2` - | || - | |return type of closure is impl Debug + '2 - | has type `&'1 u8` - error: lifetime may not live long enough --> $DIR/impl-fn-hrtb-bounds.rs:18:9 | diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs index e991b74a0f81a..e37284c5ab18c 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs @@ -5,7 +5,7 @@ trait T {} trait MyTrait { async fn foo() -> &'static impl T; - //~^ ERROR the associated type `::{opaque#0}` may not live long enough + //~^ ERROR the associated type `::{opaque#1}` may not live long enough } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr index 79a86b0a3aedf..a529a819bc9f7 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr @@ -1,13 +1,13 @@ -error[E0310]: the associated type `::{opaque#0}` may not live long enough +error[E0310]: the associated type `::{opaque#1}` may not live long enough --> $DIR/async-and-ret-ref.rs:7:5 | LL | async fn foo() -> &'static impl T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | the associated type `::{opaque#0}` must be valid for the static lifetime... + | the associated type `::{opaque#1}` must be valid for the static lifetime... | ...so that the reference type `&'static impl T` does not outlive the data it points at | - = help: consider adding an explicit lifetime bound `::{opaque#0}: 'static`... + = help: consider adding an explicit lifetime bound `::{opaque#1}: 'static`... error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/issues/issue-87340.rs b/tests/ui/impl-trait/issues/issue-87340.rs index 705a4addcb704..b1baaaa6ba5c1 100644 --- a/tests/ui/impl-trait/issues/issue-87340.rs +++ b/tests/ui/impl-trait/issues/issue-87340.rs @@ -9,6 +9,8 @@ impl X for () { //~^ ERROR `T` is not constrained by the impl trait, self type, or predicates type I = impl Sized; fn f() -> Self::I {} + //~^ ERROR type annotations needed + //~| ERROR type annotations needed } fn main() {} diff --git a/tests/ui/impl-trait/issues/issue-87340.stderr b/tests/ui/impl-trait/issues/issue-87340.stderr index 8513cb2881e1f..1be4087be4242 100644 --- a/tests/ui/impl-trait/issues/issue-87340.stderr +++ b/tests/ui/impl-trait/issues/issue-87340.stderr @@ -4,6 +4,19 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self LL | impl X for () { | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0282]: type annotations needed + --> $DIR/issue-87340.rs:11:23 + | +LL | fn f() -> Self::I {} + | ^^ cannot infer type for type parameter `T` + +error[E0282]: type annotations needed + --> $DIR/issue-87340.rs:11:15 + | +LL | fn f() -> Self::I {} + | ^^^^^^^ cannot infer type for type parameter `T` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0282. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/impl-trait/issues/issue-88236-2.stderr b/tests/ui/impl-trait/issues/issue-88236-2.stderr index 1e63338d6d195..1f5029f9d9fa7 100644 --- a/tests/ui/impl-trait/issues/issue-88236-2.stderr +++ b/tests/ui/impl-trait/issues/issue-88236-2.stderr @@ -22,18 +22,6 @@ note: lifetime declared here LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { | ^^ -error: higher kinded lifetime bounds on nested opaque types are not supported yet - --> $DIR/issue-88236-2.rs:25:78 - | -LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { - | ^^ - | -note: lifetime declared here - --> $DIR/issue-88236-2.rs:25:45 - | -LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { - | ^^ - error: implementation of `Hrtb` is not general enough --> $DIR/issue-88236-2.rs:20:5 | @@ -52,6 +40,18 @@ LL | &() = note: `Hrtb<'a>` would have to be implemented for the type `&()` = note: ...but `Hrtb<'0>` is actually implemented for the type `&'0 ()`, for some specific lifetime `'0` +error: higher kinded lifetime bounds on nested opaque types are not supported yet + --> $DIR/issue-88236-2.rs:25:78 + | +LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { + | ^^ + | +note: lifetime declared here + --> $DIR/issue-88236-2.rs:25:45 + | +LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { + | ^^ + error: lifetime may not live long enough --> $DIR/issue-88236-2.rs:27:5 | diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.stderr b/tests/ui/impl-trait/nested-rpit-hrtb.stderr index 0e0f76874e3af..4fc22712de616 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.stderr +++ b/tests/ui/impl-trait/nested-rpit-hrtb.stderr @@ -65,6 +65,15 @@ note: lifetime declared here LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {} | ^^ +error: implementation of `Bar` is not general enough + --> $DIR/nested-rpit-hrtb.rs:32:78 + | +LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {} + | ^^ implementation of `Bar` is not general enough + | + = note: `()` must implement `Bar<'a>` + = note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0` + error: higher kinded lifetime bounds on nested opaque types are not supported yet --> $DIR/nested-rpit-hrtb.rs:36:73 | @@ -77,15 +86,6 @@ note: lifetime declared here LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {} | ^^ -error: implementation of `Bar` is not general enough - --> $DIR/nested-rpit-hrtb.rs:32:78 - | -LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {} - | ^^ implementation of `Bar` is not general enough - | - = note: `()` must implement `Bar<'a>` - = note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0` - error[E0277]: the trait bound `for<'a> &'a (): Qux<'_>` is not satisfied --> $DIR/nested-rpit-hrtb.rs:36:64 | diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index c4bdd484fdbd3..bffe0447f8bb4 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -342,33 +342,6 @@ LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | = note: `impl Trait` is only allowed in arguments and return types of functions and methods -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:239:7 - | -LL | impl T {} - | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 - = note: `#[deny(invalid_type_param_default)]` on by default - -error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:246:36 - | -LL | fn in_method_generic_param_default(_: T) {} - | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #36887 - -error[E0118]: no nominal type found for inherent implementation - --> $DIR/where-allowed.rs:239:1 - | -LL | impl T {} - | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type - | - = note: either implement a trait on it or create a newtype to wrap it instead - error[E0283]: type annotations needed --> $DIR/where-allowed.rs:46:57 | @@ -389,6 +362,24 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani - impl Fn for Box where Args: Tuple, F: Fn, A: Allocator, F: ?Sized; +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/where-allowed.rs:239:7 + | +LL | impl T {} + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 + = note: `#[deny(invalid_type_param_default)]` on by default + +error[E0118]: no nominal type found for inherent implementation + --> $DIR/where-allowed.rs:239:1 + | +LL | impl T {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type + | + = note: either implement a trait on it or create a newtype to wrap it instead + error[E0599]: no function or associated item named `into_vec` found for slice `[_]` in the current scope --> $DIR/where-allowed.rs:81:5 | @@ -428,6 +419,15 @@ LL | type Out = impl Debug; | = note: `Out` must be used in combination with a concrete type within the same impl +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/where-allowed.rs:246:36 + | +LL | fn in_method_generic_param_default(_: T) {} + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #36887 + error: aborting due to 50 previous errors Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0599, E0658, E0666. diff --git a/tests/ui/impl-unused-tps.stderr b/tests/ui/impl-unused-tps.stderr index 93215326c2fe3..af427cb5f3e3c 100644 --- a/tests/ui/impl-unused-tps.stderr +++ b/tests/ui/impl-unused-tps.stderr @@ -1,3 +1,25 @@ +error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` + --> $DIR/impl-unused-tps.rs:27:1 + | +LL | impl Foo for [isize;0] { + | ---------------------------- first implementation here +... +LL | impl Foo for U { + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` + +error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) +note: required for `([isize; 0], _)` to implement `Bar` + --> $DIR/impl-unused-tps.rs:31:11 + | +LL | impl Bar for T { + | - ^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: 126 redundant requirements hidden + = note: required for `([isize; 0], _)` to implement `Bar` + error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates --> $DIR/impl-unused-tps.rs:15:8 | @@ -28,28 +50,6 @@ error[E0207]: the type parameter `V` is not constrained by the impl trait, self LL | impl Foo for T | ^ unconstrained type parameter -error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` - --> $DIR/impl-unused-tps.rs:27:1 - | -LL | impl Foo for [isize;0] { - | ---------------------------- first implementation here -... -LL | impl Foo for U { - | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` - -error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) -note: required for `([isize; 0], _)` to implement `Bar` - --> $DIR/impl-unused-tps.rs:31:11 - | -LL | impl Bar for T { - | - ^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 126 redundant requirements hidden - = note: required for `([isize; 0], _)` to implement `Bar` - error: aborting due to 7 previous errors Some errors have detailed explanations: E0119, E0207, E0275. diff --git a/tests/ui/infinite/infinite-trait-alias-recursion.stderr b/tests/ui/infinite/infinite-trait-alias-recursion.stderr index 220d81031ac22..b3980cb935efe 100644 --- a/tests/ui/infinite/infinite-trait-alias-recursion.stderr +++ b/tests/ui/infinite/infinite-trait-alias-recursion.stderr @@ -16,7 +16,7 @@ LL | trait T3 = T1 + T3; | ^^ = note: ...which again requires computing the super predicates of `T1`, completing the cycle = note: trait aliases cannot be recursive -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `T1` is well-formed --> $DIR/infinite-trait-alias-recursion.rs:3:1 | LL | trait T1 = T2; diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr index 57ca1b24d2a38..ab1bcc44cb8b0 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr @@ -18,17 +18,11 @@ LL | type X3 = X1; = note: type aliases cannot be recursive = help: consider using a struct, enum, or union instead to break the cycle = help: see for more information -note: cycle used when collecting item types in top-level module - --> $DIR/infinite-type-alias-mutual-recursion.rs:3:1 +note: cycle used when checking that `X1` is well-formed + --> $DIR/infinite-type-alias-mutual-recursion.rs:6:1 | -LL | / #![cfg_attr(feature, feature(lazy_type_alias))] -LL | | #![allow(incomplete_features)] -LL | | -LL | | type X1 = X2; -... | -LL | | -LL | | fn main() {} - | |____________^ +LL | type X1 = X2; + | ^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr b/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr index efafc9b75cdbf..43364892bb53a 100644 --- a/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr +++ b/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr @@ -8,17 +8,11 @@ LL | type X = Vec; = note: type aliases cannot be recursive = help: consider using a struct, enum, or union instead to break the cycle = help: see for more information -note: cycle used when collecting item types in top-level module - --> $DIR/infinite-vec-type-recursion.rs:3:1 +note: cycle used when checking that `X` is well-formed + --> $DIR/infinite-vec-type-recursion.rs:6:1 | -LL | / #![cfg_attr(feature, feature(lazy_type_alias))] -LL | | #![allow(incomplete_features)] -LL | | -LL | | type X = Vec; -... | -LL | | #[rustfmt::skip] -LL | | fn main() { let b: X = Vec::new(); } - | |____________________________________^ +LL | type X = Vec; + | ^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-1.stderr b/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-1.stderr index 53131f9130d9c..234060ab5c897 100644 --- a/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-1.stderr +++ b/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-1.stderr @@ -10,15 +10,11 @@ note: ...which requires const-evaluating + checking `X::A::{constant#0}`... LL | A = X::A as isize, | ^^^^^^^^^^^^^ = note: ...which again requires simplifying constant for the type system `X::A::{constant#0}`, completing the cycle -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `X` is well-formed --> $DIR/issue-23302-1.rs:3:1 | -LL | / enum X { -LL | | A = X::A as isize, -LL | | } -LL | | -LL | | fn main() { } - | |_____________^ +LL | enum X { + | ^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-2.stderr b/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-2.stderr index d55d88762be43..9bd95239c8335 100644 --- a/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-2.stderr +++ b/tests/ui/issues/issue-23302-enum-infinite-recursion/issue-23302-2.stderr @@ -10,16 +10,11 @@ note: ...which requires const-evaluating + checking `Y::A::{constant#0}`... LL | A = Y::B as isize, | ^^^^^^^^^^^^^ = note: ...which again requires simplifying constant for the type system `Y::A::{constant#0}`, completing the cycle -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `Y` is well-formed --> $DIR/issue-23302-2.rs:3:1 | -LL | / enum Y { -LL | | A = Y::B as isize, -LL | | B, -LL | | } -LL | | -LL | | fn main() { } - | |_____________^ +LL | enum Y { + | ^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-29861.rs b/tests/ui/issues/issue-29861.rs index 58f8eb5362c2e..875c168185feb 100644 --- a/tests/ui/issues/issue-29861.rs +++ b/tests/ui/issues/issue-29861.rs @@ -14,6 +14,7 @@ impl<'a, T: 'a> MakeRef2 for T { } fn foo() -> ::Ref2 { &String::from("foo") } +//~^ ERROR temporary value dropped while borrowed fn main() { println!("{}", foo()); diff --git a/tests/ui/issues/issue-29861.stderr b/tests/ui/issues/issue-29861.stderr index e7860c19eaa45..a25cbf0515d84 100644 --- a/tests/ui/issues/issue-29861.stderr +++ b/tests/ui/issues/issue-29861.stderr @@ -4,6 +4,18 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, LL | impl<'a, T: 'a> MakeRef2 for T { | ^^ unconstrained lifetime parameter -error: aborting due to 1 previous error +error[E0716]: temporary value dropped while borrowed + --> $DIR/issue-29861.rs:16:43 + | +LL | fn foo() -> ::Ref2 { &String::from("foo") } + | ^^^^^^^^^^^^^^^^^^^ -- borrow later used here + | | | + | | temporary value is freed at the end of this statement + | creates a temporary value which is freed while still in use + | + = note: consider using a `let` binding to create a longer lived value + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0716. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/issues/issue-34373.stderr b/tests/ui/issues/issue-34373.stderr index 13667cd920e9b..784fe935bf8ae 100644 --- a/tests/ui/issues/issue-34373.stderr +++ b/tests/ui/issues/issue-34373.stderr @@ -10,17 +10,11 @@ note: ...which requires expanding type alias `DefaultFoo`... LL | type DefaultFoo = Foo; | ^^^ = note: ...which again requires computing type of `Foo::T`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/issue-34373.rs:1:1 - | -LL | / #![allow(warnings)] -LL | | -LL | | trait Trait { -LL | | fn foo(_: T) {} -... | -LL | | fn main() { -LL | | } - | |_^ +note: cycle used when checking that `Foo` is well-formed + --> $DIR/issue-34373.rs:7:1 + | +LL | pub struct Foo>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error[E0038]: the trait `Trait` cannot be made into an object diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs b/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs index eceefa719ec80..7bc91ef426b6c 100644 --- a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs +++ b/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs @@ -3,6 +3,6 @@ impl Loop {} //~ ERROR the type parameter `T` is not constrained -type Loop = Loop; +type Loop = Loop; //~ ERROR overflow fn main() {} diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr b/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr index b65c84226ce93..bcffa02ddd424 100644 --- a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr +++ b/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr @@ -4,6 +4,15 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self LL | impl Loop {} | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0275]: overflow normalizing the type alias `Loop` + --> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:16 + | +LL | type Loop = Loop; + | ^^^^^^^ + | + = note: in case this is a recursive type alias, consider using a struct, enum, or union instead + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0275. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index 0c67d7328f2bc..c4285dbf4bdbb 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -32,12 +32,6 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>` LL | impl Fn(&isize) for Error { | ^^^^^^^^^^ -error[E0220]: associated type `B` not found for `Self` - --> $DIR/issue-95023.rs:8:44 - | -LL | fn foo(&self) -> Self::B<{ N }>; - | ^ help: `Self` has the following associated type: `Output` - error[E0277]: expected a `FnMut(&isize)` closure, found `Error` --> $DIR/issue-95023.rs:3:21 | @@ -56,6 +50,12 @@ LL | impl Fn(&isize) for Error { | = help: implement the missing item: `fn call(&self, _: (&isize,)) -> >::Output { todo!() }` +error[E0220]: associated type `B` not found for `Self` + --> $DIR/issue-95023.rs:8:44 + | +LL | fn foo(&self) -> Self::B<{ N }>; + | ^ help: `Self` has the following associated type: `Output` + error[E0220]: associated type `B` not found for `Self` --> $DIR/issue-95023.rs:8:44 | diff --git a/tests/ui/lifetimes/missing-lifetime-in-alias.stderr b/tests/ui/lifetimes/missing-lifetime-in-alias.stderr index 9183e6302eefc..b868d4b15a1aa 100644 --- a/tests/ui/lifetimes/missing-lifetime-in-alias.stderr +++ b/tests/ui/lifetimes/missing-lifetime-in-alias.stderr @@ -25,22 +25,6 @@ help: consider using one of the available lifetimes here LL | type C<'a, 'b> = as Trait<'lifetime>>::Bar; | +++++++++++ -error[E0107]: missing generics for associated type `Trait::Bar` - --> $DIR/missing-lifetime-in-alias.rs:27:36 - | -LL | type C<'a, 'b> = as Trait>::Bar; - | ^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'b` - --> $DIR/missing-lifetime-in-alias.rs:4:10 - | -LL | type Bar<'b> - | ^^^ -- -help: add missing lifetime argument - | -LL | type C<'a, 'b> = as Trait>::Bar<'a>; - | ++++ - error[E0477]: the type `Impl<'a>` does not fulfill the required lifetime --> $DIR/missing-lifetime-in-alias.rs:16:20 | @@ -60,6 +44,22 @@ help: copy the `where` clause predicates from the trait LL | type Bar<'b> = &'b () where Self: 'b; | ++++++++++++++ +error[E0107]: missing generics for associated type `Trait::Bar` + --> $DIR/missing-lifetime-in-alias.rs:27:36 + | +LL | type C<'a, 'b> = as Trait>::Bar; + | ^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'b` + --> $DIR/missing-lifetime-in-alias.rs:4:10 + | +LL | type Bar<'b> + | ^^^ -- +help: add missing lifetime argument + | +LL | type C<'a, 'b> = as Trait>::Bar<'a>; + | ++++ + error: aborting due to 4 previous errors Some errors have detailed explanations: E0106, E0107, E0477. diff --git a/tests/ui/marker_trait_attr/override-item-on-marker-trait.stderr b/tests/ui/marker_trait_attr/override-item-on-marker-trait.stderr index 92a54cff7f5fa..ab86df9c8a5b2 100644 --- a/tests/ui/marker_trait_attr/override-item-on-marker-trait.stderr +++ b/tests/ui/marker_trait_attr/override-item-on-marker-trait.stderr @@ -1,15 +1,3 @@ -error[E0715]: impls for marker traits cannot contain items - --> $DIR/override-item-on-marker-trait.rs:12:1 - | -LL | impl Marker for OverrideConst { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0715]: impls for marker traits cannot contain items - --> $DIR/override-item-on-marker-trait.rs:18:1 - | -LL | impl Marker for OverrideFn { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0714]: marker traits cannot have associated items --> $DIR/override-item-on-marker-trait.rs:5:5 | @@ -22,6 +10,18 @@ error[E0714]: marker traits cannot have associated items LL | fn do_something() {} | ^^^^^^^^^^^^^^^^^ +error[E0715]: impls for marker traits cannot contain items + --> $DIR/override-item-on-marker-trait.rs:12:1 + | +LL | impl Marker for OverrideConst { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0715]: impls for marker traits cannot contain items + --> $DIR/override-item-on-marker-trait.rs:18:1 + | +LL | impl Marker for OverrideFn { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 4 previous errors Some errors have detailed explanations: E0714, E0715. diff --git a/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr b/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr index e7fcdbd0c9c53..6beb04e5b9372 100644 --- a/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr +++ b/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr @@ -1,21 +1,3 @@ -error[E0038]: the trait `Baz` cannot be made into an object - --> $DIR/object-safety-supertrait-mentions-Self.rs:16:31 - | -LL | fn make_baz(t: &T) -> &dyn Baz { - | ^^^^^^^ `Baz` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety-supertrait-mentions-Self.rs:8:13 - | -LL | trait Baz : Bar { - | --- ^^^^^^^^^ ...because it uses `Self` as a type parameter - | | - | this trait cannot be made into an object... -help: consider using an opaque type instead - | -LL | fn make_baz(t: &T) -> &impl Baz { - | ~~~~ - error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/object-safety-supertrait-mentions-Self.rs:8:13 | @@ -36,6 +18,24 @@ help: consider relaxing the implicit `Sized` restriction LL | trait Bar { | ++++++++ +error[E0038]: the trait `Baz` cannot be made into an object + --> $DIR/object-safety-supertrait-mentions-Self.rs:16:31 + | +LL | fn make_baz(t: &T) -> &dyn Baz { + | ^^^^^^^ `Baz` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety-supertrait-mentions-Self.rs:8:13 + | +LL | trait Baz : Bar { + | --- ^^^^^^^^^ ...because it uses `Self` as a type parameter + | | + | this trait cannot be made into an object... +help: consider using an opaque type instead + | +LL | fn make_baz(t: &T) -> &impl Baz { + | ~~~~ + error: aborting due to 2 previous errors Some errors have detailed explanations: E0038, E0277. diff --git a/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr index 1c71cdacd89b6..29b0b25a564d9 100644 --- a/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-type-no-body-semantic-fail.stderr @@ -82,15 +82,6 @@ LL | type W where Self: Eq; = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0592]: duplicate definitions with name `W` - --> $DIR/impl-item-type-no-body-semantic-fail.rs:18:5 - | -LL | type W: Ord where Self: Eq; - | ------ other definition for `W` -... -LL | type W where Self: Eq; - | ^^^^^^ duplicate definitions for `W` - error[E0277]: the trait bound `X: Eq` is not satisfied --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:23 | @@ -119,6 +110,15 @@ LL + #[derive(Eq)] LL | struct X; | +error[E0592]: duplicate definitions with name `W` + --> $DIR/impl-item-type-no-body-semantic-fail.rs:18:5 + | +LL | type W: Ord where Self: Eq; + | ------ other definition for `W` +... +LL | type W where Self: Eq; + | ^^^^^^ duplicate definitions for `W` + error: aborting due to 13 previous errors Some errors have detailed explanations: E0277, E0592, E0658. diff --git a/tests/ui/resolve/resolve-self-in-impl.stderr b/tests/ui/resolve/resolve-self-in-impl.stderr index 183a17171f7fc..62cfdb4dc78c1 100644 --- a/tests/ui/resolve/resolve-self-in-impl.stderr +++ b/tests/ui/resolve/resolve-self-in-impl.stderr @@ -14,6 +14,20 @@ LL | impl Tr for S {} | = note: replace `Self` with a different type +error[E0391]: cycle detected when computing trait implemented by `` + --> $DIR/resolve-self-in-impl.rs:19:1 + | +LL | impl Tr for S {} + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which immediately requires computing trait implemented by `` again +note: cycle used when building specialization graph of trait `Tr` + --> $DIR/resolve-self-in-impl.rs:4:1 + | +LL | trait Tr { + | ^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + error: `Self` is not valid in the self type of an impl block --> $DIR/resolve-self-in-impl.rs:16:6 | @@ -38,26 +52,6 @@ LL | impl (Self, Self) {} | = note: replace `Self` with a different type -error[E0391]: cycle detected when computing trait implemented by `` - --> $DIR/resolve-self-in-impl.rs:19:1 - | -LL | impl Tr for S {} - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...which immediately requires computing trait implemented by `` again -note: cycle used when collecting item types in top-level module - --> $DIR/resolve-self-in-impl.rs:1:1 - | -LL | / #![feature(associated_type_defaults)] -LL | | -LL | | struct S(T); -LL | | trait Tr { -... | -LL | | -LL | | fn main() {} - | |____________^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr index eb0f18edd3401..00efbb52f159b 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr @@ -1,5 +1,5 @@ error: `#[target_feature(..)]` cannot be applied to safe trait method - --> $DIR/trait-impl.rs:22:5 + --> $DIR/trait-impl.rs:13:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method @@ -8,7 +8,7 @@ LL | fn foo(&self) {} | ------------- not an `unsafe` function error: `#[target_feature(..)]` cannot be applied to safe trait method - --> $DIR/trait-impl.rs:13:5 + --> $DIR/trait-impl.rs:22:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr index 8f374bc4d8f27..e45c1a1f46fb6 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr @@ -13,6 +13,15 @@ LL | impl const Default for A { = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change +error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates + --> $DIR/derive-const-use.rs:7:6 + | +LL | impl const Default for A { + | ^^^^^ unconstrained const parameter + | + = note: expressions using a const parameter must map each value to a distinct output value + = note: proving the result of expressions other than the parameter are unique is not supported + error: const `impl` for trait `Default` which is not marked with `#[const_trait]` --> $DIR/derive-const-use.rs:15:16 | @@ -24,20 +33,23 @@ LL | #[derive_const(Default, PartialEq)] = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates - --> $DIR/derive-const-use.rs:7:6 - | -LL | impl const Default for A { - | ^^^^^ unconstrained const parameter | = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported -error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates +error[E0308]: mismatched types + --> $DIR/derive-const-use.rs:16:14 | - = note: expressions using a const parameter must map each value to a distinct output value - = note: proving the result of expressions other than the parameter are unique is not supported +LL | #[derive_const(Default, PartialEq)] + | --------- in this derive macro expansion +LL | pub struct S((), A); + | ^^ expected `host`, found `true` + | + = note: expected constant `host` + found constant `true` + = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0207, E0635. +Some errors have detailed explanations: E0207, E0308, E0635. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr index 2c63c0217aba1..77aee6a8bb8f8 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr @@ -24,12 +24,6 @@ LL | trait Bar: ~const Foo {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:18:24 - | -LL | const fn foo(x: &T) { - | ^^^ - error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/super-traits-fail-3.rs:12:19 | @@ -38,5 +32,11 @@ LL | trait Bar: ~const Foo {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:18:24 + | +LL | const fn foo(x: &T) { + | ^^^ + error: aborting due to 5 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr index 92a9c347a075e..8151b9aaa23de 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr @@ -262,16 +262,6 @@ LL | const CONSTANT: () = (); = help: add `#![feature(generic_const_items)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: inherent associated types are unstable - --> $DIR/tilde-const-invalid-places.rs:44:5 - | -LL | type Type = (); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #8995 for more information - = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0392]: type parameter `T` is never used --> $DIR/tilde-const-invalid-places.rs:11:19 | @@ -304,6 +294,16 @@ note: required by a bound in `NonConstTrait::Type` LL | type Type: ~const Trait; | ^^^^^^^^^^^^ required by this bound in `NonConstTrait::Type` +error[E0658]: inherent associated types are unstable + --> $DIR/tilde-const-invalid-places.rs:44:5 + | +LL | type Type = (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #8995 for more information + = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error: aborting due to 30 previous errors Some errors have detailed explanations: E0275, E0392, E0658, E0740. diff --git a/tests/ui/span/issue-35987.rs b/tests/ui/span/issue-35987.rs index 3a6e6ffe24910..d52a3793af971 100644 --- a/tests/ui/span/issue-35987.rs +++ b/tests/ui/span/issue-35987.rs @@ -7,6 +7,7 @@ impl Add for Foo { type Output = usize; fn add(self, rhs: Self) -> Self::Output { + //~^ ERROR ambiguous associated type unimplemented!(); } } diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr index d3014f276fd84..36c59137b3125 100644 --- a/tests/ui/span/issue-35987.stderr +++ b/tests/ui/span/issue-35987.stderr @@ -9,6 +9,20 @@ LL | impl Add for Foo { | | | found this type parameter -error: aborting due to 1 previous error +error[E0223]: ambiguous associated type + --> $DIR/issue-35987.rs:9:32 + | +LL | fn add(self, rhs: Self) -> Self::Output { + | ^^^^^^^^^^^^ + | +help: use fully-qualified syntax + | +LL | fn add(self, rhs: Self) -> as BitOr>::Output { + | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | fn add(self, rhs: Self) -> as IntoFuture>::Output { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0404`. +Some errors have detailed explanations: E0223, E0404. +For more information about an error, try `rustc --explain E0223`. diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index a7d636b63bd27..61a2925f582b2 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -150,6 +150,14 @@ help: consider introducing a named lifetime parameter LL | fn g<'a>(mut x: impl Iterator) -> Option<&()> { x.next() } | ++++ ++ +error: lifetime may not live long enough + --> $DIR/impl-trait-missing-lifetime-gated.rs:19:67 + | +LL | async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } + | ----------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` + | | + | return type `impl Future>` contains a lifetime `'1` + error[E0658]: anonymous lifetimes in `impl Trait` are unstable --> $DIR/impl-trait-missing-lifetime-gated.rs:25:35 | @@ -176,6 +184,14 @@ help: consider introducing a named lifetime parameter LL | fn g<'a>(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } | ++++ ~~ +error: lifetime may not live long enough + --> $DIR/impl-trait-missing-lifetime-gated.rs:38:73 + | +LL | async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } + | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` + | | + | return type `impl Future>` contains a lifetime `'1` + error[E0658]: anonymous lifetimes in `impl Trait` are unstable --> $DIR/impl-trait-missing-lifetime-gated.rs:46:18 | @@ -228,22 +244,6 @@ help: consider introducing a named lifetime parameter LL | fn g<'a>(mut x: impl Foo<'a, ()>) -> Option<&()> { x.next() } | ++++ +++ -error: lifetime may not live long enough - --> $DIR/impl-trait-missing-lifetime-gated.rs:19:67 - | -LL | async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } - | ----------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` - | | - | return type `impl Future>` contains a lifetime `'1` - -error: lifetime may not live long enough - --> $DIR/impl-trait-missing-lifetime-gated.rs:38:73 - | -LL | async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } - | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static` - | | - | return type `impl Future>` contains a lifetime `'1` - error: aborting due to 16 previous errors Some errors have detailed explanations: E0106, E0658. diff --git a/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr b/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr index 398caa98b84db..769f3bd64f320 100644 --- a/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr +++ b/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr @@ -1,40 +1,3 @@ -error[E0782]: trait objects must include the `dyn` keyword - --> $DIR/suggest-blanket-impl-local-trait.rs:13:24 - | -LL | impl LocalTraitTwo for LocalTraitOne {} - | ^^^^^^^^^^^^^ - | -help: add `dyn` keyword before this trait - | -LL | impl LocalTraitTwo for dyn LocalTraitOne {} - | +++ -help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` - | -LL | impl LocalTraitTwo for T {} - | ++++++++++++++++++ ~ - -error[E0782]: trait objects must include the `dyn` keyword - --> $DIR/suggest-blanket-impl-local-trait.rs:18:23 - | -LL | impl fmt::Display for LocalTraitOne { - | ^^^^^^^^^^^^^ - | -help: add `dyn` keyword before this trait - | -LL | impl fmt::Display for dyn LocalTraitOne { - | +++ - -error[E0782]: trait objects must include the `dyn` keyword - --> $DIR/suggest-blanket-impl-local-trait.rs:26:23 - | -LL | impl fmt::Display for LocalTraitTwo + Send { - | ^^^^^^^^^^^^^^^^^^^^ - | -help: add `dyn` keyword before this trait - | -LL | impl fmt::Display for dyn LocalTraitTwo + Send { - | +++ - error[E0782]: trait objects must include the `dyn` keyword --> $DIR/suggest-blanket-impl-local-trait.rs:34:24 | @@ -65,6 +28,21 @@ help: alternatively use a blanket implementation to implement `LocalTraitOne` fo LL | impl LocalTraitOne for T {} | ++++++++++++++++++++++++ ~ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:13:24 + | +LL | impl LocalTraitTwo for LocalTraitOne {} + | ^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | impl LocalTraitTwo for dyn LocalTraitOne {} + | +++ +help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` + | +LL | impl LocalTraitTwo for T {} + | ++++++++++++++++++ ~ + error[E0782]: trait objects must include the `dyn` keyword --> $DIR/suggest-blanket-impl-local-trait.rs:46:29 | @@ -80,6 +58,28 @@ help: alternatively use a blanket implementation to implement `GenericTrait` LL | impl GenericTrait for T {} | ++++++++++++++++++ ~ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:18:23 + | +LL | impl fmt::Display for LocalTraitOne { + | ^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | impl fmt::Display for dyn LocalTraitOne { + | +++ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-blanket-impl-local-trait.rs:26:23 + | +LL | impl fmt::Display for LocalTraitTwo + Send { + | ^^^^^^^^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | impl fmt::Display for dyn LocalTraitTwo + Send { + | +++ + error[E0782]: trait objects must include the `dyn` keyword --> $DIR/suggest-blanket-impl-local-trait.rs:53:35 | diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.rs b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.rs index c4384bce3a9b8..a5ab8be7f45a7 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.rs +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.rs @@ -3,9 +3,12 @@ pub trait Trait<'a, T> {} pub struct Struct; +//~^ ERROR `T` is never used pub enum Enum {} +//~^ ERROR `T` is never used pub union Union { + //~^ ERROR `T` is never used f1: usize, } @@ -15,8 +18,10 @@ impl<'a, T> Struct for Trait<'a, T> {} impl<'a, T> Enum for Trait<'a, T> {} //~^ ERROR expected trait, found enum `Enum` +//~| ERROR trait objects must include the `dyn` keyword impl<'a, T> Union for Trait<'a, T> {} //~^ ERROR expected trait, found union `Union` +//~| ERROR trait objects must include the `dyn` keyword fn main() {} diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr index 87e7164362091..2893370570d24 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found struct `Struct` - --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:12:13 + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:15:13 | LL | impl<'a, T> Struct for Trait<'a, T> {} | ^^^^^^^^^ not a trait @@ -10,7 +10,7 @@ LL | impl<'a, T> Trait<'a, T> for Struct {} | ~~~~~~~~~~~~ ~~~~~~~~~ error[E0404]: expected trait, found enum `Enum` - --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:16:13 + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13 | LL | impl<'a, T> Enum for Trait<'a, T> {} | ^^^^^^^ not a trait @@ -21,7 +21,7 @@ LL | impl<'a, T> Trait<'a, T> for Enum {} | ~~~~~~~~~~~~ ~~~~~~~ error[E0404]: expected trait, found union `Union` - --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13 + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:23:13 | LL | impl<'a, T> Union for Trait<'a, T> {} | ^^^^^^^^ not a trait @@ -31,8 +31,35 @@ help: `impl` items mention the trait being implemented first and the type it is LL | impl<'a, T> Trait<'a, T> for Union {} | ~~~~~~~~~~~~ ~~~~~~~~ +error[E0392]: type parameter `T` is never used + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:5:19 + | +LL | pub struct Struct; + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + +error[E0392]: type parameter `T` is never used + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:7:15 + | +LL | pub enum Enum {} + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + +error[E0392]: type parameter `T` is never used + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:10:17 + | +LL | pub union Union { + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + error[E0782]: trait objects must include the `dyn` keyword - --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:12:27 + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:15:27 | LL | impl<'a, T> Struct for Trait<'a, T> {} | ^^^^^^^^^^^^ @@ -42,7 +69,29 @@ help: add `dyn` keyword before this trait LL | impl<'a, T> Struct for dyn Trait<'a, T> {} | +++ -error: aborting due to 4 previous errors +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:25 + | +LL | impl<'a, T> Enum for Trait<'a, T> {} + | ^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | impl<'a, T> Enum for dyn Trait<'a, T> {} + | +++ + +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:23:26 + | +LL | impl<'a, T> Union for Trait<'a, T> {} + | ^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | impl<'a, T> Union for dyn Trait<'a, T> {} + | +++ + +error: aborting due to 9 previous errors -Some errors have detailed explanations: E0404, E0782. -For more information about an error, try `rustc --explain E0404`. +Some errors have detailed explanations: E0392, E0404, E0782. +For more information about an error, try `rustc --explain E0392`. diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.rs b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.rs index 947bc2c79654b..951e7313f0a58 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.rs +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.rs @@ -1,9 +1,12 @@ pub trait Trait<'a, T> {} pub struct Struct; +//~^ ERROR `T` is never used pub enum Enum {} +//~^ ERROR `T` is never used pub union Union { + //~^ ERROR `T` is never used f1: usize, } @@ -14,8 +17,12 @@ impl<'a, T> Struct for Trait<'a, T> {} impl<'a, T> Enum for Trait<'a, T> {} //~^ ERROR expected trait, found enum `Enum` +//~| WARNING trait objects without an explicit `dyn` are deprecated +//~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! impl<'a, T> Union for Trait<'a, T> {} //~^ ERROR expected trait, found union `Union` +//~| WARNING trait objects without an explicit `dyn` are deprecated +//~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! fn main() {} diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index 0098814f81e78..5d805d97a4358 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found struct `Struct` - --> $DIR/suggest-swapping-self-ty-and-trait.rs:10:13 + --> $DIR/suggest-swapping-self-ty-and-trait.rs:13:13 | LL | impl<'a, T> Struct for Trait<'a, T> {} | ^^^^^^^^^ not a trait @@ -10,7 +10,7 @@ LL | impl<'a, T> Trait<'a, T> for Struct {} | ~~~~~~~~~~~~ ~~~~~~~~~ error[E0404]: expected trait, found enum `Enum` - --> $DIR/suggest-swapping-self-ty-and-trait.rs:15:13 + --> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13 | LL | impl<'a, T> Enum for Trait<'a, T> {} | ^^^^^^^ not a trait @@ -21,7 +21,7 @@ LL | impl<'a, T> Trait<'a, T> for Enum {} | ~~~~~~~~~~~~ ~~~~~~~ error[E0404]: expected trait, found union `Union` - --> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13 + --> $DIR/suggest-swapping-self-ty-and-trait.rs:23:13 | LL | impl<'a, T> Union for Trait<'a, T> {} | ^^^^^^^^ not a trait @@ -31,8 +31,35 @@ help: `impl` items mention the trait being implemented first and the type it is LL | impl<'a, T> Trait<'a, T> for Union {} | ~~~~~~~~~~~~ ~~~~~~~~ +error[E0392]: type parameter `T` is never used + --> $DIR/suggest-swapping-self-ty-and-trait.rs:3:19 + | +LL | pub struct Struct; + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + +error[E0392]: type parameter `T` is never used + --> $DIR/suggest-swapping-self-ty-and-trait.rs:5:15 + | +LL | pub enum Enum {} + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + +error[E0392]: type parameter `T` is never used + --> $DIR/suggest-swapping-self-ty-and-trait.rs:8:17 + | +LL | pub union Union { + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/suggest-swapping-self-ty-and-trait.rs:10:27 + --> $DIR/suggest-swapping-self-ty-and-trait.rs:13:27 | LL | impl<'a, T> Struct for Trait<'a, T> {} | ^^^^^^^^^^^^ @@ -45,6 +72,33 @@ help: if this is an object-safe trait, use `dyn` LL | impl<'a, T> Struct for dyn Trait<'a, T> {} | +++ -error: aborting due to 3 previous errors; 1 warning emitted +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/suggest-swapping-self-ty-and-trait.rs:18:25 + | +LL | impl<'a, T> Enum for Trait<'a, T> {} + | ^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: if this is an object-safe trait, use `dyn` + | +LL | impl<'a, T> Enum for dyn Trait<'a, T> {} + | +++ + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/suggest-swapping-self-ty-and-trait.rs:23:26 + | +LL | impl<'a, T> Union for Trait<'a, T> {} + | ^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: if this is an object-safe trait, use `dyn` + | +LL | impl<'a, T> Union for dyn Trait<'a, T> {} + | +++ + +error: aborting due to 6 previous errors; 3 warnings emitted -For more information about this error, try `rustc --explain E0404`. +Some errors have detailed explanations: E0392, E0404. +For more information about an error, try `rustc --explain E0392`. diff --git a/tests/ui/tag-type-args.stderr b/tests/ui/tag-type-args.stderr index a1136f61cc52f..def13832e1ae0 100644 --- a/tests/ui/tag-type-args.stderr +++ b/tests/ui/tag-type-args.stderr @@ -1,3 +1,12 @@ +error[E0392]: type parameter `T` is never used + --> $DIR/tag-type-args.rs:1:11 + | +LL | enum Quux { Bar } + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + error[E0107]: missing generics for enum `Quux` --> $DIR/tag-type-args.rs:4:11 | @@ -14,15 +23,6 @@ help: add missing generic argument LL | fn foo(c: Quux) { assert!((false)); } | +++ -error[E0392]: type parameter `T` is never used - --> $DIR/tag-type-args.rs:1:11 - | -LL | enum Quux { Bar } - | ^ unused type parameter - | - = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead - error: aborting due to 2 previous errors Some errors have detailed explanations: E0107, E0392. diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index 278b9ad5003a6..bf48911edec5f 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -183,6 +183,15 @@ error: cannot use `#[inline(always)]` with `#[target_feature]` LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/invalid-attribute.rs:88:1 + | +LL | impl Quux for u8 {} + | ^^^^^^^^^^^^^^^^ missing `foo` in implementation +... +LL | fn foo(); + | --------- `foo` from trait + error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions --> $DIR/invalid-attribute.rs:103:5 | @@ -196,15 +205,6 @@ LL | fn foo() {} = help: add `#![feature(target_feature_11)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/invalid-attribute.rs:88:1 - | -LL | impl Quux for u8 {} - | ^^^^^^^^^^^^^^^^ missing `foo` in implementation -... -LL | fn foo(); - | --------- `foo` from trait - error: aborting due to 23 previous errors Some errors have detailed explanations: E0046, E0658. diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs index 52ecbcc9e2cb3..7d71fcdd15813 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs @@ -20,6 +20,7 @@ impl Trait for () {} fn func>(t: T) -> impl Trait<(), i32> { //~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied //~| ERROR trait takes 1 generic argument but 2 generic arguments were supplied +//~| ERROR type annotations needed 3 } diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index e7ceb7372bfca..f4ede4190fc7a 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -1,3 +1,9 @@ +error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9 + | +LL | impl Trait for i32 { + | ^ unconstrained type parameter + error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:12 | @@ -10,6 +16,12 @@ note: trait defined here, with 1 generic parameter: `T` LL | pub trait Trait { | ^^^^^ - +error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:9 + | +LL | impl Trait for () {} + | ^ unconstrained type parameter + error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:12 | @@ -42,8 +54,14 @@ help: replace the generic bound with the associated type LL | fn func>(t: T) -> impl Trait<(), Assoc = i32> { | +++++++ +error[E0282]: type annotations needed + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:41 + | +LL | fn func>(t: T) -> impl Trait<(), i32> { + | ^^^^^^^^^^^^^^^^^^^ cannot infer type + error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:26:18 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:27:18 | LL | struct Struct> { | ^^^^^ expected 1 generic argument @@ -59,7 +77,7 @@ LL | struct Struct> { | +++++++ error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:31:23 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:32:23 | LL | trait AnotherTrait> {} | ^^^^^ expected 1 generic argument @@ -75,7 +93,7 @@ LL | trait AnotherTrait> {} | +++++++ error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:34:9 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:35:9 | LL | impl> Struct {} | ^^^^^ expected 1 generic argument @@ -91,7 +109,7 @@ LL | impl> Struct {} | +++++++ error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:40:58 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:41:58 | LL | impl, U> YetAnotherTrait for Struct {} | ^^^^^^ - help: remove this generic argument @@ -99,24 +117,12 @@ LL | impl, U> YetAnotherTrait for Struct {} | expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:26:8 + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:27:8 | LL | struct Struct> { | ^^^^^^ - -error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9 - | -LL | impl Trait for i32 { - | ^ unconstrained type parameter - -error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:9 - | -LL | impl Trait for () {} - | ^ unconstrained type parameter - -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors -Some errors have detailed explanations: E0107, E0207. +Some errors have detailed explanations: E0107, E0207, E0282. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/traits/issue-105231.rs b/tests/ui/traits/issue-105231.rs index 74c7afd6b9edb..89b2da4452a5c 100644 --- a/tests/ui/traits/issue-105231.rs +++ b/tests/ui/traits/issue-105231.rs @@ -1,7 +1,9 @@ //~ ERROR overflow evaluating the requirement `A>>>>>>: Send` struct A(B); //~^ ERROR recursive types `A` and `B` have infinite size +//~| ERROR `T` is never used struct B(A>); +//~^ ERROR `T` is never used trait Foo {} impl Foo for T where T: Send {} impl Foo for B {} diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr index fe20c47c57a80..6467a438375c9 100644 --- a/tests/ui/traits/issue-105231.stderr +++ b/tests/ui/traits/issue-105231.stderr @@ -3,7 +3,7 @@ error[E0072]: recursive types `A` and `B` have infinite size | LL | struct A(B); | ^^^^^^^^^^^ ---- recursive without indirection -LL | +... LL | struct B(A>); | ^^^^^^^^^^^ ------- recursive without indirection | @@ -11,19 +11,38 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL ~ struct A(Box>); LL | +LL | LL ~ struct B(Box>>); | +error[E0392]: type parameter `T` is never used + --> $DIR/issue-105231.rs:2:10 + | +LL | struct A(B); + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + +error[E0392]: type parameter `T` is never used + --> $DIR/issue-105231.rs:5:10 + | +LL | struct B(A>); + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead + error[E0275]: overflow evaluating the requirement `A>>>>>>: Send` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`) note: required because it appears within the type `B>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-105231.rs:4:8 + --> $DIR/issue-105231.rs:5:8 | LL | struct B(A>); | ^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0072, E0275. +Some errors have detailed explanations: E0072, E0275, E0392. For more information about an error, try `rustc --explain E0072`. diff --git a/tests/ui/traits/issue-28576.stderr b/tests/ui/traits/issue-28576.stderr index 653ce05d28574..7e0f52bc4fe09 100644 --- a/tests/ui/traits/issue-28576.stderr +++ b/tests/ui/traits/issue-28576.stderr @@ -1,3 +1,23 @@ +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-28576.rs:5:16 + | +LL | pub trait Bar: Foo { + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Foo` + --> $DIR/issue-28576.rs:1:15 + | +LL | pub trait Foo { + | ^^^^^^^^ required by the implicit `Sized` requirement on this type parameter in `Foo` +help: consider further restricting `Self` + | +LL | pub trait Bar: Foo + Sized { + | +++++++ +help: consider relaxing the implicit `Sized` restriction + | +LL | pub trait Foo { + | ++++++++ + error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-28576.rs:9:12 | @@ -19,26 +39,6 @@ help: consider using an opaque type instead LL | impl Bar | ~~~~ -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-28576.rs:5:16 - | -LL | pub trait Bar: Foo { - | ^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required by an implicit `Sized` bound in `Foo` - --> $DIR/issue-28576.rs:1:15 - | -LL | pub trait Foo { - | ^^^^^^^^ required by the implicit `Sized` requirement on this type parameter in `Foo` -help: consider further restricting `Self` - | -LL | pub trait Bar: Foo + Sized { - | +++++++ -help: consider relaxing the implicit `Sized` restriction - | -LL | pub trait Foo { - | ++++++++ - error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-28576.rs:5:16 | diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr index 6c019f59b0992..e8a2f899fff16 100644 --- a/tests/ui/traits/issue-50480.stderr +++ b/tests/ui/traits/issue-50480.stderr @@ -60,6 +60,15 @@ error[E0412]: cannot find type `NotDefined` in this scope LL | struct Bar(T, N, NotDefined, ::Item, Vec, String); | ^^^^^^^^^^ not found in this scope +error[E0277]: `i32` is not an iterator + --> $DIR/issue-50480.rs:3:27 + | +LL | struct Foo(N, NotDefined, ::Item, Vec, String); + | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator + | + = help: the trait `Iterator` is not implemented for `i32` + = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + error[E0204]: the trait `Copy` cannot be implemented for this type --> $DIR/issue-50480.rs:1:17 | @@ -86,15 +95,6 @@ LL | struct Bar(T, N, NotDefined, ::Item, Vec, String); | = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: `i32` is not an iterator - --> $DIR/issue-50480.rs:3:27 - | -LL | struct Foo(N, NotDefined, ::Item, Vec, String); - | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator - | - = help: the trait `Iterator` is not implemented for `i32` - = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - error[E0277]: `i32` is not an iterator --> $DIR/issue-50480.rs:14:33 | diff --git a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr index 583945723d5f0..c54926ab17ae1 100644 --- a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr +++ b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr @@ -1,12 +1,3 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `::Assoc` - --> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1 - | -LL | impl Trait for T {} - | ------------------------- first implementation here -LL | struct LocalTy; -LL | impl Trait for ::Assoc {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `::Assoc` - error[E0275]: overflow evaluating the requirement `::Assoc: Sized` --> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18 | @@ -24,6 +15,15 @@ help: consider relaxing the implicit `Sized` restriction LL | type Assoc: ?Sized; | ++++++++ +error[E0119]: conflicting implementations of trait `Trait` for type `::Assoc` + --> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1 + | +LL | impl Trait for T {} + | ------------------------- first implementation here +LL | struct LocalTy; +LL | impl Trait for ::Assoc {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `::Assoc` + error: aborting due to 2 previous errors Some errors have detailed explanations: E0119, E0275. diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index e33320ed9e60b..01aa4ad797012 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -13,6 +13,12 @@ LL | #![feature(lazy_type_alias)] = note: see issue #112792 for more information = note: `#[warn(incomplete_features)]` on by default +error: the type `<*const T as ToUnit<'a>>::Unit` is not well-formed + --> $DIR/issue-118950-root-region.rs:14:21 + | +LL | type Assoc<'a, T> = <*const T as ToUnit<'a>>::Unit; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } @@ -30,12 +36,6 @@ LL | LL | impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `fn(_)` -error: the type `<*const T as ToUnit<'a>>::Unit` is not well-formed - --> $DIR/issue-118950-root-region.rs:14:21 - | -LL | type Assoc<'a, T> = <*const T as ToUnit<'a>>::Unit; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: aborting due to 3 previous errors; 1 warning emitted Some errors have detailed explanations: E0119, E0412. diff --git a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr index 85c05bd05db1f..6e1dea73ddb9a 100644 --- a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr +++ b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr @@ -5,7 +5,7 @@ LL | trait A: B + A {} | ^ | = note: ...which immediately requires computing the super predicates of `A` again -note: cycle used when collecting item types in top-level module +note: cycle used when checking that `A` is well-formed --> $DIR/cyclic-trait-resolution.rs:1:1 | LL | trait A: B + A {} diff --git a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr index 7f80c3cfaba44..df466609a1246 100644 --- a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr +++ b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr @@ -46,17 +46,11 @@ LL | V3 = Self::V1 {} as u8 + 2, | ^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing layout of `Alpha`... = note: ...which again requires simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/self-in-enum-definition.rs:1:1 +note: cycle used when checking that `Alpha` is well-formed + --> $DIR/self-in-enum-definition.rs:2:1 | -LL | / #[repr(u8)] -LL | | enum Alpha { -LL | | V1 = 41, -LL | | V2 = Self::V1 as u8 + 1, // OK; See #50072. -... | -LL | | -LL | | fn main() {} - | |____________^ +LL | enum Alpha { + | ^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs index 7c7c68ad60afe..f62dccff58d0d 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs +++ b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs @@ -20,6 +20,7 @@ impl<'a, I> UnwrapItemsExt for I { fn unwrap_items(self) -> Self::Iter { MyStruct {} + //~^ ERROR expected generic lifetime parameter } } diff --git a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr index 089c3e4fd8ab2..e6b94c525ff23 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr +++ b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr @@ -4,6 +4,16 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, LL | impl<'a, I> UnwrapItemsExt for I { | ^^ unconstrained lifetime parameter -error: aborting due to 1 previous error +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/assoc-type-lifetime-unconstrained.rs:22:9 + | +LL | impl<'a, I> UnwrapItemsExt for I { + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | MyStruct {} + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0792. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs b/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs index 1824ff5e2fb82..fcac83500ec4f 100644 --- a/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs +++ b/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.rs @@ -12,6 +12,8 @@ impl X for () { //~^ ERROR the type parameter `T` is not constrained type I = impl Sized; fn f() -> Self::I {} + //~^ ERROR type annotations needed + //~| ERROR type annotations needed } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.stderr b/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.stderr index 137a4db81b563..bb0e11d314c33 100644 --- a/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.stderr +++ b/tests/ui/type-alias-impl-trait/impl-with-unconstrained-param.stderr @@ -4,6 +4,19 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self LL | impl X for () { | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0282]: type annotations needed + --> $DIR/impl-with-unconstrained-param.rs:14:23 + | +LL | fn f() -> Self::I {} + | ^^ cannot infer type for type parameter `T` + +error[E0282]: type annotations needed + --> $DIR/impl-with-unconstrained-param.rs:14:15 + | +LL | fn f() -> Self::I {} + | ^^^^^^^ cannot infer type for type parameter `T` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0282. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/issue-74244.rs b/tests/ui/type-alias-impl-trait/issue-74244.rs index bb4104b3d2519..ce8a38a3361f8 100644 --- a/tests/ui/type-alias-impl-trait/issue-74244.rs +++ b/tests/ui/type-alias-impl-trait/issue-74244.rs @@ -14,6 +14,7 @@ impl Allocator for DefaultAllocator { type A = impl Fn(::Buffer); fn foo() -> A { + //~^ ERROR: type annotations needed |_| () } diff --git a/tests/ui/type-alias-impl-trait/issue-74244.stderr b/tests/ui/type-alias-impl-trait/issue-74244.stderr index f5ca56bacccf6..d2b50ffd86b59 100644 --- a/tests/ui/type-alias-impl-trait/issue-74244.stderr +++ b/tests/ui/type-alias-impl-trait/issue-74244.stderr @@ -4,6 +4,13 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self LL | impl Allocator for DefaultAllocator { | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0282]: type annotations needed + --> $DIR/issue-74244.rs:16:13 + | +LL | fn foo() -> A { + | ^ cannot infer type for type parameter `T` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0282. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.rs b/tests/ui/type-alias-impl-trait/issue-74761-2.rs index f582592e9bcc8..e556025adee6e 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-74761-2.rs @@ -10,6 +10,7 @@ impl<'a, 'b> A for () { type B = impl core::fmt::Debug; fn f(&self) -> Self::B {} + //~^ ERROR expected generic lifetime parameter } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.stderr b/tests/ui/type-alias-impl-trait/issue-74761-2.stderr index f15d0a069ca8a..26babc29000c0 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-74761-2.stderr @@ -10,6 +10,16 @@ error[E0207]: the lifetime parameter `'b` is not constrained by the impl trait, LL | impl<'a, 'b> A for () { | ^^ unconstrained lifetime parameter -error: aborting due to 2 previous errors +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/issue-74761-2.rs:12:28 + | +LL | impl<'a, 'b> A for () { + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | fn f(&self) -> Self::B {} + | ^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0792. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/issue-74761.rs b/tests/ui/type-alias-impl-trait/issue-74761.rs index f582592e9bcc8..e556025adee6e 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761.rs +++ b/tests/ui/type-alias-impl-trait/issue-74761.rs @@ -10,6 +10,7 @@ impl<'a, 'b> A for () { type B = impl core::fmt::Debug; fn f(&self) -> Self::B {} + //~^ ERROR expected generic lifetime parameter } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-74761.stderr b/tests/ui/type-alias-impl-trait/issue-74761.stderr index 1d016fe070f9c..a4826c293467e 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761.stderr +++ b/tests/ui/type-alias-impl-trait/issue-74761.stderr @@ -10,6 +10,16 @@ error[E0207]: the lifetime parameter `'b` is not constrained by the impl trait, LL | impl<'a, 'b> A for () { | ^^ unconstrained lifetime parameter -error: aborting due to 2 previous errors +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/issue-74761.rs:12:28 + | +LL | impl<'a, 'b> A for () { + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | fn f(&self) -> Self::B {} + | ^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0792. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs index 296a3f3e30072..b232097fdb332 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.rs @@ -12,6 +12,7 @@ impl<'a, I: Iterator> Trait for (i32, I) { type Associated = (i32, impl Iterator); fn into(self) -> Self::Associated { (0_i32, [0_i32].iter().copied()) + //~^ ERROR: expected generic lifetime parameter, found `'_` } } diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr index cff2695304ae2..5f9c56f1ca9d0 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr @@ -4,6 +4,16 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, LL | impl<'a, I: Iterator> Trait for (i32, I) { | ^^ unconstrained lifetime parameter -error: aborting due to 1 previous error +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/type-alias-impl-trait-unconstrained-lifetime.rs:14:9 + | +LL | impl<'a, I: Iterator> Trait for (i32, I) { + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | (0_i32, [0_i32].iter().copied()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0792. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs index e92cf2513e731..eae5e5fdde2b8 100644 --- a/tests/ui/type-alias-impl-trait/variance.rs +++ b/tests/ui/type-alias-impl-trait/variance.rs @@ -6,16 +6,21 @@ trait Captures<'a> {} impl Captures<'_> for T {} type NotCapturedEarly<'a> = impl Sized; //~ [o] +//~^ ERROR: unconstrained opaque type type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ [o] +//~^ ERROR: unconstrained opaque type // TAIT does *not* capture `'b` type NotCapturedLate<'a> = dyn for<'b> Iterator; //~ [o] +//~^ ERROR: unconstrained opaque type // TAIT does *not* capture `'b` type Captured<'a> = dyn for<'b> Iterator>; //~ [o] +//~^ ERROR: unconstrained opaque type type Bar<'a, 'b: 'b, T> = impl Sized; //~ ERROR [o, o, o] +//~^ ERROR: unconstrained opaque type trait Foo<'i> { type ImplicitCapture<'a>; @@ -27,18 +32,24 @@ trait Foo<'i> { impl<'i> Foo<'i> for &'i () { type ImplicitCapture<'a> = impl Sized; //~ [o, o] + //~^ ERROR: unconstrained opaque type type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [o, o] + //~^ ERROR: unconstrained opaque type type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [o, o] + //~^ ERROR: unconstrained opaque type } impl<'i> Foo<'i> for () { type ImplicitCapture<'a> = impl Sized; //~ [o, o] + //~^ ERROR: unconstrained opaque type type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [o, o] + //~^ ERROR: unconstrained opaque type type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [o, o] + //~^ ERROR: unconstrained opaque type } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/variance.stderr b/tests/ui/type-alias-impl-trait/variance.stderr index 1794447c89a20..914541fcf66ee 100644 --- a/tests/ui/type-alias-impl-trait/variance.stderr +++ b/tests/ui/type-alias-impl-trait/variance.stderr @@ -1,3 +1,91 @@ +error: unconstrained opaque type + --> $DIR/variance.rs:8:29 + | +LL | type NotCapturedEarly<'a> = impl Sized; + | ^^^^^^^^^^ + | + = note: `NotCapturedEarly` must be used in combination with a concrete type within the same module + +error: unconstrained opaque type + --> $DIR/variance.rs:11:26 + | +LL | type CapturedEarly<'a> = impl Sized + Captures<'a>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `CapturedEarly` must be used in combination with a concrete type within the same module + +error: unconstrained opaque type + --> $DIR/variance.rs:15:56 + | +LL | type NotCapturedLate<'a> = dyn for<'b> Iterator; + | ^^^^^^^^^^ + | + = note: `NotCapturedLate` must be used in combination with a concrete type within the same module + +error: unconstrained opaque type + --> $DIR/variance.rs:19:49 + | +LL | type Captured<'a> = dyn for<'b> Iterator>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `Captured` must be used in combination with a concrete type within the same module + +error: unconstrained opaque type + --> $DIR/variance.rs:22:27 + | +LL | type Bar<'a, 'b: 'b, T> = impl Sized; + | ^^^^^^^^^^ + | + = note: `Bar` must be used in combination with a concrete type within the same module + +error: unconstrained opaque type + --> $DIR/variance.rs:34:32 + | +LL | type ImplicitCapture<'a> = impl Sized; + | ^^^^^^^^^^ + | + = note: `ImplicitCapture` must be used in combination with a concrete type within the same impl + +error: unconstrained opaque type + --> $DIR/variance.rs:37:42 + | +LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl + +error: unconstrained opaque type + --> $DIR/variance.rs:40:39 + | +LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl + +error: unconstrained opaque type + --> $DIR/variance.rs:45:32 + | +LL | type ImplicitCapture<'a> = impl Sized; + | ^^^^^^^^^^ + | + = note: `ImplicitCapture` must be used in combination with a concrete type within the same impl + +error: unconstrained opaque type + --> $DIR/variance.rs:48:42 + | +LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `ExplicitCaptureFromHeader` must be used in combination with a concrete type within the same impl + +error: unconstrained opaque type + --> $DIR/variance.rs:51:39 + | +LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl + error: [o] --> $DIR/variance.rs:8:29 | @@ -5,64 +93,64 @@ LL | type NotCapturedEarly<'a> = impl Sized; | ^^^^^^^^^^ error: [o] - --> $DIR/variance.rs:10:26 + --> $DIR/variance.rs:11:26 | LL | type CapturedEarly<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o] - --> $DIR/variance.rs:13:56 + --> $DIR/variance.rs:15:56 | LL | type NotCapturedLate<'a> = dyn for<'b> Iterator; | ^^^^^^^^^^ error: [o] - --> $DIR/variance.rs:16:49 + --> $DIR/variance.rs:19:49 | LL | type Captured<'a> = dyn for<'b> Iterator>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o, o, o] - --> $DIR/variance.rs:18:27 + --> $DIR/variance.rs:22:27 | LL | type Bar<'a, 'b: 'b, T> = impl Sized; | ^^^^^^^^^^ error: [o, o] - --> $DIR/variance.rs:29:32 + --> $DIR/variance.rs:34:32 | LL | type ImplicitCapture<'a> = impl Sized; | ^^^^^^^^^^ error: [o, o] - --> $DIR/variance.rs:31:42 + --> $DIR/variance.rs:37:42 | LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o, o] - --> $DIR/variance.rs:33:39 + --> $DIR/variance.rs:40:39 | LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o, o] - --> $DIR/variance.rs:37:32 + --> $DIR/variance.rs:45:32 | LL | type ImplicitCapture<'a> = impl Sized; | ^^^^^^^^^^ error: [o, o] - --> $DIR/variance.rs:39:42 + --> $DIR/variance.rs:48:42 | LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o, o] - --> $DIR/variance.rs:41:39 + --> $DIR/variance.rs:51:39 | LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 11 previous errors +error: aborting due to 22 previous errors diff --git a/tests/ui/typeck/issue-13853-5.rs b/tests/ui/typeck/issue-13853-5.rs index 2afdf95aacf42..fc97c6c67d687 100644 --- a/tests/ui/typeck/issue-13853-5.rs +++ b/tests/ui/typeck/issue-13853-5.rs @@ -7,6 +7,7 @@ trait Deserializable { impl<'a, T: Deserializable> Deserializable for &'a str { //~^ ERROR type parameter `T` is not constrained fn deserialize_token>(_x: D, _y: &'a str) -> &'a str { + //~^ ERROR mismatched types } } diff --git a/tests/ui/typeck/issue-13853-5.stderr b/tests/ui/typeck/issue-13853-5.stderr index 1eead9563286c..388d5ec746ce6 100644 --- a/tests/ui/typeck/issue-13853-5.stderr +++ b/tests/ui/typeck/issue-13853-5.stderr @@ -4,6 +4,22 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self LL | impl<'a, T: Deserializable> Deserializable for &'a str { | ^ unconstrained type parameter -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/issue-13853-5.rs:9:70 + | +LL | fn deserialize_token>(_x: D, _y: &'a str) -> &'a str { + | ----------------- ^^^^^^^ expected `&str`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | +help: consider returning the local binding `_y` + | +LL ~ fn deserialize_token>(_x: D, _y: &'a str) -> &'a str { +LL + _y +LL ~ + | + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0308. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/typeck/type-placeholder-fn-in-const.stderr b/tests/ui/typeck/type-placeholder-fn-in-const.stderr index 302359d2500c9..92b47bd4781c5 100644 --- a/tests/ui/typeck/type-placeholder-fn-in-const.stderr +++ b/tests/ui/typeck/type-placeholder-fn-in-const.stderr @@ -1,25 +1,25 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/type-placeholder-fn-in-const.rs:4:25 + --> $DIR/type-placeholder-fn-in-const.rs:10:25 | -LL | const TEST: fn() -> _; +LL | const TEST: fn() -> _ = 42; | ^ not allowed in type signatures -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/type-placeholder-fn-in-const.rs:4:25 | LL | const TEST: fn() -> _; | ^ not allowed in type signatures -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/type-placeholder-fn-in-const.rs:10:25 | LL | const TEST: fn() -> _ = 42; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/type-placeholder-fn-in-const.rs:10:25 + --> $DIR/type-placeholder-fn-in-const.rs:4:25 | -LL | const TEST: fn() -> _ = 42; +LL | const TEST: fn() -> _; | ^ not allowed in type signatures error: aborting due to 4 previous errors diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 1dc1d46aa71ad..9a9b2a68dbed9 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -24,6 +24,16 @@ LL | trait Trait: Copy {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 + | +LL | trait Trait: Copy {} + | ^^^^---------- help: remove these generics + | | + | expected 0 generic arguments + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:9:21 | @@ -56,16 +66,6 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | | | expected 0 generic arguments -error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 - | -LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index c102926fcf562..e8f1de1ad04cd 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -169,6 +169,28 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ { | | not allowed in type signatures | help: replace with the correct return type: `*const *const usize` +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:59:24 + | +LL | fn clone(&self) -> _ { Test9 } + | ^ not allowed in type signatures + | +help: try replacing `_` with the type in the corresponding trait method signature + | +LL | fn clone(&self) -> Test9 { Test9 } + | ~~~~~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:62:37 + | +LL | fn clone_from(&mut self, other: _) { *self = Test9; } + | ^ not allowed in type signatures + | +help: try replacing `_` with the type in the corresponding trait method signature + | +LL | fn clone_from(&mut self, other: &Test9) { *self = Test9; } + | ~~~~~~ + error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:67:8 | @@ -294,6 +316,28 @@ help: use type parameters instead LL | fn fn_test8(_f: fn() -> T) { } | +++ ~ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:115:28 + | +LL | fn clone(&self) -> _ { FnTest9 } + | ^ not allowed in type signatures + | +help: try replacing `_` with the type in the corresponding trait method signature + | +LL | fn clone(&self) -> FnTest9 { FnTest9 } + | ~~~~~~~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:118:41 + | +LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } + | ^ not allowed in type signatures + | +help: try replacing `_` with the type in the corresponding trait method signature + | +LL | fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; } + | ~~~~~~~~ + error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:123:12 | @@ -346,6 +390,76 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | | not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:140:31 + | +LL | fn method_test1(&self, x: _); + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn method_test1(&self, x: T); + | +++ ~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:142:31 + | +LL | fn method_test2(&self, x: _) -> _; + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + | +help: use type parameters instead + | +LL | fn method_test2(&self, x: T) -> T; + | +++ ~ ~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:144:31 + | +LL | fn method_test3(&self) -> _; + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn method_test3(&self) -> T; + | +++ ~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:146:26 + | +LL | fn assoc_fn_test1(x: _); + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn assoc_fn_test1(x: T); + | +++ ~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:148:26 + | +LL | fn assoc_fn_test2(x: _) -> _; + | ^ ^ not allowed in type signatures + | | + | not allowed in type signatures + | +help: use type parameters instead + | +LL | fn assoc_fn_test2(x: T) -> T; + | +++ ~ ~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:150:28 + | +LL | fn assoc_fn_test3() -> _; + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn assoc_fn_test3() -> T; + | +++ ~ + error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:154:21 | @@ -410,6 +524,28 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures LL | type Y = impl Trait<_>; | ^ not allowed in type signatures +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:44:27 + | +LL | fn test10(&self, _x : _) { } + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn test10(&self, _x : T) { } + | +++ ~ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/typeck_type_placeholder_item.rs:110:34 + | +LL | fn fn_test10(&self, _x : _) { } + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL | fn fn_test10(&self, _x : T) { } + | +++ ~ + error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:217:31 | @@ -428,6 +564,39 @@ LL | const _: Option<_> = map(value); | not allowed in type signatures | help: replace with the correct type: `Option` +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants + --> $DIR/typeck_type_placeholder_item.rs:206:14 + | +LL | const C: _; + | ^ not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants + --> $DIR/typeck_type_placeholder_item.rs:209:14 + | +LL | const D: _ = 42; + | ^ + | | + | not allowed in type signatures + | help: replace with the correct type: `i32` + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants + --> $DIR/typeck_type_placeholder_item.rs:194:14 + | +LL | const D: _ = 42; + | ^ + | | + | not allowed in type signatures + | help: replace with the correct type: `i32` + +error[E0046]: not all trait items implemented, missing: `F` + --> $DIR/typeck_type_placeholder_item.rs:200:1 + | +LL | type F: std::ops::Fn(_); + | ----------------------- `F` from trait +... +LL | impl Qux for Struct { + | ^^^^^^^^^^^^^^^^^^^ missing `F` in implementation + error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:225:31 | @@ -449,103 +618,6 @@ note: however, the inferred type `Map, {closure@typeck_type_pl LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:140:31 - | -LL | fn method_test1(&self, x: _); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn method_test1(&self, x: T); - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:142:31 - | -LL | fn method_test2(&self, x: _) -> _; - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | fn method_test2(&self, x: T) -> T; - | +++ ~ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:144:31 - | -LL | fn method_test3(&self) -> _; - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn method_test3(&self) -> T; - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:146:26 - | -LL | fn assoc_fn_test1(x: _); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn assoc_fn_test1(x: T); - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:148:26 - | -LL | fn assoc_fn_test2(x: _) -> _; - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | fn assoc_fn_test2(x: T) -> T; - | +++ ~ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:150:28 - | -LL | fn assoc_fn_test3() -> _; - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn assoc_fn_test3() -> T; - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types - --> $DIR/typeck_type_placeholder_item.rs:190:14 - | -LL | type B = _; - | ^ not allowed in type signatures - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/typeck_type_placeholder_item.rs:192:14 - | -LL | const C: _; - | ^ not allowed in type signatures - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/typeck_type_placeholder_item.rs:194:14 - | -LL | const D: _ = 42; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types - --> $DIR/typeck_type_placeholder_item.rs:197:26 - | -LL | type F: std::ops::Fn(_); - | ^ not allowed in type signatures - error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:41:24 | @@ -555,39 +627,6 @@ LL | fn test9(&self) -> _ { () } | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:44:27 - | -LL | fn test10(&self, _x : _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test10(&self, _x : T) { } - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:59:24 - | -LL | fn clone(&self) -> _ { Test9 } - | ^ not allowed in type signatures - | -help: try replacing `_` with the type in the corresponding trait method signature - | -LL | fn clone(&self) -> Test9 { Test9 } - | ~~~~~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:62:37 - | -LL | fn clone_from(&mut self, other: _) { *self = Test9; } - | ^ not allowed in type signatures - | -help: try replacing `_` with the type in the corresponding trait method signature - | -LL | fn clone_from(&mut self, other: &Test9) { *self = Test9; } - | ~~~~~~ - error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:107:31 | @@ -597,39 +636,6 @@ LL | fn fn_test9(&self) -> _ { () } | not allowed in type signatures | help: replace with the correct return type: `()` -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:110:34 - | -LL | fn fn_test10(&self, _x : _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn fn_test10(&self, _x : T) { } - | +++ ~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:115:28 - | -LL | fn clone(&self) -> _ { FnTest9 } - | ^ not allowed in type signatures - | -help: try replacing `_` with the type in the corresponding trait method signature - | -LL | fn clone(&self) -> FnTest9 { FnTest9 } - | ~~~~~~~ - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions - --> $DIR/typeck_type_placeholder_item.rs:118:41 - | -LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } - | ^ not allowed in type signatures - | -help: try replacing `_` with the type in the corresponding trait method signature - | -LL | fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; } - | ~~~~~~~~ - error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/typeck_type_placeholder_item.rs:202:14 | @@ -642,29 +648,23 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures LL | type B = _; | ^ not allowed in type signatures -error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/typeck_type_placeholder_item.rs:206:14 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:190:14 | -LL | const C: _; +LL | type B = _; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/typeck_type_placeholder_item.rs:209:14 + --> $DIR/typeck_type_placeholder_item.rs:192:14 | -LL | const D: _ = 42; - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `i32` +LL | const C: _; + | ^ not allowed in type signatures -error[E0046]: not all trait items implemented, missing: `F` - --> $DIR/typeck_type_placeholder_item.rs:200:1 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types + --> $DIR/typeck_type_placeholder_item.rs:197:26 | LL | type F: std::ops::Fn(_); - | ----------------------- `F` from trait -... -LL | impl Qux for Struct { - | ^^^^^^^^^^^^^^^^^^^ missing `F` in implementation + | ^ not allowed in type signatures error[E0015]: cannot call non-const fn ` as Iterator>::filter::<{closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}>` in constants --> $DIR/typeck_type_placeholder_item.rs:230:22 diff --git a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr index b0d4ed8272be9..32585e2937b77 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -38,18 +38,18 @@ LL | const TEST4: fn() -> _ = 42; | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/typeck_type_placeholder_item_help.rs:18:18 + --> $DIR/typeck_type_placeholder_item_help.rs:25:18 | -LL | const TEST5: _ = 42; +LL | const TEST6: _ = 13; | ^ | | | not allowed in type signatures | help: replace with the correct type: `i32` error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants - --> $DIR/typeck_type_placeholder_item_help.rs:25:18 + --> $DIR/typeck_type_placeholder_item_help.rs:18:18 | -LL | const TEST6: _ = 13; +LL | const TEST5: _ = 42; | ^ | | | not allowed in type signatures diff --git a/tests/ui/variance/variance-associated-consts.rs b/tests/ui/variance/variance-associated-consts.rs index da55bc96244f2..6a44a94df3fdd 100644 --- a/tests/ui/variance/variance-associated-consts.rs +++ b/tests/ui/variance/variance-associated-consts.rs @@ -12,6 +12,7 @@ trait Trait { #[rustc_variance] struct Foo { //~ ERROR [o] field: [u8; ::Const] + //~^ ERROR: unconstrained generic constant } fn main() { } diff --git a/tests/ui/variance/variance-associated-consts.stderr b/tests/ui/variance/variance-associated-consts.stderr index e25f0879add0a..f41574ca3a37b 100644 --- a/tests/ui/variance/variance-associated-consts.stderr +++ b/tests/ui/variance/variance-associated-consts.stderr @@ -1,8 +1,16 @@ +error: unconstrained generic constant + --> $DIR/variance-associated-consts.rs:14:12 + | +LL | field: [u8; ::Const] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); ::Const]:` + error: [o] --> $DIR/variance-associated-consts.rs:13:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors diff --git a/tests/ui/variance/variance-regions-direct.rs b/tests/ui/variance/variance-regions-direct.rs index 39ea77a8aa21a..f1763c403f1a1 100644 --- a/tests/ui/variance/variance-regions-direct.rs +++ b/tests/ui/variance/variance-regions-direct.rs @@ -50,6 +50,7 @@ struct Test6<'a, 'b:'a> { //~ ERROR [+, o] #[rustc_variance] struct Test7<'a> { //~ ERROR [*] + //~^ ERROR: `'a` is never used x: isize } diff --git a/tests/ui/variance/variance-regions-direct.stderr b/tests/ui/variance/variance-regions-direct.stderr index c55730296f1c5..edfc888f65667 100644 --- a/tests/ui/variance/variance-regions-direct.stderr +++ b/tests/ui/variance/variance-regions-direct.stderr @@ -1,3 +1,11 @@ +error[E0392]: lifetime parameter `'a` is never used + --> $DIR/variance-regions-direct.rs:52:14 + | +LL | struct Test7<'a> { + | ^^ unused lifetime parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + error: [+, +, +] --> $DIR/variance-regions-direct.rs:9:1 | @@ -35,10 +43,11 @@ LL | struct Test7<'a> { | ^^^^^^^^^^^^^^^^ error: [-, +, o] - --> $DIR/variance-regions-direct.rs:59:1 + --> $DIR/variance-regions-direct.rs:60:1 | LL | enum Test8<'a, 'b, 'c:'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error: aborting due to 8 previous errors +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/variance/variance-regions-indirect.rs b/tests/ui/variance/variance-regions-indirect.rs index 0d00535fef11b..31e25641d8c3a 100644 --- a/tests/ui/variance/variance-regions-indirect.rs +++ b/tests/ui/variance/variance-regions-indirect.rs @@ -6,6 +6,7 @@ #[rustc_variance] enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [-, +, o, *] + //~^ ERROR: `'d` is never used Test8A(extern "Rust" fn(&'a isize)), Test8B(&'b [isize]), Test8C(&'b mut &'c str), @@ -13,16 +14,19 @@ enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [-, +, o, *] #[rustc_variance] struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, +, -] + //~^ ERROR: `'w` is never used f: Base<'z, 'y, 'x, 'w> } #[rustc_variance] // Combine - and + to yield o struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *] + //~^ ERROR: `'c` is never used f: Base<'a, 'a, 'b, 'c> } #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here) struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, +, *] + //~^ ERROR: `'c` is never used f: Base<'a, 'b, 'a, 'c> } diff --git a/tests/ui/variance/variance-regions-indirect.stderr b/tests/ui/variance/variance-regions-indirect.stderr index edf2626d5984f..901ec0c6a762b 100644 --- a/tests/ui/variance/variance-regions-indirect.stderr +++ b/tests/ui/variance/variance-regions-indirect.stderr @@ -1,3 +1,35 @@ +error[E0392]: lifetime parameter `'d` is never used + --> $DIR/variance-regions-indirect.rs:8:26 + | +LL | enum Base<'a, 'b, 'c:'b, 'd> { + | ^^ unused lifetime parameter + | + = help: consider removing `'d`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: lifetime parameter `'w` is never used + --> $DIR/variance-regions-indirect.rs:16:17 + | +LL | struct Derived1<'w, 'x:'y, 'y, 'z> { + | ^^ unused lifetime parameter + | + = help: consider removing `'w`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: lifetime parameter `'c` is never used + --> $DIR/variance-regions-indirect.rs:22:28 + | +LL | struct Derived2<'a, 'b:'a, 'c> { + | ^^ unused lifetime parameter + | + = help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: lifetime parameter `'c` is never used + --> $DIR/variance-regions-indirect.rs:28:28 + | +LL | struct Derived3<'a:'b, 'b, 'c> { + | ^^ unused lifetime parameter + | + = help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData` + error: [-, +, o, *] --> $DIR/variance-regions-indirect.rs:8:1 | @@ -5,28 +37,29 @@ LL | enum Base<'a, 'b, 'c:'b, 'd> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: [*, o, +, -] - --> $DIR/variance-regions-indirect.rs:15:1 + --> $DIR/variance-regions-indirect.rs:16:1 | LL | struct Derived1<'w, 'x:'y, 'y, 'z> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o, o, *] - --> $DIR/variance-regions-indirect.rs:20:1 + --> $DIR/variance-regions-indirect.rs:22:1 | LL | struct Derived2<'a, 'b:'a, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: [o, +, *] - --> $DIR/variance-regions-indirect.rs:25:1 + --> $DIR/variance-regions-indirect.rs:28:1 | LL | struct Derived3<'a:'b, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: [-, +, o] - --> $DIR/variance-regions-indirect.rs:30:1 + --> $DIR/variance-regions-indirect.rs:34:1 | LL | struct Derived4<'a, 'b, 'c:'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error: aborting due to 9 previous errors +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/variance/variance-trait-bounds.rs b/tests/ui/variance/variance-trait-bounds.rs index ad5334602a2de..25a01b160ddd1 100644 --- a/tests/ui/variance/variance-trait-bounds.rs +++ b/tests/ui/variance/variance-trait-bounds.rs @@ -19,16 +19,19 @@ struct TestStruct> { //~ ERROR [+, +] #[rustc_variance] enum TestEnum> { //~ ERROR [*, +] + //~^ ERROR: `U` is never used Foo(T) } #[rustc_variance] struct TestContraStruct> { //~ ERROR [*, +] + //~^ ERROR: `U` is never used t: T } #[rustc_variance] struct TestBox+Setter> { //~ ERROR [*, +] + //~^ ERROR: `U` is never used t: T } diff --git a/tests/ui/variance/variance-trait-bounds.stderr b/tests/ui/variance/variance-trait-bounds.stderr index 5a73e541c3a17..95ed18c1ad2bf 100644 --- a/tests/ui/variance/variance-trait-bounds.stderr +++ b/tests/ui/variance/variance-trait-bounds.stderr @@ -1,3 +1,30 @@ +error[E0392]: type parameter `U` is never used + --> $DIR/variance-trait-bounds.rs:21:15 + | +LL | enum TestEnum> { + | ^ unused type parameter + | + = help: consider removing `U`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `U` to be a const parameter, use `const U: /* Type */` instead + +error[E0392]: type parameter `U` is never used + --> $DIR/variance-trait-bounds.rs:27:25 + | +LL | struct TestContraStruct> { + | ^ unused type parameter + | + = help: consider removing `U`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `U` to be a const parameter, use `const U: /* Type */` instead + +error[E0392]: type parameter `U` is never used + --> $DIR/variance-trait-bounds.rs:33:16 + | +LL | struct TestBox+Setter> { + | ^ unused type parameter + | + = help: consider removing `U`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `U` to be a const parameter, use `const U: /* Type */` instead + error: [+, +] --> $DIR/variance-trait-bounds.rs:16:1 | @@ -11,16 +38,17 @@ LL | enum TestEnum> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: [*, +] - --> $DIR/variance-trait-bounds.rs:26:1 + --> $DIR/variance-trait-bounds.rs:27:1 | LL | struct TestContraStruct> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: [*, +] - --> $DIR/variance-trait-bounds.rs:31:1 + --> $DIR/variance-trait-bounds.rs:33:1 | LL | struct TestBox+Setter> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 7 previous errors +For more information about this error, try `rustc --explain E0392`.