Repository navigation
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
With #60966, we can avoid lang items and manual path matching for lints, and instead mark them in the code. But I think there are some places that could still be ported to the new system:
- The
InvalidValuelint usesmatch_def_pathfortransmute-- somehow, using a diagnostic item did not work (is_diagnostic_itemreturns false). - Aren't
RcandArclang items just for diagnostics? Here's where they get used:rust/src/librustc_typeck/check/expr.rs
Lines 879 to 880 in f49f388
try_alt_rcvr(&mut err, rcvr_t, lang_items::Arc); try_alt_rcvr(&mut err, rcvr_t, lang_items::Rc);
And, indirectly, at
rust/src/librustc_mir/borrow_check/error_reporting.rs
Lines 720 to 723 in f49f388
if ty.is_rc() { format!("an `Rc`") } else if ty.is_arc() { format!("an `Arc`")
So, I am not sure if those should be lang items or diagnostic items now? No language semantics is attached to them, the uses above are just in error messages from what I can see. - There's also no language semantics attached to
MaybeUninit; it is a lang item because it gets used in layout construction for generators. Doesn't really fit "diagnostics item" either, though. (EDIT: decided this makes more sense to remain a lang item)
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
Centril commentedon Nov 5, 2019
If they are only used in diagnostics then they shouldn't be lang items.
A reasonable argument could be made for "layout construction for generators" => language semantics attached; but it's a sort of code-reuse that's going on in layout construction... something with similar semantics as compared to
MaybeUninit<T>could ostensibly be used instead. cc @tmandryRollup merge of rust-lang#66217 - RalfJung:diagnostic-items, r=Centril
Rollup merge of rust-lang#76910 - lcnr:foreign-item-like, r=oli-obk
Rollup merge of rust-lang#76910 - lcnr:foreign-item-like, r=oli-obk