Auto merge of #143879 - fee1-dead-contrib:push-lrlpoouyqqry, r=fmease

parse `const trait Trait`

r? oli-obk or anyone from project-const-traits

cc `@rust-lang/project-const-traits`
This commit is contained in:
bors 2025-07-17 15:54:33 +00:00
commit 9cd918bcbb
94 changed files with 365 additions and 299 deletions

View file

@ -453,7 +453,7 @@ pub fn report_dyn_incompatibility<'tcx>(
let trait_str = tcx.def_path_str(trait_def_id);
let trait_span = tcx.hir_get_if_local(trait_def_id).and_then(|node| match node {
hir::Node::Item(item) => match item.kind {
hir::ItemKind::Trait(_, _, ident, ..) | hir::ItemKind::TraitAlias(ident, _, _) => {
hir::ItemKind::Trait(_, _, _, ident, ..) | hir::ItemKind::TraitAlias(ident, _, _) => {
Some(ident.span)
}
_ => unreachable!(),

View file

@ -268,7 +268,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let node = self.tcx.hir_node_by_def_id(body_id);
match node {
hir::Node::Item(hir::Item {
kind: hir::ItemKind::Trait(_, _, ident, generics, bounds, _),
kind: hir::ItemKind::Trait(_, _, _, ident, generics, bounds, _),
..
}) if self_ty == self.tcx.types.self_param => {
assert!(param_ty);
@ -331,7 +331,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
}
hir::Node::Item(hir::Item {
kind:
hir::ItemKind::Trait(_, _, _, generics, ..)
hir::ItemKind::Trait(_, _, _, _, generics, ..)
| hir::ItemKind::Impl(hir::Impl { generics, .. }),
..
}) if projection.is_some() => {
@ -355,7 +355,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
hir::ItemKind::Struct(_, generics, _)
| hir::ItemKind::Enum(_, generics, _)
| hir::ItemKind::Union(_, generics, _)
| hir::ItemKind::Trait(_, _, _, generics, ..)
| hir::ItemKind::Trait(_, _, _, _, generics, ..)
| hir::ItemKind::Impl(hir::Impl { generics, .. })
| hir::ItemKind::Fn { generics, .. }
| hir::ItemKind::TyAlias(_, generics, _)
@ -415,7 +415,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
hir::ItemKind::Struct(_, generics, _)
| hir::ItemKind::Enum(_, generics, _)
| hir::ItemKind::Union(_, generics, _)
| hir::ItemKind::Trait(_, _, _, generics, ..)
| hir::ItemKind::Trait(_, _, _, _, generics, ..)
| hir::ItemKind::Impl(hir::Impl { generics, .. })
| hir::ItemKind::Fn { generics, .. }
| hir::ItemKind::TyAlias(_, generics, _)
@ -3446,7 +3446,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let mut is_auto_trait = false;
match tcx.hir_get_if_local(data.impl_or_alias_def_id) {
Some(Node::Item(hir::Item {
kind: hir::ItemKind::Trait(is_auto, _, ident, ..),
kind: hir::ItemKind::Trait(_, is_auto, _, ident, ..),
..
})) => {
// FIXME: we should do something else so that it works even on crate foreign