about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/lang_items.rs
AgeCommit message (Collapse)AuthorLines
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-13/+14
2022-12-18avoid .into() conversion to identical typesMatthias Krüger-2/+0
2022-11-13Store a LocalDefId in hir::Variant & hir::Field.Camille GILLOT-1/+1
2022-10-29Simplify lang item groupsCameron Steffen-3/+0
2022-10-29Factor out ITEM_REFSCameron Steffen-8/+7
2022-10-29Encode LangItem directlyCameron Steffen-8/+8
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-2/+2
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-10-07avoid string dispatch in fluentNathan Stocks-5/+11
2022-10-07First batch of review feedback changes from #102110Nathan Stocks-4/+4
2022-10-07migrate lang_items.rs to translateable diagnosticsNathan Stocks-91/+79
2022-10-07use consistent namesNathan Stocks-4/+4
2022-10-07Migrate InvalidAttrAtCrateLevelrdvdev2-5/+2
Co-authored-by: Nathan Stocks <cleancut@github.com> Co-authored-by: rdvdev2 <rdvdev2@gmail.com>
2022-10-07Migrate derivable diagnostics in lang_items.rsrdvdev2-22/+8
2022-05-06use def_span and def_kind queries instead of calling tcx.hir() methodsMiguel Guarniz-2/+2
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08add mapping from DefKind to Target and remove more ItemLikeVisitor implsMiguel Guarniz-27/+15
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08remove some uses of visit_all_item_likes in typeck, symbol_mangling and ↵Miguel Guarniz-1/+16
passes crates Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-01-09Clean up lang_items::extractEric Huss-3/+1
Noted in https://github.com/rust-lang/rust/pull/87739#pullrequestreview-740497194, lang_items::extract no longer needs to take a closure.
2021-12-15Remove `in_band_lifetimes` for `rustc_passes`Peter Jaszkowiak-2/+2
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-3/+2
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-1/+1
2021-08-25Auto merge of #87875 - asquared31415:generic-lang-items, r=cjgillotbors-87/+35
Improve detection of generics on lang items Adds detection for the required generics for all lang items. Many lang items require an exact or minimum amount of generic arguments and if they don't exist, the compiler will ICE. This does not add any additional validation about bounds on generics or any other lang item restrictions. Fixes one of the ICEs in #87573 cc `@FabianWolff`
2021-08-23Detect incorrect number of lang item genericsasquared31415-87/+35
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-1/+2
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-07-08Rollup merge of #86726 - ↵Guillaume Gomez-3/+0
sexxi-goose:use-diagnostic-item-for-rfc2229-migration, r=nikomatsakis Use diagnostic items instead of lang items for rfc2229 migrations This PR removes the `Send`, `UnwindSafe` and `RefUnwindSafe` lang items introduced in https://github.com/rust-lang/rust/pull/84730, and uses diagnostic items instead to check for `Send`, `UnwindSafe` and `RefUnwindSafe` traits for RFC2229 migrations. r? ```@nikomatsakis```
2021-07-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-1/+1
2021-06-29Remove lang items Send, UnwindSafe and RefUnwindSafeRoxane Fruytier-3/+0
2021-05-18Rollup merge of #85339 - FabianWolff:issue-83893, r=varkorGuillaume Gomez-3/+124
Report an error if a lang item has the wrong number of generic arguments This pull request fixes #83893. The issue is that the lang item code currently checks whether the lang item has the correct item kind (e.g. a `#[lang="add"]` has to be a trait), but not whether the item has the correct number of generic arguments. This can lead to an "index out of bounds" ICE when the compiler tries to create more substitutions than there are suitable types available (if the lang item was declared with too many generic arguments). For instance, here is a reduced ("reduced" in the sense that it does not trigger additional errors) version of the example given in #83893: ```rust #![feature(lang_items,no_core)] #![no_core] #![crate_type="lib"] #[lang = "sized"] trait MySized {} #[lang = "add"] trait MyAdd<'a, T> {} fn ice() { let r = 5; let a = 6; r + a } ``` On current nightly, this immediately causes an ICE without any warnings or errors emitted. With the changes in this PR, however, I get no ICE and two errors: ``` error[E0718]: `add` language item must be applied to a trait with 1 generic argument --> pr-ex.rs:8:1 | 8 | #[lang = "add"] | ^^^^^^^^^^^^^^^ 9 | trait MyAdd<'a, T> {} | ------- this trait has 2 generic arguments, not 1 error[E0369]: cannot add `{integer}` to `{integer}` --> pr-ex.rs:14:7 | 14 | r + a | - ^ - {integer} | | | {integer} error: aborting due to 2 previous errors Some errors have detailed explanations: E0369, E0718. For more information about an error, try `rustc --explain E0369`. ```
2021-05-17Two minor changes for readability and efficiencyFabian Wolff-3/+2
2021-05-16Implement changes suggested by varkorFabian Wolff-5/+49
2021-05-15Report an error if a lang item has the wrong number of generic argumentsFabian Wolff-5/+83
2021-05-12Use () for lang items.Camille GILLOT-6/+3
2021-03-09Access attrs directly from HirId in rustc_passes::lang_items.Camille GILLOT-14/+6
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-1/+1
Items are guaranteed to be HIR owner.
2020-11-26Store ForeignItem in a side table.Camille GILLOT-0/+2
2020-08-30mv compiler to compiler/mark-0/+220