Tweak incorrect assoc item note#152880
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 comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5a0eccf to
f17ed10
Compare
|
This PR modifies |
|
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. |
This comment has been minimized.
This comment has been minimized.
f17ed10 to
104d049
Compare
This comment has been minimized.
This comment has been minimized.
104d049 to
531631c
Compare
|
@bors r=fmease Thank you for the review! |
Rollup of 11 pull requests Successful merges: - #152880 (Tweak incorrect assoc item note) - #153526 (Fix LegacyKeyValueFormat report from docker build: i686) - #153613 (interpreter error reporting: remove arguments that are always the same) - #154029 (Replace `truncate(0)` with `clear()`) - #154125 (Inline and remove `DepGraphData::try_mark_parent_green`.) - #154185 (Prevent no_threads RwLock's write() impl from setting mode to -1 when it is locked for reading) - #154394 (Normalize rustc path prefix when testing `-Z track-diagnostics`) - #154450 (Use the normal arg-parsing machinery for `-Zassert-incr-state`) - #154475 (Emit a pre-expansion feature gate warning for `box`'ed struct field patterns) - #154500 (EnumSizeOpt: use Allocation::write_scalar instead of manual endianess logic) - #154502 (interpret: ensure that untupled arguments are actually tuples)
Fix #142797
r? @fmease