Skip to content

Commit 3dd01ac

Browse files
committed
Auto merge of #142420 - oli-obk:infer-ty-coalescing, r=<try>
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 5b74275 + 3db719c commit 3dd01ac

25 files changed

+326
-601
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,6 +3151,15 @@ pub enum TraitItemKind<'hir> {
31513151
/// type.
31523152
Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
31533153
}
3154+
impl TraitItemKind<'_> {
3155+
pub fn descr(&self) -> &'static str {
3156+
match self {
3157+
TraitItemKind::Const(..) => "associated constant",
3158+
TraitItemKind::Fn(..) => "function",
3159+
TraitItemKind::Type(..) => "associated type",
3160+
}
3161+
}
3162+
}
31543163

31553164
// The bodies for items are stored "out of line", in a separate
31563165
// hashmap in the `Crate`. Here we just record the hir-id of the item
@@ -3212,6 +3221,15 @@ pub enum ImplItemKind<'hir> {
32123221
/// An associated type.
32133222
Type(&'hir Ty<'hir>),
32143223
}
3224+
impl ImplItemKind<'_> {
3225+
pub fn descr(&self) -> &'static str {
3226+
match self {
3227+
ImplItemKind::Const(..) => "associated constant",
3228+
ImplItemKind::Fn(..) => "function",
3229+
ImplItemKind::Type(..) => "associated type",
3230+
}
3231+
}
3232+
}
32153233

32163234
/// A constraint on an associated item.
32173235
///
@@ -4537,6 +4555,16 @@ pub enum ForeignItemKind<'hir> {
45374555
Type,
45384556
}
45394557

4558+
impl ForeignItemKind<'_> {
4559+
pub fn descr(&self) -> &'static str {
4560+
match self {
4561+
ForeignItemKind::Fn(..) => "function",
4562+
ForeignItemKind::Static(..) => "static variable",
4563+
ForeignItemKind::Type => "type",
4564+
}
4565+
}
4566+
}
4567+
45404568
/// A variable captured by a closure.
45414569
#[derive(Debug, Copy, Clone, HashStable_Generic)]
45424570
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)