Skip to content

Commit 46cc60b

Browse files
Rollup merge of rust-lang#142420 - oli-obk:infer-ty-coalescing, r=compiler-errors
Report infer ty errors during hir ty lowering This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent. r? ``@compiler-errors``
2 parents 4adee2b + 110cf7e commit 46cc60b

29 files changed

+393
-644
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,6 +3141,15 @@ pub enum TraitItemKind<'hir> {
31413141
/// type.
31423142
Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
31433143
}
3144+
impl TraitItemKind<'_> {
3145+
pub fn descr(&self) -> &'static str {
3146+
match self {
3147+
TraitItemKind::Const(..) => "associated constant",
3148+
TraitItemKind::Fn(..) => "function",
3149+
TraitItemKind::Type(..) => "associated type",
3150+
}
3151+
}
3152+
}
31443153

31453154
// The bodies for items are stored "out of line", in a separate
31463155
// hashmap in the `Crate`. Here we just record the hir-id of the item
@@ -3202,6 +3211,15 @@ pub enum ImplItemKind<'hir> {
32023211
/// An associated type.
32033212
Type(&'hir Ty<'hir>),
32043213
}
3214+
impl ImplItemKind<'_> {
3215+
pub fn descr(&self) -> &'static str {
3216+
match self {
3217+
ImplItemKind::Const(..) => "associated constant",
3218+
ImplItemKind::Fn(..) => "function",
3219+
ImplItemKind::Type(..) => "associated type",
3220+
}
3221+
}
3222+
}
32053223

32063224
/// A constraint on an associated item.
32073225
///
@@ -4527,6 +4545,16 @@ pub enum ForeignItemKind<'hir> {
45274545
Type,
45284546
}
45294547

4548+
impl ForeignItemKind<'_> {
4549+
pub fn descr(&self) -> &'static str {
4550+
match self {
4551+
ForeignItemKind::Fn(..) => "function",
4552+
ForeignItemKind::Static(..) => "static variable",
4553+
ForeignItemKind::Type => "type",
4554+
}
4555+
}
4556+
}
4557+
45304558
/// A variable captured by a closure.
45314559
#[derive(Debug, Copy, Clone, HashStable_Generic)]
45324560
pub struct Upvar {

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
231231
item.name = ? tcx.def_path_str(def_id)
232232
);
233233
crate::collect::lower_item(tcx, item.item_id());
234-
crate::collect::reject_placeholder_type_signatures_in_item(tcx, item);
235234

236235
let res = match item.kind {
237236
// Right now we check that every default trait implementation

0 commit comments

Comments
 (0)