Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errors

Start moving wf checking away from HIR

I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better.

I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks.

Especially b862d8828e is interesting here, because I think it improves spans in all cases
This commit is contained in:
bors 2025-07-01 14:59:58 +00:00
commit 4e97337005
124 changed files with 1199 additions and 1062 deletions

View file

@ -4834,6 +4834,10 @@ impl<'hir> Node<'hir> {
ImplItemKind::Type(ty) => Some(ty),
_ => None,
},
Node::ForeignItem(it) => match it.kind {
ForeignItemKind::Static(ty, ..) => Some(ty),
_ => None,
},
_ => None,
}
}

View file

@ -10,7 +10,7 @@ use rustc_errors::{EmissionGuarantee, MultiSpan};
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::{LangItem, Node, intravisit};
use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
use rustc_infer::traits::{Obligation, ObligationCauseCode};
use rustc_infer::traits::{Obligation, ObligationCauseCode, WellFormedLoc};
use rustc_lint_defs::builtin::{
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS, UNSUPPORTED_CALLING_CONVENTIONS,
};
@ -36,6 +36,10 @@ use {rustc_attr_data_structures as attrs, rustc_hir as hir};
use super::compare_impl_item::check_type_bounds;
use super::*;
use crate::check::wfcheck::{
check_associated_item, check_trait_item, check_variances_for_type_defn, check_where_clauses,
enter_wf_checking_ctxt,
};
fn add_abi_diag_help<T: EmissionGuarantee>(abi: ExternAbi, diag: &mut Diag<'_, T>) {
if let ExternAbi::Cdecl { unwind } = abi {
@ -729,7 +733,8 @@ fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) {
}
}
pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
let mut res = Ok(());
let generics = tcx.generics_of(def_id);
for param in &generics.own_params {
@ -754,15 +759,39 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
}
match tcx.def_kind(def_id) {
DefKind::Static { .. } => {
check_static_inhabited(tcx, def_id);
check_static_linkage(tcx, def_id);
def_kind @ (DefKind::Static { .. } | DefKind::Const) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
match def_kind {
DefKind::Static { .. } => {
check_static_inhabited(tcx, def_id);
check_static_linkage(tcx, def_id);
res = res.and(wfcheck::check_static_item(tcx, def_id));
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
return res;
}
DefKind::Const => {}
_ => unreachable!(),
}
}
DefKind::Const => {}
DefKind::Enum => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
crate::collect::lower_enum_variant_types(tcx, def_id.to_def_id());
check_enum(tcx, def_id);
check_variances_for_type_defn(tcx, def_id);
}
DefKind::Fn => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
tcx.ensure_ok().fn_sig(def_id);
tcx.ensure_ok().codegen_fn_attrs(def_id);
if let Some(i) = tcx.intrinsic(def_id) {
intrinsic::check_intrinsic_type(
tcx,
@ -773,17 +802,31 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
}
}
DefKind::Impl { of_trait } => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().impl_trait_header(def_id);
tcx.ensure_ok().predicates_of(def_id);
tcx.ensure_ok().associated_items(def_id);
if of_trait && let Some(impl_trait_header) = tcx.impl_trait_header(def_id) {
if tcx
.ensure_ok()
.coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id)
.is_ok()
{
res = res.and(
tcx.ensure_ok()
.coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id),
);
if res.is_ok() {
// Checking this only makes sense if the all trait impls satisfy basic
// requirements (see `coherent_trait` query), otherwise
// we run into infinite recursions a lot.
check_impl_items_against_trait(tcx, def_id, impl_trait_header);
}
}
}
DefKind::Trait => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().trait_def(def_id);
tcx.ensure_ok().explicit_super_predicates_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
tcx.ensure_ok().associated_items(def_id);
let assoc_items = tcx.associated_items(def_id);
check_on_unimplemented(tcx, def_id);
@ -802,11 +845,33 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
}
}
}
DefKind::Struct => {
check_struct(tcx, def_id);
DefKind::TraitAlias => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().explicit_implied_predicates_of(def_id);
tcx.ensure_ok().explicit_super_predicates_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
}
DefKind::Union => {
check_union(tcx, def_id);
def_kind @ (DefKind::Struct | DefKind::Union) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
let adt = tcx.adt_def(def_id).non_enum_variant();
for f in adt.fields.iter() {
tcx.ensure_ok().generics_of(f.did);
tcx.ensure_ok().type_of(f.did);
tcx.ensure_ok().predicates_of(f.did);
}
if let Some((_, ctor_def_id)) = adt.ctor {
crate::collect::lower_variant_ctor(tcx, ctor_def_id.expect_local());
}
match def_kind {
DefKind::Struct => check_struct(tcx, def_id),
DefKind::Union => check_union(tcx, def_id),
_ => unreachable!(),
}
check_variances_for_type_defn(tcx, def_id);
}
DefKind::OpaqueTy => {
check_opaque_precise_captures(tcx, def_id);
@ -831,14 +896,37 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
tcx.ensure_ok().explicit_implied_const_bounds(def_id);
tcx.ensure_ok().const_conditions(def_id);
}
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
return res;
}
DefKind::TyAlias => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
check_type_alias_type_params_are_used(tcx, def_id);
if tcx.type_alias_is_lazy(def_id) {
res = res.and(enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
let ty = tcx.type_of(def_id).instantiate_identity();
let span = tcx.def_span(def_id);
let item_ty = wfcx.deeply_normalize(span, Some(WellFormedLoc::Ty(def_id)), ty);
wfcx.register_wf_obligation(
span,
Some(WellFormedLoc::Ty(def_id)),
item_ty.into(),
);
check_where_clauses(wfcx, def_id);
Ok(())
}));
check_variances_for_type_defn(tcx, def_id);
}
}
DefKind::ForeignMod => {
let it = tcx.hir_expect_item(def_id);
let hir::ItemKind::ForeignMod { abi, items } = it.kind else {
return;
return Ok(());
};
check_abi(tcx, it.hir_id(), it.span, abi);
@ -877,15 +965,23 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
}
let item = tcx.hir_foreign_item(item.id);
match &item.kind {
hir::ForeignItemKind::Fn(sig, _, _) => {
tcx.ensure_ok().generics_of(item.owner_id);
tcx.ensure_ok().type_of(item.owner_id);
tcx.ensure_ok().predicates_of(item.owner_id);
if tcx.is_conditionally_const(def_id) {
tcx.ensure_ok().explicit_implied_const_bounds(def_id);
tcx.ensure_ok().const_conditions(def_id);
}
match item.kind {
hir::ForeignItemKind::Fn(sig, ..) => {
tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
tcx.ensure_ok().fn_sig(item.owner_id);
require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
}
hir::ForeignItemKind::Static(..) => {
check_static_inhabited(tcx, def_id);
check_static_linkage(tcx, def_id);
tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
}
_ => {}
_ => (),
}
}
}
@ -897,9 +993,85 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
// We do not call `type_of` for closures here as that
// depends on typecheck and would therefore hide
// any further errors in case one typeck fails.
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
return res;
}
DefKind::AssocFn => {
tcx.ensure_ok().codegen_fn_attrs(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().fn_sig(def_id);
tcx.ensure_ok().predicates_of(def_id);
res = res.and(check_associated_item(tcx, def_id));
let assoc_item = tcx.associated_item(def_id);
match assoc_item.container {
ty::AssocItemContainer::Impl => {}
ty::AssocItemContainer::Trait => {
res = res.and(check_trait_item(tcx, def_id));
}
}
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
return res;
}
DefKind::AssocConst => {
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
res = res.and(check_associated_item(tcx, def_id));
let assoc_item = tcx.associated_item(def_id);
match assoc_item.container {
ty::AssocItemContainer::Impl => {}
ty::AssocItemContainer::Trait => {
res = res.and(check_trait_item(tcx, def_id));
}
}
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
return res;
}
DefKind::AssocTy => {
tcx.ensure_ok().predicates_of(def_id);
res = res.and(check_associated_item(tcx, def_id));
let assoc_item = tcx.associated_item(def_id);
let has_type = match assoc_item.container {
ty::AssocItemContainer::Impl => true,
ty::AssocItemContainer::Trait => {
tcx.ensure_ok().item_bounds(def_id);
tcx.ensure_ok().item_self_bounds(def_id);
res = res.and(check_trait_item(tcx, def_id));
assoc_item.defaultness(tcx).has_value()
}
};
if has_type {
tcx.ensure_ok().type_of(def_id);
}
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
return res;
}
// Only `Node::Item` and `Node::ForeignItem` still have HIR based
// checks. Returning early here does not miss any checks and
// avoids this query from having a direct dependency edge on the HIR
DefKind::AnonConst | DefKind::InlineConst => return res,
_ => {}
}
let node = tcx.hir_node_by_def_id(def_id);
res.and(match node {
hir::Node::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
hir::Node::Item(item) => wfcheck::check_item(tcx, item),
hir::Node::ForeignItem(item) => wfcheck::check_foreign_item(tcx, item),
_ => unreachable!("{node:?}"),
})
}
pub(super) fn check_on_unimplemented(tcx: TyCtxt<'_>, def_id: LocalDefId) {

View file

@ -25,7 +25,7 @@ use rustc_middle::ty::{
};
use rustc_middle::{bug, span_bug};
use rustc_session::parse::feature_err;
use rustc_span::{DUMMY_SP, Ident, Span, sym};
use rustc_span::{DUMMY_SP, Span, sym};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::regions::{InferCtxtRegionExt, OutlivesEnvironmentBuildExt};
use rustc_trait_selection::traits::misc::{
@ -46,7 +46,6 @@ use crate::{errors, fluent_generated as fluent};
pub(super) struct WfCheckingCtxt<'a, 'tcx> {
pub(super) ocx: ObligationCtxt<'a, 'tcx, FulfillmentError<'tcx>>,
span: Span,
body_def_id: LocalDefId,
param_env: ty::ParamEnv<'tcx>,
}
@ -84,7 +83,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
/// signature types for implied bounds when checking regions.
// FIXME(-Znext-solver): This should be removed when we compute implied outlives
// bounds using the unnormalized signature of the function we're checking.
fn deeply_normalize<T>(&self, span: Span, loc: Option<WellFormedLoc>, value: T) -> T
pub(super) fn deeply_normalize<T>(&self, span: Span, loc: Option<WellFormedLoc>, value: T) -> T
where
T: TypeFoldable<TyCtxt<'tcx>>,
{
@ -105,7 +104,12 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
}
}
fn register_wf_obligation(&self, span: Span, loc: Option<WellFormedLoc>, term: ty::Term<'tcx>) {
pub(super) fn register_wf_obligation(
&self,
span: Span,
loc: Option<WellFormedLoc>,
term: ty::Term<'tcx>,
) {
let cause = traits::ObligationCause::new(
span,
self.body_def_id,
@ -122,7 +126,6 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
tcx: TyCtxt<'tcx>,
span: Span,
body_def_id: LocalDefId,
f: F,
) -> Result<(), ErrorGuaranteed>
@ -133,7 +136,7 @@ where
let infcx = &tcx.infer_ctxt().build(TypingMode::non_body_analysis());
let ocx = ObligationCtxt::new_with_diagnostics(infcx);
let mut wfcx = WfCheckingCtxt { ocx, span, body_def_id, param_env };
let mut wfcx = WfCheckingCtxt { ocx, body_def_id, param_env };
if !tcx.features().trivial_bounds() {
wfcx.check_false_global_bounds()
@ -187,23 +190,10 @@ where
}
fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
let node = tcx.hir_node_by_def_id(def_id);
let mut res = match node {
hir::Node::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
hir::Node::Item(item) => check_item(tcx, item),
hir::Node::TraitItem(item) => check_trait_item(tcx, item),
hir::Node::ImplItem(item) => check_impl_item(tcx, item),
hir::Node::ForeignItem(item) => check_foreign_item(tcx, item),
hir::Node::ConstBlock(_) | hir::Node::Expr(_) | hir::Node::OpaqueTy(_) => {
Ok(crate::check::check::check_item_type(tcx, def_id))
}
_ => unreachable!("{node:?}"),
};
let mut res = crate::check::check::check_item_type(tcx, def_id);
if let Some(generics) = node.generics() {
for param in generics.params {
res = res.and(check_param_wf(tcx, param));
}
for param in &tcx.generics_of(def_id).own_params {
res = res.and(check_param_wf(tcx, param));
}
res
@ -223,16 +213,18 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGua
/// not included it frequently leads to confusing errors in fn bodies. So it's better to check
/// the types first.
#[instrument(skip(tcx), level = "debug")]
fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<(), ErrorGuaranteed> {
pub(super) fn check_item<'tcx>(
tcx: TyCtxt<'tcx>,
item: &'tcx hir::Item<'tcx>,
) -> Result<(), ErrorGuaranteed> {
let def_id = item.owner_id.def_id;
debug!(
?item.owner_id,
item.name = ? tcx.def_path_str(def_id)
);
crate::collect::lower_item(tcx, item.item_id());
let res = match item.kind {
match item.kind {
// Right now we check that every default trait implementation
// has an implementation of itself. Basically, a case like:
//
@ -295,57 +287,18 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
}
res
}
hir::ItemKind::Fn { ident, sig, .. } => {
check_item_fn(tcx, def_id, ident, item.span, sig.decl)
}
hir::ItemKind::Static(_, _, ty, _) => {
check_static_item(tcx, def_id, ty.span, UnsizedHandling::Forbid)
}
hir::ItemKind::Const(_, _, ty, _) => check_const_item(tcx, def_id, ty.span, item.span),
hir::ItemKind::Struct(_, generics, _) => {
let res = check_type_defn(tcx, item, false);
check_variances_for_type_defn(tcx, item, generics);
res
}
hir::ItemKind::Union(_, generics, _) => {
let res = check_type_defn(tcx, item, true);
check_variances_for_type_defn(tcx, item, generics);
res
}
hir::ItemKind::Enum(_, generics, _) => {
let res = check_type_defn(tcx, item, true);
check_variances_for_type_defn(tcx, item, generics);
res
}
hir::ItemKind::Fn { sig, .. } => check_item_fn(tcx, def_id, sig.decl),
hir::ItemKind::Const(_, _, ty, _) => check_const_item(tcx, def_id, ty.span),
hir::ItemKind::Struct(..) => check_type_defn(tcx, item, false),
hir::ItemKind::Union(..) => check_type_defn(tcx, item, true),
hir::ItemKind::Enum(..) => check_type_defn(tcx, item, true),
hir::ItemKind::Trait(..) => check_trait(tcx, item),
hir::ItemKind::TraitAlias(..) => check_trait(tcx, item),
// `ForeignItem`s are handled separately.
hir::ItemKind::ForeignMod { .. } => Ok(()),
hir::ItemKind::TyAlias(_, generics, hir_ty) if tcx.type_alias_is_lazy(item.owner_id) => {
let res = enter_wf_checking_ctxt(tcx, item.span, def_id, |wfcx| {
let ty = tcx.type_of(def_id).instantiate_identity();
let item_ty =
wfcx.deeply_normalize(hir_ty.span, Some(WellFormedLoc::Ty(def_id)), ty);
wfcx.register_wf_obligation(
hir_ty.span,
Some(WellFormedLoc::Ty(def_id)),
item_ty.into(),
);
check_where_clauses(wfcx, item.span, def_id);
Ok(())
});
check_variances_for_type_defn(tcx, item, generics);
res
}
_ => Ok(()),
};
crate::check::check::check_item_type(tcx, def_id);
res
}
}
fn check_foreign_item<'tcx>(
pub(super) fn check_foreign_item<'tcx>(
tcx: TyCtxt<'tcx>,
item: &'tcx hir::ForeignItem<'tcx>,
) -> Result<(), ErrorGuaranteed> {
@ -357,43 +310,23 @@ fn check_foreign_item<'tcx>(
);
match item.kind {
hir::ForeignItemKind::Fn(sig, ..) => {
check_item_fn(tcx, def_id, item.ident, item.span, sig.decl)
}
hir::ForeignItemKind::Static(ty, ..) => {
check_static_item(tcx, def_id, ty.span, UnsizedHandling::AllowIfForeignTail)
}
hir::ForeignItemKind::Type => Ok(()),
hir::ForeignItemKind::Fn(sig, ..) => check_item_fn(tcx, def_id, sig.decl),
hir::ForeignItemKind::Static(..) | hir::ForeignItemKind::Type => Ok(()),
}
}
fn check_trait_item<'tcx>(
pub(crate) fn check_trait_item<'tcx>(
tcx: TyCtxt<'tcx>,
trait_item: &'tcx hir::TraitItem<'tcx>,
def_id: LocalDefId,
) -> Result<(), ErrorGuaranteed> {
let def_id = trait_item.owner_id.def_id;
crate::collect::lower_trait_item(tcx, trait_item.trait_item_id());
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),
_ => (None, trait_item.span),
};
// Check that an item definition in a subtrait is shadowing a supertrait item.
lint_item_shadowing_supertrait_item(tcx, def_id);
let mut res = check_associated_item(tcx, def_id, span, method_sig);
let mut res = Ok(());
if matches!(trait_item.kind, hir::TraitItemKind::Fn(..)) {
if matches!(tcx.def_kind(def_id), DefKind::AssocFn) {
for &assoc_ty_def_id in tcx.associated_types_for_impl_traits_in_associated_fn(def_id) {
res = res.and(check_associated_item(
tcx,
assoc_ty_def_id.expect_local(),
tcx.def_span(assoc_ty_def_id),
None,
));
res = res.and(check_associated_item(tcx, assoc_ty_def_id.expect_local()));
}
}
res
@ -872,67 +805,54 @@ fn lint_item_shadowing_supertrait_item<'tcx>(tcx: TyCtxt<'tcx>, trait_item_def_i
}
}
fn check_impl_item<'tcx>(
tcx: TyCtxt<'tcx>,
impl_item: &'tcx hir::ImplItem<'tcx>,
) -> Result<(), ErrorGuaranteed> {
crate::collect::lower_impl_item(tcx, impl_item.impl_item_id());
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 `<Ty>` in `type foo = <Ty>`.
hir::ImplItemKind::Type(ty) if ty.span != DUMMY_SP => (None, ty.span),
_ => (None, impl_item.span),
};
check_associated_item(tcx, impl_item.owner_id.def_id, span, method_sig)
}
fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(), ErrorGuaranteed> {
fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), ErrorGuaranteed> {
match param.kind {
// We currently only check wf of const params here.
hir::GenericParamKind::Lifetime { .. } | hir::GenericParamKind::Type { .. } => Ok(()),
ty::GenericParamDefKind::Lifetime | ty::GenericParamDefKind::Type { .. } => Ok(()),
// Const parameters are well formed if their type is structural match.
hir::GenericParamKind::Const { ty: hir_ty, default: _, synthetic: _ } => {
ty::GenericParamDefKind::Const { .. } => {
let ty = tcx.type_of(param.def_id).instantiate_identity();
let span = tcx.def_span(param.def_id);
let def_id = param.def_id.expect_local();
if tcx.features().unsized_const_params() {
enter_wf_checking_ctxt(tcx, hir_ty.span, tcx.local_parent(param.def_id), |wfcx| {
enter_wf_checking_ctxt(tcx, tcx.local_parent(def_id), |wfcx| {
wfcx.register_bound(
ObligationCause::new(
hir_ty.span,
param.def_id,
ObligationCauseCode::ConstParam(ty),
),
ObligationCause::new(span, def_id, ObligationCauseCode::ConstParam(ty)),
wfcx.param_env,
ty,
tcx.require_lang_item(LangItem::UnsizedConstParamTy, hir_ty.span),
tcx.require_lang_item(LangItem::UnsizedConstParamTy, span),
);
Ok(())
})
} else if tcx.features().adt_const_params() {
enter_wf_checking_ctxt(tcx, hir_ty.span, tcx.local_parent(param.def_id), |wfcx| {
enter_wf_checking_ctxt(tcx, tcx.local_parent(def_id), |wfcx| {
wfcx.register_bound(
ObligationCause::new(
hir_ty.span,
param.def_id,
ObligationCauseCode::ConstParam(ty),
),
ObligationCause::new(span, def_id, ObligationCauseCode::ConstParam(ty)),
wfcx.param_env,
ty,
tcx.require_lang_item(LangItem::ConstParamTy, hir_ty.span),
tcx.require_lang_item(LangItem::ConstParamTy, span),
);
Ok(())
})
} else {
let span = || {
let hir::GenericParamKind::Const { ty: &hir::Ty { span, .. }, .. } =
tcx.hir_node_by_def_id(def_id).expect_generic_param().kind
else {
bug!()
};
span
};
let mut diag = match ty.kind() {
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Error(_) => return Ok(()),
ty::FnPtr(..) => tcx.dcx().struct_span_err(
hir_ty.span,
span(),
"using function pointers as const generic parameters is forbidden",
),
ty::RawPtr(_, _) => tcx.dcx().struct_span_err(
hir_ty.span,
span(),
"using raw pointers as const generic parameters is forbidden",
),
_ => {
@ -940,7 +860,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
ty.error_reported()?;
tcx.dcx().struct_span_err(
hir_ty.span,
span(),
format!(
"`{ty}` is forbidden as the type of a const generic parameter",
),
@ -950,7 +870,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
diag.note("the only supported types are integers, `bool`, and `char`");
let cause = ObligationCause::misc(hir_ty.span, param.def_id);
let cause = ObligationCause::misc(span(), def_id);
let adt_const_params_feature_string =
" more complex and user defined types".to_string();
let may_suggest_feature = match type_allowed_to_implement_const_param_ty(
@ -1010,15 +930,13 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
}
}
#[instrument(level = "debug", skip(tcx, span, sig_if_method))]
fn check_associated_item(
#[instrument(level = "debug", skip(tcx))]
pub(crate) fn check_associated_item(
tcx: TyCtxt<'_>,
item_id: LocalDefId,
span: Span,
sig_if_method: Option<&hir::FnSig<'_>>,
) -> Result<(), ErrorGuaranteed> {
let loc = Some(WellFormedLoc::Ty(item_id));
enter_wf_checking_ctxt(tcx, span, item_id, |wfcx| {
enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
let item = tcx.associated_item(item_id);
// Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in case
@ -1033,6 +951,8 @@ fn check_associated_item(
}
};
let span = tcx.def_span(item_id);
match item.kind {
ty::AssocKind::Const { .. } => {
let ty = tcx.type_of(item.def_id).instantiate_identity();
@ -1049,14 +969,9 @@ fn check_associated_item(
}
ty::AssocKind::Fn { .. } => {
let sig = tcx.fn_sig(item.def_id).instantiate_identity();
let hir_sig = sig_if_method.expect("bad signature for method");
check_fn_or_method(
wfcx,
item.ident(tcx).span,
sig,
hir_sig.decl,
item.def_id.expect_local(),
);
let hir_sig =
tcx.hir_node_by_def_id(item_id).fn_sig().expect("bad signature for method");
check_fn_or_method(wfcx, sig, hir_sig.decl, item_id);
check_method_receiver(wfcx, hir_sig, item, self_ty)
}
ty::AssocKind::Type { .. } => {
@ -1083,7 +998,7 @@ fn check_type_defn<'tcx>(
let _ = tcx.representability(item.owner_id.def_id);
let adt_def = tcx.adt_def(item.owner_id);
enter_wf_checking_ctxt(tcx, item.span, item.owner_id.def_id, |wfcx| {
enter_wf_checking_ctxt(tcx, item.owner_id.def_id, |wfcx| {
let variants = adt_def.variants();
let packed = adt_def.repr().packed();
@ -1185,7 +1100,7 @@ fn check_type_defn<'tcx>(
}
}
check_where_clauses(wfcx, item.span, item.owner_id.def_id);
check_where_clauses(wfcx, item.owner_id.def_id);
Ok(())
})
}
@ -1215,8 +1130,8 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuarant
}
}
let res = enter_wf_checking_ctxt(tcx, item.span, def_id, |wfcx| {
check_where_clauses(wfcx, item.span, def_id);
let res = enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
check_where_clauses(wfcx, def_id);
Ok(())
});
@ -1252,72 +1167,63 @@ fn check_associated_type_bounds(wfcx: &WfCheckingCtxt<'_, '_>, item: ty::AssocIt
fn check_item_fn(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
ident: Ident,
span: Span,
decl: &hir::FnDecl<'_>,
) -> Result<(), ErrorGuaranteed> {
enter_wf_checking_ctxt(tcx, span, def_id, |wfcx| {
enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
let sig = tcx.fn_sig(def_id).instantiate_identity();
check_fn_or_method(wfcx, ident.span, sig, decl, def_id);
check_fn_or_method(wfcx, sig, decl, def_id);
Ok(())
})
}
enum UnsizedHandling {
Forbid,
AllowIfForeignTail,
}
#[instrument(level = "debug", skip(tcx, ty_span, unsized_handling))]
fn check_static_item(
#[instrument(level = "debug", skip(tcx))]
pub(super) fn check_static_item(
tcx: TyCtxt<'_>,
item_id: LocalDefId,
ty_span: Span,
unsized_handling: UnsizedHandling,
) -> Result<(), ErrorGuaranteed> {
enter_wf_checking_ctxt(tcx, ty_span, item_id, |wfcx| {
enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
let ty = tcx.type_of(item_id).instantiate_identity();
let item_ty = wfcx.deeply_normalize(ty_span, Some(WellFormedLoc::Ty(item_id)), ty);
let item_ty = wfcx.deeply_normalize(DUMMY_SP, Some(WellFormedLoc::Ty(item_id)), ty);
let forbid_unsized = match unsized_handling {
UnsizedHandling::Forbid => true,
UnsizedHandling::AllowIfForeignTail => {
let tail =
tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
!matches!(tail.kind(), ty::Foreign(_))
}
let is_foreign_item = tcx.is_foreign_item(item_id);
let forbid_unsized = !is_foreign_item || {
let tail = tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
!matches!(tail.kind(), ty::Foreign(_))
};
wfcx.register_wf_obligation(ty_span, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
wfcx.register_wf_obligation(DUMMY_SP, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
if forbid_unsized {
let span = tcx.def_span(item_id);
wfcx.register_bound(
traits::ObligationCause::new(
ty_span,
span,
wfcx.body_def_id,
ObligationCauseCode::SizedConstOrStatic,
),
wfcx.param_env,
item_ty,
tcx.require_lang_item(LangItem::Sized, ty_span),
tcx.require_lang_item(LangItem::Sized, span),
);
}
// Ensure that the end result is `Sync` in a non-thread local `static`.
let should_check_for_sync = tcx.static_mutability(item_id.to_def_id())
== Some(hir::Mutability::Not)
&& !tcx.is_foreign_item(item_id.to_def_id())
&& !is_foreign_item
&& !tcx.is_thread_local_static(item_id.to_def_id());
if should_check_for_sync {
let span = tcx.def_span(item_id);
wfcx.register_bound(
traits::ObligationCause::new(
ty_span,
span,
wfcx.body_def_id,
ObligationCauseCode::SharedStatic,
),
wfcx.param_env,
item_ty,
tcx.require_lang_item(LangItem::Sync, ty_span),
tcx.require_lang_item(LangItem::Sync, span),
);
}
Ok(())
@ -1328,9 +1234,8 @@ fn check_const_item(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
ty_span: Span,
item_span: Span,
) -> Result<(), ErrorGuaranteed> {
enter_wf_checking_ctxt(tcx, ty_span, def_id, |wfcx| {
enter_wf_checking_ctxt(tcx, def_id, |wfcx| {
let ty = tcx.type_of(def_id).instantiate_identity();
let ty = wfcx.deeply_normalize(ty_span, Some(WellFormedLoc::Ty(def_id)), ty);
@ -1346,7 +1251,7 @@ fn check_const_item(
tcx.require_lang_item(LangItem::Sized, ty_span),
);
check_where_clauses(wfcx, item_span, def_id);
check_where_clauses(wfcx, def_id);
Ok(())
})
@ -1359,7 +1264,7 @@ fn check_impl<'tcx>(
hir_self_ty: &hir::Ty<'_>,
hir_trait_ref: &Option<hir::TraitRef<'_>>,
) -> Result<(), ErrorGuaranteed> {
enter_wf_checking_ctxt(tcx, item.span, item.owner_id.def_id, |wfcx| {
enter_wf_checking_ctxt(tcx, item.owner_id.def_id, |wfcx| {
match hir_trait_ref {
Some(hir_trait_ref) => {
// `#[rustc_reservation_impl]` impls are not real impls and
@ -1443,14 +1348,14 @@ fn check_impl<'tcx>(
}
}
check_where_clauses(wfcx, item.span, item.owner_id.def_id);
check_where_clauses(wfcx, item.owner_id.def_id);
Ok(())
})
}
/// Checks where-clauses and inline bounds that are declared on `def_id`.
#[instrument(level = "debug", skip(wfcx))]
fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id: LocalDefId) {
pub(super) fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, def_id: LocalDefId) {
let infcx = wfcx.infcx;
let tcx = wfcx.tcx();
@ -1605,21 +1510,18 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
let predicates = predicates.instantiate_identity(tcx);
let predicates = wfcx.normalize(span, None, predicates);
debug!(?predicates.predicates);
assert_eq!(predicates.predicates.len(), predicates.spans.len());
let wf_obligations = predicates.into_iter().flat_map(|(p, sp)| {
let p = wfcx.normalize(sp, None, p);
traits::wf::clause_obligations(infcx, wfcx.param_env, wfcx.body_def_id, p, sp)
});
let obligations: Vec<_> = wf_obligations.chain(default_obligations).collect();
wfcx.register_obligations(obligations);
}
#[instrument(level = "debug", skip(wfcx, span, hir_decl))]
#[instrument(level = "debug", skip(wfcx, hir_decl))]
fn check_fn_or_method<'tcx>(
wfcx: &WfCheckingCtxt<'_, 'tcx>,
span: Span,
sig: ty::PolyFnSig<'tcx>,
hir_decl: &hir::FnDecl<'_>,
def_id: LocalDefId,
@ -1657,7 +1559,7 @@ fn check_fn_or_method<'tcx>(
);
}
check_where_clauses(wfcx, span, def_id);
check_where_clauses(wfcx, def_id);
if sig.abi == ExternAbi::RustCall {
let span = tcx.def_span(def_id);
@ -1746,17 +1648,18 @@ fn check_method_receiver<'tcx>(
}
let span = fn_sig.decl.inputs[0].span;
let loc = Some(WellFormedLoc::Param { function: method.def_id.expect_local(), param_idx: 0 });
let sig = tcx.fn_sig(method.def_id).instantiate_identity();
let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
let sig = wfcx.normalize(span, None, sig);
let sig = wfcx.normalize(DUMMY_SP, loc, sig);
debug!("check_method_receiver: sig={:?}", sig);
let self_ty = wfcx.normalize(span, None, self_ty);
let self_ty = wfcx.normalize(DUMMY_SP, loc, self_ty);
let receiver_ty = sig.inputs()[0];
let receiver_ty = wfcx.normalize(span, None, receiver_ty);
let receiver_ty = wfcx.normalize(DUMMY_SP, loc, receiver_ty);
// If the receiver already has errors reported, consider it valid to avoid
// unnecessary errors (#58712).
@ -2004,27 +1907,23 @@ fn legacy_receiver_is_implemented<'tcx>(
}
}
fn check_variances_for_type_defn<'tcx>(
tcx: TyCtxt<'tcx>,
item: &'tcx hir::Item<'tcx>,
hir_generics: &hir::Generics<'tcx>,
) {
match item.kind {
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) => {
pub(super) fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
match tcx.def_kind(def_id) {
DefKind::Enum | DefKind::Struct | DefKind::Union => {
// Ok
}
ItemKind::TyAlias(..) => {
DefKind::TyAlias => {
assert!(
tcx.type_alias_is_lazy(item.owner_id),
tcx.type_alias_is_lazy(def_id),
"should not be computing variance of non-free type alias"
);
}
kind => span_bug!(item.span, "cannot compute the variances of {kind:?}"),
kind => span_bug!(tcx.def_span(def_id), "cannot compute the variances of {kind:?}"),
}
let ty_predicates = tcx.predicates_of(item.owner_id);
let ty_predicates = tcx.predicates_of(def_id);
assert_eq!(ty_predicates.parent, None);
let variances = tcx.variances_of(item.owner_id);
let variances = tcx.variances_of(def_id);
let mut constrained_parameters: FxHashSet<_> = variances
.iter()
@ -2037,8 +1936,10 @@ fn check_variances_for_type_defn<'tcx>(
// Lazily calculated because it is only needed in case of an error.
let explicitly_bounded_params = LazyCell::new(|| {
let icx = crate::collect::ItemCtxt::new(tcx, item.owner_id.def_id);
hir_generics
let icx = crate::collect::ItemCtxt::new(tcx, def_id);
tcx.hir_node_by_def_id(def_id)
.generics()
.unwrap()
.predicates
.iter()
.filter_map(|predicate| match predicate.kind {
@ -2053,8 +1954,6 @@ fn check_variances_for_type_defn<'tcx>(
.collect::<FxHashSet<_>>()
});
let ty_generics = tcx.generics_of(item.owner_id);
for (index, _) in variances.iter().enumerate() {
let parameter = Parameter(index as u32);
@ -2062,9 +1961,13 @@ fn check_variances_for_type_defn<'tcx>(
continue;
}
let ty_param = &ty_generics.own_params[index];
let node = tcx.hir_node_by_def_id(def_id);
let item = node.expect_item();
let hir_generics = node.generics().unwrap();
let hir_param = &hir_generics.params[index];
let ty_param = &tcx.generics_of(item.owner_id).own_params[index];
if ty_param.def_id != hir_param.def_id.into() {
// Valid programs always have lifetimes before types in the generic parameter list.
// ty_generics are normalized to be in this required order, and variances are built
@ -2082,7 +1985,7 @@ fn check_variances_for_type_defn<'tcx>(
// Look for `ErrorGuaranteed` deeply within this type.
if let ControlFlow::Break(ErrorGuaranteed { .. }) = tcx
.type_of(item.owner_id)
.type_of(def_id)
.instantiate_identity()
.visit_with(&mut HasErrorDeep { tcx, seen: Default::default() })
{
@ -2301,7 +2204,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
#[instrument(level = "debug", skip(self))]
fn check_false_global_bounds(&mut self) {
let tcx = self.ocx.infcx.tcx;
let mut span = self.span;
let mut span = tcx.def_span(self.body_def_id);
let empty_env = ty::ParamEnv::empty();
let predicates_with_span = tcx.predicates_of(self.body_def_id).predicates.iter().copied();

View file

@ -605,159 +605,13 @@ fn get_new_lifetime_name<'tcx>(
(1..).flat_map(a_to_z_repeat_n).find(|lt| !existing_lifetimes.contains(lt.as_str())).unwrap()
}
#[instrument(level = "debug", skip_all)]
pub(super) fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
let it = tcx.hir_item(item_id);
debug!(item = ?it.kind.ident(), id = %it.hir_id());
let def_id = item_id.owner_id.def_id;
match &it.kind {
// These don't define types.
hir::ItemKind::ExternCrate(..)
| hir::ItemKind::Use(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
| hir::ItemKind::GlobalAsm { .. } => {}
hir::ItemKind::ForeignMod { items, .. } => {
for item in *items {
let item = tcx.hir_foreign_item(item.id);
tcx.ensure_ok().generics_of(item.owner_id);
tcx.ensure_ok().type_of(item.owner_id);
tcx.ensure_ok().predicates_of(item.owner_id);
if tcx.is_conditionally_const(def_id) {
tcx.ensure_ok().explicit_implied_const_bounds(def_id);
tcx.ensure_ok().const_conditions(def_id);
}
match item.kind {
hir::ForeignItemKind::Fn(..) => {
tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
tcx.ensure_ok().fn_sig(item.owner_id)
}
hir::ForeignItemKind::Static(..) => {
tcx.ensure_ok().codegen_fn_attrs(item.owner_id);
}
_ => (),
}
}
}
hir::ItemKind::Enum(..) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
lower_enum_variant_types(tcx, def_id.to_def_id());
}
hir::ItemKind::Impl { .. } => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().impl_trait_header(def_id);
tcx.ensure_ok().predicates_of(def_id);
tcx.ensure_ok().associated_items(def_id);
}
hir::ItemKind::Trait(..) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().trait_def(def_id);
tcx.at(it.span).explicit_super_predicates_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
tcx.ensure_ok().associated_items(def_id);
}
hir::ItemKind::TraitAlias(..) => {
tcx.ensure_ok().generics_of(def_id);
tcx.at(it.span).explicit_implied_predicates_of(def_id);
tcx.at(it.span).explicit_super_predicates_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
}
hir::ItemKind::Struct(_, _, struct_def) | hir::ItemKind::Union(_, _, struct_def) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
for f in struct_def.fields() {
tcx.ensure_ok().generics_of(f.def_id);
tcx.ensure_ok().type_of(f.def_id);
tcx.ensure_ok().predicates_of(f.def_id);
}
if let Some(ctor_def_id) = struct_def.ctor_def_id() {
lower_variant_ctor(tcx, ctor_def_id);
}
}
hir::ItemKind::TyAlias(..) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
}
hir::ItemKind::Static(..) | hir::ItemKind::Const(..) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
}
hir::ItemKind::Fn { .. } => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
tcx.ensure_ok().fn_sig(def_id);
tcx.ensure_ok().codegen_fn_attrs(def_id);
}
}
}
pub(crate) fn lower_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
let trait_item = tcx.hir_trait_item(trait_item_id);
let def_id = trait_item_id.owner_id;
tcx.ensure_ok().generics_of(def_id);
match trait_item.kind {
hir::TraitItemKind::Fn(..) => {
tcx.ensure_ok().codegen_fn_attrs(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().fn_sig(def_id);
}
hir::TraitItemKind::Const(..) => {
tcx.ensure_ok().type_of(def_id);
}
hir::TraitItemKind::Type(_, Some(_)) => {
tcx.ensure_ok().item_bounds(def_id);
tcx.ensure_ok().item_self_bounds(def_id);
tcx.ensure_ok().type_of(def_id);
}
hir::TraitItemKind::Type(_, None) => {
tcx.ensure_ok().item_bounds(def_id);
tcx.ensure_ok().item_self_bounds(def_id);
}
};
tcx.ensure_ok().predicates_of(def_id);
}
pub(super) fn lower_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) {
let def_id = impl_item_id.owner_id;
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
let impl_item = tcx.hir_impl_item(impl_item_id);
match impl_item.kind {
hir::ImplItemKind::Fn(..) => {
tcx.ensure_ok().codegen_fn_attrs(def_id);
tcx.ensure_ok().fn_sig(def_id);
}
hir::ImplItemKind::Type(_) => {}
hir::ImplItemKind::Const(..) => {}
}
}
fn lower_variant_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) {
pub(super) fn lower_variant_ctor(tcx: TyCtxt<'_>, def_id: LocalDefId) {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
}
fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
pub(super) fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
let def = tcx.adt_def(def_id);
let repr_type = def.repr().discr_type();
let initial = repr_type.initial_discriminant(tcx);

View file

@ -1186,7 +1186,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
ty: Ty<'tcx>,
obligation: &PredicateObligation<'tcx>,
) -> Diag<'a> {
let span = obligation.cause.span;
let param = obligation.cause.body_id;
let hir::GenericParamKind::Const { ty: &hir::Ty { span, .. }, .. } =
self.tcx.hir_node_by_def_id(param).expect_generic_param().kind
else {
bug!()
};
let mut diag = match ty.kind() {
ty::Float(_) => {

View file

@ -14,7 +14,7 @@ impl Tr for str {
type Arr = [u8; 8];
#[cfg(cfail)]
type Arr = [u8; Self::C];
//[cfail]~^ ERROR cycle detected when evaluating type-level constant
//[cfail]~^ ERROR cycle detected when caching mir
}
fn main() {}

View file

@ -12,7 +12,7 @@ fn take(
K = { () }
>,
) {}
//~^^^^^^ ERROR implementation of `Project` is not general enough
//~^^^^^ ERROR implementation of `Project` is not general enough
//~^^^^ ERROR higher-ranked subtype error
//~| ERROR higher-ranked subtype error

View file

@ -13,10 +13,14 @@ LL | K = { () }
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: implementation of `Project` is not general enough
--> $DIR/assoc-const-eq-bound-var-in-ty-not-wf.rs:9:4
--> $DIR/assoc-const-eq-bound-var-in-ty-not-wf.rs:10:13
|
LL | fn take(
| ^^^^ implementation of `Project` is not general enough
LL | _: impl Trait<
| _____________^
LL | | <<for<'a> fn(&'a str) -> &'a str as Project>::Out as Discard>::Out,
LL | | K = { () }
LL | | >,
| |_____^ implementation of `Project` is not general enough
|
= note: `Project` would have to be implemented for the type `for<'a> fn(&'a str) -> &'a str`
= note: ...but `Project` is actually implemented for the type `fn(&'0 str) -> &'0 str`, for some specific lifetime `'0`

View file

@ -1,8 +1,8 @@
error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
--> $DIR/issue-111879-0.rs:9:25
--> $DIR/issue-111879-0.rs:9:5
|
LL | pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,8 +1,8 @@
error: overflow evaluating associated type `T::This`
--> $DIR/normalization-overflow.rs:9:17
--> $DIR/normalization-overflow.rs:9:5
|
LL | type This = Self::This;
| ^^^^^^^^^^
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,10 +1,11 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regionck-1.rs:9:30
--> $DIR/regionck-1.rs:9:5
|
LL | type NoTyOutliv<'a, T> = &'a T;
| -- ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
| |
| the parameter type `T` must be valid for the lifetime `'a` as defined here...
| ^^^^^^^^^^^^^^^^--^^^^
| | |
| | the parameter type `T` must be valid for the lifetime `'a` as defined here...
| ...so that the reference type `&'a T` does not outlive the data it points at
|
help: consider adding an explicit lifetime bound
|
@ -12,10 +13,10 @@ LL | type NoTyOutliv<'a, T: 'a> = &'a T;
| ++++
error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
--> $DIR/regionck-1.rs:10:31
--> $DIR/regionck-1.rs:10:5
|
LL | type NoReOutliv<'a, 'b> = &'a &'b ();
| ^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/regionck-1.rs:10:21

View file

@ -1,4 +1,4 @@
error[E0391]: cycle detected when computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`
error[E0391]: cycle detected when computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type
--> $DIR/impl-wf-cycle-4.rs:5:1
|
LL | / impl<T> Filter for T
@ -6,14 +6,14 @@ LL | | where
LL | | T: Fn(Self::ToMatch),
| |_________________________^
|
note: ...which requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type...
note: ...which requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`...
--> $DIR/impl-wf-cycle-4.rs:5:1
|
LL | / impl<T> Filter for T
LL | | where
LL | | T: Fn(Self::ToMatch),
| |_________________________^
= note: ...which again requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`, completing the cycle
= note: ...which again requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type, completing the cycle
note: cycle used when checking that `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` is well-formed
--> $DIR/impl-wf-cycle-4.rs:5:1
|

View file

@ -32,16 +32,16 @@ pub trait Column: Expression {}
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
pub enum ColumnInsertValue<Col, Expr> where
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
Col: Column,
Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
{
Expression(Col, Expr),
Default(Col),

View file

@ -1,5 +1,5 @@
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:40:1
--> $DIR/issue-38821.rs:35:1
|
LL | pub enum ColumnInsertValue<Col, Expr> where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
@ -17,16 +17,10 @@ LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co
| +++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:40:1
--> $DIR/issue-38821.rs:38:22
|
LL | / pub enum ColumnInsertValue<Col, Expr> where
LL | |
LL | |
LL | | Col: Column,
... |
LL | | Default(Col),
LL | | }
| |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
@ -58,25 +52,6 @@ help: consider further restricting the associated type
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting the associated type
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
@ -107,10 +82,10 @@ LL | impl<T: NotNull> IntoNullable for T {
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:17
--> $DIR/issue-38821.rs:38:22
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
@ -137,7 +112,24 @@ LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting the associated type
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:38:22
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
help: consider further restricting the associated type
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@ -161,6 +153,20 @@ help: consider further restricting the associated type
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
@ -175,40 +181,25 @@ LL | impl<T: NotNull> IntoNullable for T {
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:38:22
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
help: consider further restricting the associated type
|
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
@ -225,10 +216,10 @@ LL | impl<T: NotNull> IntoNullable for T {
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
--> $DIR/issue-38821.rs:38:22
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
@ -237,7 +228,6 @@ LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
@ -255,10 +245,10 @@ LL | impl<T: NotNull> IntoNullable for T {
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
--> $DIR/issue-38821.rs:38:22
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18

View file

@ -10,8 +10,8 @@ pub trait Service {
pub trait ThriftService<Bug: NotFoo>:
//~^ ERROR the trait bound `Bug: Foo` is not satisfied
//~| ERROR the trait bound `Bug: Foo` is not satisfied
Service<AssocType = <Bug as Foo>::OnlyFoo>
//~^ ERROR the trait bound `Bug: Foo` is not satisfied
{
fn get_service(
//~^ ERROR the trait bound `Bug: Foo` is not satisfied

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied
--> $DIR/issue-59324.rs:11:1
|
LL | / pub trait ThriftService<Bug: NotFoo>:
... |
LL | |
LL | | Service<AssocType = <Bug as Foo>::OnlyFoo>
| |______________________________________________^ the trait `Foo` is not implemented for `Bug`
|
@ -12,15 +12,10 @@ LL | pub trait ThriftService<Bug: NotFoo + Foo>:
| +++++
error[E0277]: the trait bound `Bug: Foo` is not satisfied
--> $DIR/issue-59324.rs:11:1
--> $DIR/issue-59324.rs:13:13
|
LL | / pub trait ThriftService<Bug: NotFoo>:
LL | |
LL | |
LL | | Service<AssocType = <Bug as Foo>::OnlyFoo>
... |
LL | | }
| |_^ the trait `Foo` is not implemented for `Bug`
LL | Service<AssocType = <Bug as Foo>::OnlyFoo>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug`
|
help: consider further restricting type parameter `Bug` with trait `Foo`
|

View file

@ -22,6 +22,14 @@ LL | impl async Fn<()> for F {}
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/impl-header.rs:5:1
|
LL | impl async Fn<()> for F {}
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
error[E0277]: expected a `FnMut()` closure, found `F`
--> $DIR/impl-header.rs:5:23
|
@ -33,14 +41,6 @@ LL | impl async Fn<()> for F {}
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/impl-header.rs:5:1
|
LL | impl async Fn<()> for F {}
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0046, E0183, E0277, E0658.

View file

@ -1,3 +1,11 @@
error[E0046]: not all trait items implemented, missing: `eq`
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:1
|
LL | trait DynIncompatible { fn eq(&self, other: Self); }
| -------------------------- `eq` from trait
LL | impl DynIncompatible for dyn DynIncompatible { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
error[E0038]: the trait `DynIncompatible` is not dyn compatible
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:26
|
@ -14,14 +22,6 @@ LL | trait DynIncompatible { fn eq(&self, other: Self); }
| this trait is not dyn compatible...
= help: consider moving `eq` to another trait
error[E0046]: not all trait items implemented, missing: `eq`
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:1
|
LL | trait DynIncompatible { fn eq(&self, other: Self); }
| -------------------------- `eq` from trait
LL | impl DynIncompatible for dyn DynIncompatible { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0038, E0046.

View file

@ -1,3 +1,12 @@
error[E0046]: not all trait items implemented, missing: `Assoc`
--> $DIR/best-obligation-ICE.rs:10:1
|
LL | type Assoc;
| ---------- `Assoc` from trait
...
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation
error[E0277]: the trait bound `W<W<T>>: Trait` is not satisfied
--> $DIR/best-obligation-ICE.rs:10:19
|
@ -46,15 +55,6 @@ help: consider restricting type parameter `T` with trait `Trait`
LL | impl<T: Trait> Trait for W<W<W<T>>> {}
| +++++++
error[E0046]: not all trait items implemented, missing: `Assoc`
--> $DIR/best-obligation-ICE.rs:10:1
|
LL | type Assoc;
| ---------- `Assoc` from trait
...
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation
error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>`
--> $DIR/best-obligation-ICE.rs:18:1
|

View file

@ -5,6 +5,7 @@
struct Foo;
impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
//~^ ERROR the const parameter `NUM` is not constrained by the impl trait, self type, or predicates
//~| ERROR missing: `Output`, `add`
where
[(); 1 + 0]: Sized,
{

View file

@ -1,5 +1,5 @@
error[E0407]: method `unimplemented` is not a member of trait `std::ops::Add`
--> $DIR/post-analysis-user-facing-param-env.rs:11:5
--> $DIR/post-analysis-user-facing-param-env.rs:12:5
|
LL | / fn unimplemented(self, _: &Foo) -> Self::Output {
LL | |
@ -17,6 +17,19 @@ LL | #![feature(generic_const_exprs)]
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0046]: not all trait items implemented, missing: `Output`, `add`
--> $DIR/post-analysis-user-facing-param-env.rs:6:1
|
LL | / impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
LL | |
LL | |
LL | | where
LL | | [(); 1 + 0]: Sized,
| |_______________________^ missing `Output`, `add` in implementation
|
= help: implement the missing item: `type Output = /* Type */;`
= help: implement the missing item: `fn add(self, _: &'a Foo) -> <Self as Add<&'a Foo>>::Output { todo!() }`
error[E0207]: the const parameter `NUM` is not constrained by the impl trait, self type, or predicates
--> $DIR/post-analysis-user-facing-param-env.rs:6:10
|
@ -27,7 +40,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
= note: proving the result of expressions other than the parameter are unique is not supported
error[E0284]: type annotations needed
--> $DIR/post-analysis-user-facing-param-env.rs:11:40
--> $DIR/post-analysis-user-facing-param-env.rs:12:40
|
LL | fn unimplemented(self, _: &Foo) -> Self::Output {
| ^^^^^^^^^^^^ cannot infer the value of const parameter `NUM`
@ -40,7 +53,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
| |
| unsatisfied trait bound introduced here
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284, E0407.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0046, E0207, E0284, E0407.
For more information about an error, try `rustc --explain E0046`.

View file

@ -1,11 +1,3 @@
error: the constant `N` is not of type `usize`
--> $DIR/type_mismatch.rs:8:26
|
LL | impl<const N: u64> Q for [u8; N] {}
| ^^^^^^^ expected `usize`, found `u64`
|
= note: the length of array `[u8; N]` must be type `usize`
error[E0046]: not all trait items implemented, missing: `ASSOC`
--> $DIR/type_mismatch.rs:8:1
|
@ -15,6 +7,14 @@ LL | const ASSOC: usize;
LL | impl<const N: u64> Q for [u8; N] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation
error: the constant `N` is not of type `usize`
--> $DIR/type_mismatch.rs:8:26
|
LL | impl<const N: u64> Q for [u8; N] {}
| ^^^^^^^ expected `usize`, found `u64`
|
= note: the length of array `[u8; N]` must be type `usize`
error: the constant `13` is not of type `u64`
--> $DIR/type_mismatch.rs:12:26
|

View file

@ -15,6 +15,7 @@ struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
//~^ ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates
//~^^ ERROR mismatched types
//~| ERROR missing: `next`
type Item = &'a [T; N];
}

View file

@ -49,6 +49,20 @@ LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error[E0308]: mismatched types
--> $DIR/ice-unexpected-inference-var-122549.rs:15:66
|
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^ expected `usize`, found `()`
error[E0046]: not all trait items implemented, missing: `next`
--> $DIR/ice-unexpected-inference-var-122549.rs:15:1
|
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `next` in implementation
|
= help: implement the missing item: `fn next(&mut self) -> Option<<Self as Iterator>::Item> { todo!() }`
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/ice-unexpected-inference-var-122549.rs:15:13
|
@ -58,13 +72,7 @@ LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
= 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[E0308]: mismatched types
--> $DIR/ice-unexpected-inference-var-122549.rs:15:66
|
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^ expected `usize`, found `()`
error: aborting due to 7 previous errors
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392.
For more information about an error, try `rustc --explain E0046`.

View file

@ -7,7 +7,7 @@ LL | | const VALUE: bool = false;
... |
LL | | <IsCopy<T>>::VALUE
LL | | } as usize] = [];
| |_____________________^
| |_______________^
|
help: try adding a `where` bound
|

View file

@ -14,5 +14,6 @@ impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T
//~^ ERROR mismatched types [E0308]
//~| ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates [E0207]
type Item = &'a [T; N]; }
//~^ ERROR: `Item` specializes an item from a parent `impl`, but that item is not marked `default`
fn main() {}

View file

@ -34,6 +34,17 @@ LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error[E0520]: `Item` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/normalizing_with_unconstrained_impl_params.rs:16:5
|
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
| ---------------------------------------------------------------------------------------- parent `impl` is here
...
LL | type Item = &'a [T; N]; }
| ^^^^^^^^^ cannot specialize default item `Item`
|
= note: to specialize, `Item` in the parent `impl` must be marked `default`
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/normalizing_with_unconstrained_impl_params.rs:13:30
|
@ -54,7 +65,7 @@ LL | fn next(&mut self) -> Option<Self::Item> {}
= note: expected enum `Option<_>`
found unit type `()`
error: aborting due to 7 previous errors
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0637.
Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0520, E0637.
For more information about an error, try `rustc --explain E0046`.

View file

@ -11,7 +11,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
| ^^^^^
|
= note: ...which immediately requires computing type of `Trait::N` again
note: cycle used when computing explicit predicates of trait `Trait`
note: cycle used when checking that `Trait` is well-formed
--> $DIR/not_wf_param_in_rpitit.rs:3:1
|
LL | trait Trait<const N: dyn Trait = bar> {

View file

@ -17,19 +17,19 @@ LL | const CONST_FOO: str = *"foo";
= note: statics and constants must have a statically known size
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
--> $DIR/const-unsized.rs:11:18
--> $DIR/const-unsized.rs:11:1
|
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
= note: statics and constants must have a statically known size
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/const-unsized.rs:15:20
--> $DIR/const-unsized.rs:15:1
|
LL | static STATIC_BAR: str = *"bar";
| ^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: statics and constants must have a statically known size

View file

@ -24,10 +24,10 @@ LL | static FOO: dyn Sync = AtomicUsize::new(0);
| +++
error[E0277]: the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
--> $DIR/const_refs_to_static-ice-121413.rs:8:17
--> $DIR/const_refs_to_static-ice-121413.rs:8:5
|
LL | static FOO: Sync = AtomicUsize::new(0);
| ^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Sync + 'static)`
= note: statics and constants must have a statically known size

View file

@ -1,8 +1,8 @@
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/dont-ctfe-unsized-initializer.rs:1:11
--> $DIR/dont-ctfe-unsized-initializer.rs:1:1
|
LL | static S: str = todo!();
| ^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: statics and constants must have a statically known size

View file

@ -29,7 +29,7 @@ LL | struct S<const S: (), const S: S = { S }>;
| ^
|
= note: ...which immediately requires computing type of `S::S` again
note: cycle used when computing explicit predicates of `S`
note: cycle used when checking that `S` is well-formed
--> $DIR/issue-103790.rs:4:1
|
LL | struct S<const S: (), const S: S = { S }>;

View file

@ -8,10 +8,8 @@ LL | trait Chromosome: Chromosome {
note: cycle used when checking that `Chromosome` is well-formed
--> $DIR/cycle-trait-supertrait-direct.rs:3:1
|
LL | / trait Chromosome: Chromosome {
LL | |
LL | | }
| |_^
LL | trait Chromosome: Chromosome {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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

View file

@ -13,10 +13,8 @@ LL | trait T2 : T1 {
note: cycle used when checking that `T1` is well-formed
--> $DIR/issue-12511.rs:1:1
|
LL | / trait T1 : T2 {
LL | |
LL | | }
| |_^
LL | trait T1 : T2 {
| ^^^^^^^^^^^^^
= 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

View file

@ -10,11 +10,11 @@ note: ...which requires comparing an impl and trait method signature, inferring
LL | reuse to_reuse::opaque_ret;
| ^^^^^^^^^^
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::opaque_ret::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>` is well-formed
--> $DIR/unsupported.rs:21:5
note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::opaque_ret` is compatible with trait definition
--> $DIR/unsupported.rs:22:25
|
LL | impl ToReuse for u8 {
| ^^^^^^^^^^^^^^^^^^^
LL | reuse to_reuse::opaque_ret;
| ^^^^^^^^^^
= 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 `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret::{anon_assoc#0}`
@ -29,11 +29,11 @@ note: ...which requires comparing an impl and trait method signature, inferring
LL | reuse ToReuse::opaque_ret;
| ^^^^^^^^^^
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>` is well-formed
--> $DIR/unsupported.rs:24:5
note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret` is compatible with trait definition
--> $DIR/unsupported.rs:25:24
|
LL | impl ToReuse for u16 {
| ^^^^^^^^^^^^^^^^^^^^
LL | reuse ToReuse::opaque_ret;
| ^^^^^^^^^^
= 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: recursive delegation is not supported yet

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:27:18
--> $DIR/explicit-drop-bounds.rs:32:5
|
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18
@ -15,10 +15,10 @@ LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply
| ++++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:32:5
--> $DIR/explicit-drop-bounds.rs:27:18
|
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:38:18
--> $DIR/explicit-drop-bounds.rs:41:5
|
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18
@ -15,10 +15,10 @@ LL | impl<T: std::marker::Copy> Drop for DropMe<T>
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:41:5
--> $DIR/explicit-drop-bounds.rs:38:18
|
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18

View file

@ -3,5 +3,6 @@ struct Foo {}
impl<const UNUSED: usize> Drop for Foo {}
//~^ ERROR: `Drop` impl requires `the constant `_` has type `usize``
//~| ERROR: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
//~| ERROR: missing: `drop`
fn main() {}

View file

@ -10,6 +10,14 @@ note: the implementor must specify the same requirement
LL | struct Foo {}
| ^^^^^^^^^^
error[E0046]: not all trait items implemented, missing: `drop`
--> $DIR/unconstrained_const_param_on_drop.rs:3:1
|
LL | impl<const UNUSED: usize> Drop for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
= help: implement the missing item: `fn drop(&mut self) { todo!() }`
error[E0207]: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
--> $DIR/unconstrained_const_param_on_drop.rs:3:6
|
@ -19,7 +27,7 @@ LL | impl<const UNUSED: usize> Drop for 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: aborting due to 3 previous errors
Some errors have detailed explanations: E0207, E0367.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0046, E0207, E0367.
For more information about an error, try `rustc --explain E0046`.

View file

@ -15,6 +15,18 @@ LL | | A
LL | | }
| |_- not a struct or union
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/eval-error.rs:2:5
|
LL | a: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/eval-error.rs:2:8
|
@ -33,18 +45,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | a: Box<str>,
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/eval-error.rs:2:5
|
LL | a: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error[E0080]: the type `Foo` has an unknown layout
--> $DIR/eval-error.rs:9:30
|

View file

@ -1,8 +1,8 @@
error[E0277]: the size for values of type `[usize]` cannot be known at compilation time
--> $DIR/issue-36122-accessing-externed-dst.rs:3:24
--> $DIR/issue-36122-accessing-externed-dst.rs:3:9
|
LL | static symbol: [usize];
| ^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[usize]`
= note: statics and constants must have a statically known size

View file

@ -56,6 +56,19 @@ LL | impl Fn<()> for Foo {
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0053]: method `call` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^ expected `&Foo`, found `Foo`
|
= note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
found signature `extern "rust-call" fn(Foo, ()) -> ()`
help: change the self-receiver type to match the trait
|
LL | extern "rust-call" fn call(&self, args: ()) -> () {}
| +
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
|
@ -85,19 +98,6 @@ LL | impl Fn<()> for Foo {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0053]: method `call` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^ expected `&Foo`, found `Foo`
|
= note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
found signature `extern "rust-call" fn(Foo, ()) -> ()`
help: change the self-receiver type to match the trait
|
LL | extern "rust-call" fn call(&self, args: ()) -> () {}
| +
error[E0183]: manual implementations of `FnOnce` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
|
@ -144,17 +144,6 @@ LL | impl FnOnce() for Foo1 {
|
= help: implement the missing item: `type Output = /* Type */;`
error[E0277]: expected a `FnOnce()` closure, found `Bar`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
|
LL | impl FnMut<()> for Bar {
| ^^^ expected an `FnOnce()` closure, found `Bar`
|
= help: the trait `FnOnce()` is not implemented for `Bar`
= note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `FnMut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:36
|
@ -168,6 +157,17 @@ help: change the self-receiver type to match the trait
LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
| +++
error[E0277]: expected a `FnOnce()` closure, found `Bar`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
|
LL | impl FnMut<()> for Bar {
| ^^^ expected an `FnOnce()` closure, found `Bar`
|
= help: the trait `FnOnce()` is not implemented for `Bar`
= note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `FnMut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `Output`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1
|

View file

@ -10,6 +10,14 @@ help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>`
LL | impl Fn(u32) -> u32 for S {
| ^^^^^^^^^^^^^^
error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
--> $DIR/issue-39259.rs:9:13
|
LL | fn call(&self) -> u32 {
| ^^^^^ expected 2 parameters, found 1
|
= note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
error[E0277]: expected a `FnMut(u32)` closure, found `S`
--> $DIR/issue-39259.rs:6:25
|
@ -20,14 +28,6 @@ LL | impl Fn(u32) -> u32 for S {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
--> $DIR/issue-39259.rs:9:13
|
LL | fn call(&self) -> u32 {
| ^^^^^ expected 2 parameters, found 1
|
= note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0050, E0229, E0277.

View file

@ -5,12 +5,13 @@ LL | impl<'b, T, U> AsRef2 for Foo<T>
| ^ unconstrained type parameter
error[E0309]: the parameter type `U` may not live long enough
--> $DIR/issue-87735.rs:34:21
--> $DIR/issue-87735.rs:34:3
|
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...
| ^^^^^^^^^^^^--^
| | |
| | the parameter type `U` must be valid for the lifetime `'a` as defined here...
| ...so that the type `U` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/issue-87735.rs:23:22

View file

@ -5,12 +5,13 @@ LL | impl<'q, Q, I, F> A for TestB<Q, F>
| ^ unconstrained type parameter
error[E0309]: the parameter type `F` may not live long enough
--> $DIR/issue-88526.rs:16:18
--> $DIR/issue-88526.rs:16:5
|
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...
| ^^^^^^^--^
| | |
| | the parameter type `F` must be valid for the lifetime `'a` as defined here...
| ...so that the reference type `&'a F` does not outlive the data it points at
|
help: consider adding an explicit lifetime bound
|

View file

@ -9,6 +9,7 @@ impl <T, T1> Foo for T {
type F<T1> = &[u8];
//~^ ERROR: the name `T1` is already used for
//~| ERROR: `&` without an explicit lifetime name cannot be used here
//~| ERROR: has 1 type parameter but its trait declaration has 0 type parameters
}
fn main() {}

View file

@ -13,13 +13,22 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
LL | type F<T1> = &[u8];
| ^ explicit lifetime name needed here
error[E0049]: associated type `F` has 1 type parameter but its trait declaration has 0 type parameters
--> $DIR/gat-trait-path-generic-type-arg.rs:9:12
|
LL | type F<'a>;
| -- expected 0 type parameters
...
LL | type F<T1> = &[u8];
| ^^ found 1 type parameter
error[E0207]: the type parameter `T1` is not constrained by the impl trait, self type, or predicates
--> $DIR/gat-trait-path-generic-type-arg.rs:7:10
|
LL | impl <T, T1> Foo for T {
| ^^ unconstrained type parameter
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0207, E0403, E0637.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0049, E0207, E0403, E0637.
For more information about an error, try `rustc --explain E0049`.

View file

@ -18,12 +18,13 @@ LL | type Item<'a> = &'a mut T where Self: 'a;
| ++++++++++++++
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-84931.rs:14:21
--> $DIR/issue-84931.rs:14:5
|
LL | type Item<'a> = &'a mut T;
| -- ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
| |
| the parameter type `T` must be valid for the lifetime `'a` as defined here...
| ^^^^^^^^^^--^
| | |
| | the parameter type `T` must be valid for the lifetime `'a` as defined here...
| ...so that the reference type `&'a mut T` does not outlive the data it points at
|
help: consider adding an explicit lifetime bound
|

View file

@ -82,6 +82,14 @@ help: consider adding an explicit lifetime bound
LL | struct Far<T: 'static
| +++++++++
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/static-lifetime-tip-with-default-type.rs:22:10
|
LL | struct S<'a, K: 'a = i32>(&'static K);
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error[E0310]: the parameter type `K` may not live long enough
--> $DIR/static-lifetime-tip-with-default-type.rs:22:27
|
@ -96,14 +104,6 @@ help: consider adding an explicit lifetime bound
LL | struct S<'a, K: 'a + 'static = i32>(&'static K);
| +++++++++
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/static-lifetime-tip-with-default-type.rs:22:10
|
LL | struct S<'a, K: 'a = i32>(&'static K);
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0310, E0392.

View file

@ -2,7 +2,7 @@ error: unconstrained generic constant
--> $DIR/evaluatable-bounds.rs:14:5
|
LL | const ARRAY: [i32; Self::LEN];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try adding a `where` bound
|

View file

@ -53,10 +53,10 @@ LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
--> $DIR/issue-89118.rs:22:20
--> $DIR/issue-89118.rs:22:5
|
LL | type Handler = Ctx<C::Dispatcher>;
| ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
| ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
help: this trait has no implementations, consider adding one
--> $DIR/issue-89118.rs:1:1

View file

@ -19,6 +19,28 @@ help: consider further restricting type parameter `F` with trait `MyFn`
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:36:5
|
LL | / fn autobatch<F>(self) -> impl Trait
... |
LL | | where
LL | | F: Callback<Self::CallbackArg>,
| |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`
|
note: required for `F` to implement `Callback<i32>`
--> $DIR/false-positive-predicate-entailment-error.rs:14:21
|
LL | impl<A, F: MyFn<A>> Callback<A> for F {
| ------- ^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting type parameter `F` with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: Callback<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:42:12
|
@ -45,28 +67,6 @@ help: consider further restricting type parameter `F` with trait `MyFn`
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:36:5
|
LL | / fn autobatch<F>(self) -> impl Trait
... |
LL | | where
LL | | F: Callback<Self::CallbackArg>,
| |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`
|
note: required for `F` to implement `Callback<i32>`
--> $DIR/false-positive-predicate-entailment-error.rs:14:21
|
LL | impl<A, F: MyFn<A>> Callback<A> for F {
| ------- ^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting type parameter `F` with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:36:30
|

View file

@ -46,11 +46,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
--> $DIR/method-compatability-via-leakage-cycle.rs:17:1
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
|
LL | impl Trait for u32 {
| ^^^^^^^^^^^^^^^^^^
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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

View file

@ -50,11 +50,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
--> $DIR/method-compatability-via-leakage-cycle.rs:17:1
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
|
LL | impl Trait for u32 {
| ^^^^^^^^^^^^^^^^^^
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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 `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`
@ -109,11 +109,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
--> $DIR/method-compatability-via-leakage-cycle.rs:17:1
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
|
LL | impl Trait for u32 {
| ^^^^^^^^^^^^^^^^^^
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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`

View file

@ -9,6 +9,7 @@ pub trait Mirror {
impl<T: ?Sized> Mirror for () {
//~^ ERROR the type parameter `T` is not constrained
type Assoc = T;
//~^ ERROR the size for values of type `T` cannot be known at compilation time
}
pub trait First {

View file

@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
LL | impl<T: ?Sized> Mirror for () {
| ^ unconstrained type parameter
error: aborting due to 1 previous error
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/refine-resolution-errors.rs:11:18
|
LL | impl<T: ?Sized> Mirror for () {
| - this type parameter needs to be `Sized`
LL |
LL | type Assoc = T;
| ^ doesn't have a size known at compile-time
|
note: required by a bound in `Mirror::Assoc`
--> $DIR/refine-resolution-errors.rs:7:5
|
LL | type Assoc;
| ^^^^^^^^^^^ required by this bound in `Mirror::Assoc`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - impl<T: ?Sized> Mirror for () {
LL + impl<T> Mirror for () {
|
help: consider relaxing the implicit `Sized` restriction
|
LL | type Assoc: ?Sized;
| ++++++++
For more information about this error, try `rustc --explain E0207`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0207, E0277.
For more information about an error, try `rustc --explain E0207`.

View file

@ -1,3 +1,15 @@
error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration
--> $DIR/span-bug-issue-121457.rs:10:14
|
LL | type Item<'a>
| ---- lifetimes in impl do not match this associated type in trait
LL | where
LL | Self: 'a;
| -- this bound might be missing in the impl
...
LL | type Item = u32;
| ^ lifetimes do not match associated type in trait
error[E0582]: binding for associated type `Item` references lifetime `'missing`, which does not appear in the trait input types
--> $DIR/span-bug-issue-121457.rs:13:51
|
@ -12,18 +24,6 @@ LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration
--> $DIR/span-bug-issue-121457.rs:10:14
|
LL | type Item<'a>
| ---- lifetimes in impl do not match this associated type in trait
LL | where
LL | Self: 'a;
| -- this bound might be missing in the impl
...
LL | type Item = u32;
| ^ lifetimes do not match associated type in trait
error[E0277]: `()` is not an iterator
--> $DIR/span-bug-issue-121457.rs:13:23
|

View file

@ -6,6 +6,7 @@ impl<'a, T> Foo for T {
//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
fn test() -> &'a () {
//~^ WARN: does not match trait method signature
&()
}
}

View file

@ -1,9 +1,27 @@
warning: impl trait in impl method signature does not match trait method signature
--> $DIR/unconstrained-lt.rs:8:18
|
LL | fn test() -> impl Sized;
| ---------- return type from trait method defined here
...
LL | fn test() -> &'a () {
| ^^^^^^
|
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
= note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
= note: `#[warn(refining_impl_trait_internal)]` on by default
help: replace the return type so that it matches the trait
|
LL - fn test() -> &'a () {
LL + fn test() -> impl Sized {
|
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
--> $DIR/unconstrained-lt.rs:5:6
|
LL | impl<'a, T> Foo for T {
| ^^ unconstrained lifetime parameter
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0207`.

View file

@ -1,8 +1,8 @@
error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
--> $DIR/impl-header-unnormalized-types.rs:15:18
--> $DIR/impl-header-unnormalized-types.rs:15:5
|
LL | type Assoc = &'a &'b ();
| ^^^^^^^^^^
| ^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/impl-header-unnormalized-types.rs:14:6

View file

@ -20,7 +20,7 @@ note: cycle used when checking that `T1` is well-formed
--> $DIR/infinite-trait-alias-recursion.rs:3:1
|
LL | trait T1 = T2;
| ^^^^^^^^^^^^^^
| ^^^^^^^^
= 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

View file

@ -1,24 +1,24 @@
error[E0275]: overflow normalizing the type alias `X2`
--> $DIR/infinite-type-alias-mutual-recursion.rs:6:11
--> $DIR/infinite-type-alias-mutual-recursion.rs:6:1
|
LL | type X1 = X2;
| ^^
| ^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
error[E0275]: overflow normalizing the type alias `X3`
--> $DIR/infinite-type-alias-mutual-recursion.rs:9:11
--> $DIR/infinite-type-alias-mutual-recursion.rs:9:1
|
LL | type X2 = X3;
| ^^
| ^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
error[E0275]: overflow normalizing the type alias `X1`
--> $DIR/infinite-type-alias-mutual-recursion.rs:11:11
--> $DIR/infinite-type-alias-mutual-recursion.rs:11:1
|
LL | type X3 = X1;
| ^^
| ^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead

View file

@ -1,8 +1,8 @@
error[E0275]: overflow normalizing the type alias `X`
--> $DIR/infinite-vec-type-recursion.rs:6:10
--> $DIR/infinite-vec-type-recursion.rs:6:1
|
LL | type X = Vec<X>;
| ^^^^^^
| ^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead

View file

@ -1,8 +1,8 @@
error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
--> $DIR/issue-54410.rs:2:28
--> $DIR/issue-54410.rs:2:5
|
LL | pub static mut symbol: [i8];
| ^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[i8]`
= note: statics and constants must have a statically known size

View file

@ -1,8 +1,8 @@
error[E0277]: `RefCell<isize>` cannot be shared between threads safely
--> $DIR/issue-7364.rs:4:15
--> $DIR/issue-7364.rs:4:1
|
LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0));
| ^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `RefCell<isize>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead

View file

@ -70,6 +70,18 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | field2: Box<str>, // Unsized
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
|
LL | field2: str, // Unsized
| ^^^^^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | field2: std::mem::ManuallyDrop<str>, // Unsized
| +++++++++++++++++++++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:13
|
@ -88,18 +100,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | field2: Box<str>, // Unsized
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
|
LL | field2: str, // Unsized
| ^^^^^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | field2: std::mem::ManuallyDrop<str>, // Unsized
| +++++++++++++++++++++++ +
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0277, E0740.

View file

@ -1,3 +1,16 @@
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
|
LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
note: required by a bound in `FnOnce`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:24:12
|
@ -12,9 +25,9 @@ LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:45:5
|
LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
note: required by a bound in `FnOnce`
@ -37,19 +50,6 @@ help: consider further restricting type parameter `A` with unstable trait `Tuple
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:45:5
|
LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
note: required by a bound in `FnOnce`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0277]: functions with the "rust-call" ABI must take a single non-self tuple argument
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
|

View file

@ -1,8 +1,8 @@
error[E0275]: overflow normalizing the type alias `Loop`
--> $DIR/inherent-impls-overflow.rs:8:13
--> $DIR/inherent-impls-overflow.rs:8:1
|
LL | type Loop = Loop;
| ^^^^
| ^^^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
@ -15,18 +15,18 @@ LL | impl Loop {}
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
error[E0275]: overflow normalizing the type alias `Poly0<(((((((...,),),),),),),)>`
--> $DIR/inherent-impls-overflow.rs:17:17
--> $DIR/inherent-impls-overflow.rs:17:1
|
LL | type Poly0<T> = Poly1<(T,)>;
| ^^^^^^^^^^^
| ^^^^^^^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
error[E0275]: overflow normalizing the type alias `Poly1<(((((((...,),),),),),),)>`
--> $DIR/inherent-impls-overflow.rs:21:17
--> $DIR/inherent-impls-overflow.rs:21:1
|
LL | type Poly1<T> = Poly0<(T,)>;
| ^^^^^^^^^^^
| ^^^^^^^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead

View file

@ -1,8 +1,8 @@
error[E0271]: type mismatch resolving `Loop normalizes-to _`
--> $DIR/inherent-impls-overflow.rs:8:13
--> $DIR/inherent-impls-overflow.rs:8:1
|
LL | type Loop = Loop;
| ^^^^ types differ
| ^^^^^^^^^ types differ
error[E0271]: type mismatch resolving `Loop normalizes-to _`
--> $DIR/inherent-impls-overflow.rs:12:1
@ -17,10 +17,10 @@ LL | impl Loop {}
| ^^^^ types differ
error[E0275]: overflow evaluating the requirement `Poly1<(T,)> == _`
--> $DIR/inherent-impls-overflow.rs:17:17
--> $DIR/inherent-impls-overflow.rs:17:1
|
LL | type Poly0<T> = Poly1<(T,)>;
| ^^^^^^^^^^^
| ^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)
@ -36,10 +36,10 @@ LL | type Poly0<T> = Poly1<(T,)>;
= note: all type parameters must be used in a non-recursive way in order to constrain their variance
error[E0275]: overflow evaluating the requirement `Poly0<(T,)> == _`
--> $DIR/inherent-impls-overflow.rs:21:17
--> $DIR/inherent-impls-overflow.rs:21:1
|
LL | type Poly1<T> = Poly0<(T,)>;
| ^^^^^^^^^^^
| ^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`)

View file

@ -5,10 +5,10 @@ LL | impl<T> Loop<T> {}
| ^ unconstrained type parameter
error[E0275]: overflow normalizing the type alias `Loop<T>`
--> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:16
--> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:1
|
LL | type Loop<T> = Loop<T>;
| ^^^^^^^
| ^^^^^^^^^^^^
|
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead

View file

@ -7,12 +7,6 @@ LL | beta: [(); foo::<&'a ()>()],
= note: lifetime parameters may not be used in const expressions
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-64173-unused-lifetimes.rs:4:28
|
LL | array: [(); size_of::<&Self>()],
| ^^^^
error[E0392]: lifetime parameter `'s` is never used
--> $DIR/issue-64173-unused-lifetimes.rs:3:12
|
@ -21,6 +15,12 @@ LL | struct Foo<'s> {
|
= help: consider removing `'s`, referring to it in a field, or using a marker such as `PhantomData`
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-64173-unused-lifetimes.rs:4:28
|
LL | array: [(); size_of::<&Self>()],
| ^^^^
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/issue-64173-unused-lifetimes.rs:15:12
|

View file

@ -7,10 +7,12 @@ async fn wrapper<F>(f: F)
//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
where
F:,
for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
{
//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
let mut i = 41;

View file

@ -10,10 +10,26 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
--> $DIR/issue-76168-hr-outlives-3.rs:6:10
--> $DIR/issue-76168-hr-outlives-3.rs:12:50
|
LL | async fn wrapper<F>(f: F)
| ^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
| ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
--> $DIR/issue-76168-hr-outlives-3.rs:12:57
|
LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
| ^^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
--> $DIR/issue-76168-hr-outlives-3.rs:12:72
|
LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
| ^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
@ -41,7 +57,7 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
--> $DIR/issue-76168-hr-outlives-3.rs:14:1
--> $DIR/issue-76168-hr-outlives-3.rs:16:1
|
LL | / {
LL | |
@ -52,6 +68,6 @@ LL | | }
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
error: aborting due to 5 previous errors
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0277`.

View file

@ -32,6 +32,14 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>`
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/issue-95023.rs:3:1
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
--> $DIR/issue-95023.rs:3:21
|
@ -42,14 +50,6 @@ LL | impl Fn(&isize) for Error {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/issue-95023.rs:3:1
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
error[E0220]: associated type `B` not found for `Self`
--> $DIR/issue-95023.rs:8:44
|

View file

@ -1,3 +1,14 @@
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/macro-span-issue-116502.rs:7:13
|
LL | _
| ^ not allowed in type signatures
...
LL | struct S<T = m!()>(m!(), T)
| ---- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/macro-span-issue-116502.rs:7:13
|
@ -20,17 +31,6 @@ LL | struct S<T = m!()>(m!(), T)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/macro-span-issue-116502.rs:7:13
|
LL | _
| ^ not allowed in type signatures
...
LL | struct S<T = m!()>(m!(), T)
| ---- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0121`.

View file

@ -7,11 +7,10 @@ struct Wrapper;
impl Wrapper {
fn do_something_wrapper<O, F>(self, _: F)
//~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
//~| ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
where
F: for<'a> FnOnce(<F as Output<'a>>::Type),
//~^ ERROR the trait bound `F: Output<'_>` is not satisfied
//~| ERROR the trait bound `F: Output<'_>` is not satisfied
//~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
//~| ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
{
}
}

View file

@ -3,7 +3,6 @@ error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
|
LL | / fn do_something_wrapper<O, F>(self, _: F)
LL | |
LL | |
LL | | where
LL | | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F`
@ -14,54 +13,43 @@ LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
| ++++++++++++++++++++
error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
--> $DIR/filter-relevant-fn-bounds.rs:8:8
--> $DIR/filter-relevant-fn-bounds.rs:11:12
|
LL | fn do_something_wrapper<O, F>(self, _: F)
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
|
help: consider further restricting type parameter `F` with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
| ++++++++++++++++++++
error[E0277]: the trait bound `F: Output<'_>` is not satisfied
--> $DIR/filter-relevant-fn-bounds.rs:12:12
error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
--> $DIR/filter-relevant-fn-bounds.rs:11:20
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
|
help: consider further restricting type parameter `F` with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
| ++++++++++++
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
| ++++++++++++++++++++
error[E0277]: the trait bound `F: Output<'_>` is not satisfied
--> $DIR/filter-relevant-fn-bounds.rs:12:20
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
|
help: consider further restricting type parameter `F` with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
| ++++++++++++
error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}`
--> $DIR/filter-relevant-fn-bounds.rs:21:34
error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
--> $DIR/filter-relevant-fn-bounds.rs:20:34
|
LL | wrapper.do_something_wrapper(|value| ());
| -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}`
| -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:21:34: 21:41}`
= help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
help: this trait has no implementations, consider adding one
--> $DIR/filter-relevant-fn-bounds.rs:1:1
|
LL | trait Output<'a> {
| ^^^^^^^^^^^^^^^^
note: required by a bound in `Wrapper::do_something_wrapper`
--> $DIR/filter-relevant-fn-bounds.rs:12:12
--> $DIR/filter-relevant-fn-bounds.rs:11:12
|
LL | fn do_something_wrapper<O, F>(self, _: F)
| -------------------- required by a bound in this associated function
@ -69,6 +57,6 @@ LL | fn do_something_wrapper<O, F>(self, _: F)
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper`
error: aborting due to 5 previous errors
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,8 +1,8 @@
error[E0478]: lifetime bound not satisfied
--> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:19:16
--> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:19:5
|
LL | type Bar = BarImpl<'a, 'b, T>;
| ^^^^^^^^^^^^^^^^^^
| ^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
--> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:14:6

View file

@ -4,6 +4,14 @@ error[E0226]: only a single explicit lifetime bound is permitted
LL | z: Box<dyn Is<'a>+'b+'c>,
| ^^
error[E0392]: lifetime parameter `'c` is never used
--> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18
|
LL | struct Foo<'a,'b,'c> {
| ^^ unused lifetime parameter
|
= help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData`
error[E0478]: lifetime bound not satisfied
--> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:8
|
@ -21,14 +29,6 @@ note: but lifetime parameter must outlive the lifetime `'a` as defined here
LL | struct Foo<'a,'b,'c> {
| ^^
error[E0392]: lifetime parameter `'c` is never used
--> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18
|
LL | struct Foo<'a,'b,'c> {
| ^^ unused lifetime parameter
|
= help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0226, E0392, E0478.

View file

@ -22,9 +22,9 @@ where
// Here we get an error: we need `'a: 'b`.
fn bar<'a, 'b>()
//~^ ERROR cannot infer
where
<() as Project<'a, 'b>>::Item: Eq,
//~^ ERROR cannot infer
{
}

View file

@ -1,8 +1,8 @@
error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/regions-normalize-in-where-clause-list.rs:24:4
--> $DIR/regions-normalize-in-where-clause-list.rs:26:36
|
LL | fn bar<'a, 'b>()
| ^^^
LL | <() as Project<'a, 'b>>::Item: Eq,
| ^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/regions-normalize-in-where-clause-list.rs:24:8
@ -15,10 +15,10 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined he
LL | fn bar<'a, 'b>()
| ^^
note: ...so that the types are compatible
--> $DIR/regions-normalize-in-where-clause-list.rs:24:4
--> $DIR/regions-normalize-in-where-clause-list.rs:26:36
|
LL | fn bar<'a, 'b>()
| ^^^
LL | <() as Project<'a, 'b>>::Item: Eq,
| ^^
= note: expected `Project<'a, 'b>`
found `Project<'_, '_>`

View file

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-region-rev.rs:17:20
--> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9
|
LL | type Out = &'a Foo<'b>;
| ^^^^^^^^^^^
| ^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10

View file

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-region.rs:17:20
--> $DIR/regions-outlives-nominal-type-region.rs:17:9
|
LL | type Out = &'a Foo<'b>;
| ^^^^^^^^^^^
| ^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/regions-outlives-nominal-type-region.rs:16:10

View file

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-type-rev.rs:17:20
--> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9
|
LL | type Out = &'a Foo<&'b i32>;
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10

View file

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-type.rs:17:20
--> $DIR/regions-outlives-nominal-type-type.rs:17:9
|
LL | type Out = &'a Foo<&'b i32>;
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/regions-outlives-nominal-type-type.rs:16:10

View file

@ -1,10 +1,10 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:13:16
--> $DIR/regions-struct-not-wf.rs:13:5
|
LL | impl<'a, T> Trait<'a, T> for usize {
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a T;
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
| ^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
help: consider adding an explicit lifetime bound
|
@ -12,12 +12,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
| ++++
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:21:16
--> $DIR/regions-struct-not-wf.rs:21:5
|
LL | impl<'a, T> Trait<'a, T> for u32 {
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
| ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/regions-struct-not-wf.rs:16:20
@ -30,10 +30,10 @@ LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
| ++++
error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
--> $DIR/regions-struct-not-wf.rs:25:16
--> $DIR/regions-struct-not-wf.rs:25:5
|
LL | type Out = &'a &'b T;
| ^^^^^^^^^
| ^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined here
--> $DIR/regions-struct-not-wf.rs:24:6

View file

@ -1,3 +1,9 @@
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
--> $DIR/array-trait.rs:22:1
|
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
| ^^^^^^^^^^^^^^^^^^^^^
error: unconstrained generic constant
--> $DIR/array-trait.rs:22:23
|
@ -9,12 +15,6 @@ help: try adding a `where` bound
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]) where [(); S::SIZE]:;
| ++++++++++++++++++++
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
--> $DIR/array-trait.rs:22:1
|
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
| ^^^^^^^^^^^^^^^^^^^^^
error: unconstrained generic constant
--> $DIR/array-trait.rs:22:23
|

View file

@ -18,14 +18,6 @@ LL | #![feature(specialization)]
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
error: impls of auto traits cannot be default
--> $DIR/validation.rs:9:21
|
LL | default unsafe impl Send for S {}
| ------- ^^^^ auto trait
| |
| default because of this
error[E0367]: `!Send` impl requires `Z: Send` but the struct it is implemented for does not
--> $DIR/validation.rs:12:1
|
@ -38,6 +30,14 @@ note: the implementor must specify the same requirement
LL | struct Z;
| ^^^^^^^^
error: impls of auto traits cannot be default
--> $DIR/validation.rs:9:21
|
LL | default unsafe impl Send for S {}
| ------- ^^^^ auto trait
| |
| default because of this
error: impls of auto traits cannot be default
--> $DIR/validation.rs:12:15
|

View file

@ -1,8 +1,8 @@
error: unconstrained generic constant
--> $DIR/issue-51892.rs:14:17
--> $DIR/issue-51892.rs:14:5
|
LL | type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^
|
help: try adding a `where` bound
|

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `B: Clone` is not satisfied
--> $DIR/issue-79224.rs:28:29
--> $DIR/issue-79224.rs:30:5
|
LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting type parameter `B` with trait `Clone`
@ -11,10 +11,10 @@ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
error[E0277]: the trait bound `B: Clone` is not satisfied
--> $DIR/issue-79224.rs:30:5
--> $DIR/issue-79224.rs:28:29
|
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting type parameter `B` with trait `Clone`

View file

@ -1,17 +1,17 @@
error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
--> $DIR/issue-24446.rs:2:17
--> $DIR/issue-24446.rs:2:5
|
LL | static foo: dyn Fn() -> u32 = || -> u32 {
| ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
= note: shared static variables must have a type that implements `Sync`
error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
--> $DIR/issue-24446.rs:2:17
--> $DIR/issue-24446.rs:2:5
|
LL | static foo: dyn Fn() -> u32 = || -> u32 {
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
= note: statics and constants must have a statically known size

View file

@ -1,8 +1,8 @@
error[E0277]: `Foo` cannot be shared between threads safely
--> $DIR/issue-17718-static-sync.rs:9:13
--> $DIR/issue-17718-static-sync.rs:9:1
|
LL | static BAR: Foo = Foo;
| ^^^ `Foo` cannot be shared between threads safely
| ^^^^^^^^^^^^^^^ `Foo` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Foo`
= note: shared static variables must have a type that implements `Sync`

View file

@ -1,8 +1,8 @@
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:6:5
--> $DIR/uninhabited-static.rs:12:1
|
LL | static VOID: Void;
| ^^^^^^^^^^^^^^^^^
LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
| ^^^^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
@ -13,26 +13,6 @@ note: the lint level is defined here
LL | #![deny(uninhabited_static)]
| ^^^^^^^^^^^^^^^^^^
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:8:5
|
LL | static NEVER: !;
| ^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:12:1
|
LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
| ^^^^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:15:1
|
@ -43,6 +23,26 @@ LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
= note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:6:5
|
LL | static VOID: Void;
| ^^^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:8:5
|
LL | static NEVER: !;
| ^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error[E0080]: constructing invalid value: encountered a value of uninhabited type `Void`
--> $DIR/uninhabited-static.rs:12:31
|

View file

@ -1,8 +1,8 @@
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/unsized_type2.rs:14:24
--> $DIR/unsized_type2.rs:14:1
|
LL | pub static WITH_ERROR: Foo = Foo { version: 0 };
| ^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `Foo`, the trait `Sized` is not implemented for `str`
note: required because it appears within the type `Foo`

View file

@ -22,10 +22,10 @@ LL | fn bar() -> i32 where Self: Sized;
| +++++++++++++++++
error[E0277]: `(dyn Qux + 'static)` cannot be shared between threads safely
--> $DIR/unsizing-wfcheck-issue-127299.rs:12:13
--> $DIR/unsizing-wfcheck-issue-127299.rs:12:1
|
LL | static FOO: &Lint = &Lint { desc: "desc" };
| ^^^^^ `(dyn Qux + 'static)` cannot be shared between threads safely
| ^^^^^^^^^^^^^^^^^ `(dyn Qux + 'static)` cannot be shared between threads safely
|
= help: within `&'static Lint`, the trait `Sync` is not implemented for `(dyn Qux + 'static)`
= note: required because it appears within the type `&'static (dyn Qux + 'static)`

View file

@ -1,9 +1,3 @@
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<T, S> Trait<T> 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
|
@ -16,6 +10,12 @@ note: trait defined here, with 1 generic parameter: `T`
LL | pub trait Trait<T> {
| ^^^^^ -
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<T, S> Trait<T> 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:19:12
|

View file

@ -35,6 +35,17 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self
LL | impl<T, U> Foo<T> for [isize; 1] {
| ^ unconstrained type parameter
error[E0119]: conflicting implementations of trait `Bar`
--> $DIR/constrained-type-params-trait-impl.rs:48:1
|
LL | impl<T, U> Bar for T {
| -------------------- first implementation here
...
LL | / impl<T, U> Bar for T
LL | | where
LL | | T: Bar<Out = U>,
| |____________________^ conflicting implementation
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
--> $DIR/constrained-type-params-trait-impl.rs:42:9
|
@ -59,17 +70,6 @@ error[E0207]: the type parameter `V` is not constrained by the impl trait, self
LL | impl<T, U, V> Foo<T> for T
| ^ unconstrained type parameter
error[E0119]: conflicting implementations of trait `Bar`
--> $DIR/constrained-type-params-trait-impl.rs:48:1
|
LL | impl<T, U> Bar for T {
| -------------------- first implementation here
...
LL | / impl<T, U> Bar for T
LL | | where
LL | | T: Bar<Out = U>,
| |____________________^ conflicting implementation
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0119, E0207.

View file

@ -8,9 +8,10 @@ trait Bar {
}
impl<T> Bar for T
//~^ ERROR the trait bound `T: Foo` is not satisfied
//~| ERROR the trait bound `T: Foo` is not satisfied
where
<T as Foo>::Assoc: Sized,
//~^ ERROR the trait bound `T: Foo` is not satisfied
//~| ERROR the trait bound `T: Foo` is not satisfied
{
fn method() {}
//~^ ERROR the trait bound `T: Foo` is not satisfied
@ -18,7 +19,6 @@ where
//~| ERROR the trait bound `T: Foo` is not satisfied
//~| ERROR the trait bound `T: Foo` is not satisfied
//~| ERROR the trait bound `T: Foo` is not satisfied
//~| ERROR the trait bound `T: Foo` is not satisfied
}
fn main() {}

View file

@ -1,20 +1,8 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
|
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting type parameter `T` with trait `Foo`
|
LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:9:1
|
LL | / impl<T> Bar for T
LL | |
LL | |
LL | | where
LL | | <T as Foo>::Assoc: Sized,
| |_____________________________^ the trait `Foo` is not implemented for `T`
@ -25,15 +13,10 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:9:1
--> $DIR/deep-norm-pending.rs:16:5
|
LL | / impl<T> Bar for T
LL | |
LL | |
LL | | where
... |
LL | | }
| |_^ the trait `Foo` is not implemented for `T`
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting type parameter `T` with trait `Foo`
|
@ -41,7 +24,7 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
--> $DIR/deep-norm-pending.rs:16:5
|
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@ -53,7 +36,7 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
--> $DIR/deep-norm-pending.rs:16:5
|
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@ -72,7 +55,7 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
--> $DIR/deep-norm-pending.rs:16:5
|
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@ -103,7 +86,18 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
--> $DIR/deep-norm-pending.rs:12:24
|
LL | <T as Foo>::Assoc: Sized,
| ^^^^^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting type parameter `T` with trait `Foo`
|
LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:16:5
|
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
@ -115,11 +109,12 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:8
--> $DIR/deep-norm-pending.rs:12:24
|
LL | fn method() {}
| ^^^^^^ the trait `Foo` is not implemented for `T`
LL | <T as Foo>::Assoc: Sized,
| ^^^^^ the trait `Foo` is not implemented for `T`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting type parameter `T` with trait `Foo`
|
LL | <T as Foo>::Assoc: Sized, T: Foo

View file

@ -1,3 +1,14 @@
error: type parameter `T` is only used recursively
--> $DIR/issue-105231.rs:1:15
|
LL | struct A<T>(B<T>);
| - ^
| |
| type parameter must be used non-recursively in the definition
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= note: all type parameters must be used in a non-recursive way in order to constrain their variance
error[E0072]: recursive types `A` and `B` have infinite size
--> $DIR/issue-105231.rs:1:1
|
@ -15,17 +26,6 @@ LL |
LL ~ struct B<T>(Box<A<A<T>>>);
|
error: type parameter `T` is only used recursively
--> $DIR/issue-105231.rs:1:15
|
LL | struct A<T>(B<T>);
| - ^
| |
| type parameter must be used non-recursively in the definition
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= note: all type parameters must be used in a non-recursive way in order to constrain their variance
error: type parameter `T` is only used recursively
--> $DIR/issue-105231.rs:4:17
|

Some files were not shown because too many files have changed in this diff Show more