Conversation
| let has_self_assoc_type = if let SelfSource::QPath(ty) = source | ||
| && let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = ty.kind | ||
| && let Res::SelfTyAlias { alias_to: impl_def_id, .. } = path.res | ||
| && let DefKind::Impl { .. } = self.tcx.def_kind(impl_def_id) |
There was a problem hiding this comment.
While this does nicely detect the scenario in issue #142797, it's not very general. E.g., it obviously doesn't account for:
struct Struct;
trait Trait { type AssocStruct; }
impl Trait for i32 { type AssocStruct = Struct; }
fn main() { let _ = i32::AssocStruct; } //~ ERROR no associated item … found …There was a problem hiding this comment.
Makes sense, fixed along with the below comment: 5a0eccf
| #![allow(dead_code, unused_variables)] | ||
|
|
There was a problem hiding this comment.
| #![allow(dead_code, unused_variables)] |
Compiletest already automatically adds -Aunused to UI tests (unless they're run-{pass,crash}) which implies dead_code and unused_variables.
There was a problem hiding this comment.
I always forgot to remove them on copy-pasting from the playground... Fixed in 5a0eccf.
There was a problem hiding this comment.
I'm wondering if we should just unconditionally talk about associated function or constant instead of associated item because that's actually the truth, rustc_hir_typeck::method looks for assoc fns, assoc consts & enum variants, not assoc items in general.
Then we wouldn't need to check for the presence of assoc tys which is rather ad hoc.
variant or associated item→variant, associated function or constantfunction or associated item,associated item→associated function or constant
I know it's slightly lengthier but associated item is strictly speaking incorrect. @estebank, I'd also like to hear what you think about this proposal :)
There was a problem hiding this comment.
Fair enough, aligned to your proposal in 5a0eccf. Would like to know Esteban's view as well.
2fe5590 to
5a0eccf
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #153605) made this pull request unmergeable. Please resolve the merge conflicts. |
Fix #142797
r? @fmease