Skip to content

Report infer ty errors during hir ty lowering #142420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3151,6 +3151,15 @@ pub enum TraitItemKind<'hir> {
/// type.
Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
}
impl TraitItemKind<'_> {
pub fn descr(&self) -> &'static str {
match self {
TraitItemKind::Const(..) => "associated constant",
TraitItemKind::Fn(..) => "function",
TraitItemKind::Type(..) => "associated type",
}
}
}

// The bodies for items are stored "out of line", in a separate
// hashmap in the `Crate`. Here we just record the hir-id of the item
Expand Down Expand Up @@ -3212,6 +3221,15 @@ pub enum ImplItemKind<'hir> {
/// An associated type.
Type(&'hir Ty<'hir>),
}
impl ImplItemKind<'_> {
pub fn descr(&self) -> &'static str {
match self {
ImplItemKind::Const(..) => "associated constant",
ImplItemKind::Fn(..) => "function",
ImplItemKind::Type(..) => "associated type",
}
}
}

/// A constraint on an associated item.
///
Expand Down Expand Up @@ -4537,6 +4555,16 @@ pub enum ForeignItemKind<'hir> {
Type,
}

impl ForeignItemKind<'_> {
pub fn descr(&self) -> &'static str {
match self {
ForeignItemKind::Fn(..) => "function",
ForeignItemKind::Static(..) => "static variable",
ForeignItemKind::Type => "type",
}
}
}
Comment on lines +4558 to +4566
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably just use tcx.def_descr, but it causes a lot of diffs across the test suite because it calls associated functions associated functions or methods respectively


/// A variable captured by a closure.
#[derive(Debug, Copy, Clone, HashStable_Generic)]
pub struct Upvar {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
item.name = ? tcx.def_path_str(def_id)
);
crate::collect::lower_item(tcx, item.item_id());
crate::collect::reject_placeholder_type_signatures_in_item(tcx, item);

let res = match item.kind {
// Right now we check that every default trait implementation
Expand Down
Loading
Loading