about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/weak_lang_items.rs
AgeCommit message (Collapse)AuthorLines
2025-05-04Initial support for dynamically linked cratesBryanskiy-1/+2
2025-01-06Add support for wasm exception handling to Emscripten targetHood Chatham-1/+4
Gated behind an unstable `-Z emscripten-wasm-eh` flag
2024-08-29Add `warn(unreachable_pub)` to `rustc_passes`.Nicholas Nethercote-1/+5
2024-06-06Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"Rémy Rakic-1/+1
This reverts commit eda4a35f365535af72118118a3597edf5a13c12d, reversing changes made to eb6b35b5bcb3c2a594cb29cd478aeb2893f49d30.
2024-05-22rustc: Use `tcx.used_crates(())` moreVadim Petrochenkov-1/+1
And explain when it should be used.
2024-04-17consistency rename: language item -> lang itemRalf Jung-1/+1
2024-01-10Stop mentioning internal lang items in no_std binary errorsNilstrieb-1/+5
When writing a no_std binary, you'll be greeted with nonsensical errors mentioning lang items like eh_personality and start. That's pretty bad because it makes you think that you need to define them somewhere! But oh no, now you're getting the `internal_features` lint telling you that you shouldn't use them! But you need a no_std binary! What now? No problem! Writing a no_std binary is super easy. Just use panic=abort and supply your own platform specific entrypoint symbol (like `main`) and you're good to go. Would be nice if the compiler told you that, right? This makes it so that it does do that.
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-3/+3
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-15Collect lang items from ASTMichael Goulet-11/+19
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-08-09rustc: Move `crate_types` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes a piece of mutable state. Follow up to #114578.
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-9/+1
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-29Cleanup weak lang itemsCameron Steffen-6/+6
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-1/+1
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-07use cherry-picked commit from #100754 to emit note without errorNathan Stocks-2/+4
2022-10-07migrate the rest of weak_lang_items.rs to translateable diagnosticsNathan Stocks-10/+4
2022-10-07Migrate weak_lang_items.rsrdvdev2-10/+5
2022-07-20Use FxIndexMap instead of otherwise unused StableMap for WEAK_ITEMS_REFS.Michael Woerister-1/+1
2022-06-18rustc_target: Remove some redundant target propertiesVadim Petrochenkov-1/+1
2022-04-09restrict access to span only when we emit diagnosticMiguel Guarniz-1/+1
2022-04-08add mapping from DefKind to Target and remove more ItemLikeVisitor implsMiguel Guarniz-35/+21
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-7/+1
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-14Suggest to specify a target triple when eh_personality lang item is missingLucas Kent-2/+8
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-2/+2
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-1/+1
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-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-1/+1
2021-03-09Remove hir::ForeignItem::attrs.Camille GILLOT-1/+2
2021-01-25This should address issue 81294.Felix S. Klock II-1/+1
(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-1/+1
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-1/+1
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-02Implement Make `handle_alloc_error` default to panic (for no_std + liballoc)Harald Hoyer-1/+4
Related: https://github.com/rust-lang/rust/issues/66741 Guarded with `#![feature(default_alloc_error_handler)]` a default `alloc_error_handler` is called, if a custom allocator is used and no other custom `#[alloc_error_handler]` is defined. The panic message does not contain the size anymore, because it would pull in the fmt machinery, which would blow up the code size significantly.
2020-08-30mv compiler to compiler/mark-0/+102