Commit Graph

52 Commits

Author SHA1 Message Date
David Wood a56b1b9283 codegen: implement repr(scalable)
Introduces `BackendRepr::ScalableVector` corresponding to scalable
vector types annotated with `repr(scalable)` which lowers to a scalable
vector type in LLVM.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:12 +00:00
Matthias Krüger 4c8c967225 Rollup merge of #149401 - celinval:smir-109-name, r=scottmcm
Fix `name()` functions for local defs in rustc_public

This change fixes the behavior of the `name()` function for `CrateDef` and `Instance` which should return absolute path of items. For local items, the crate name was missing.

This resolves: https://github.com/rust-lang/project-stable-mir/issues/109
2025-12-06 09:57:59 +01:00
Boxy Uwu 76bd21ad66 account for safe target features in fndef<->closure and fndef<->fndef coerce-lubs 2025-12-03 14:55:41 +00:00
Celina G. Val bb2bfc3f3f Fix name and pretty print now uses trimmed_name 2025-12-01 01:34:14 +00:00
Stuart Cook 3a0187ec5d Rollup merge of #144000 - jacob-greenfield:stable-defid-parent, r=celinval
Add `DefId::parent()` accessor for `rustc_public`

Adds a `parent()` method to `DefId` (the `rustc_pub` version) which exposes the parent path, ie. `foo::bar::baz` -> `foo::bar`.

This is useful for organizing/grouping definitions into a tree, and is probably simpler and less brittle than attempting to parse the fully-qualified name into path components (e.g. especially when handling path components with qualified generic parameters).
2025-11-29 21:12:25 +11:00
Stuart Cook 2ddaf4219e Rollup merge of #148358 - makai410:rpub-test-fix, r=celinval
Fix some issues around `rustc_public`

cc rust-lang/rust#148266 .
follow-up of rust-lang/rust#148341 .

This fixes the issues that can be reproduced by `x test compiler/rustc_public`:

```
error: function `run` is never used
   --> compiler/rustc_public/src/compiler_interface.rs:838:15
    |
838 | pub(crate) fn run<'tcx, F, T>(interface: &CompilerInterface<'tcx>, f: F) -> Result<T, Error>
    |               ^^^
    |
    = note: `-D dead-code` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(dead_code)]`

error: unreachable `pub` item
  --> compiler/rustc_public/src/unstable/mod.rs:25:1
   |
25 | pub trait InternalCx<'tcx>: Copy + Clone {
   | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates
   = note: `-D unreachable-pub` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unreachable_pub)]`

error: unreachable `pub` item
  --> compiler/rustc_public/src/unstable/mod.rs:62:1
   |
62 | pub trait Stable<'tcx>: PointeeSized {
   | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

error: unreachable `pub` item
  --> compiler/rustc_public/src/unstable/mod.rs:81:1
   |
81 | pub trait RustcInternal {
   | ---^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

error: could not compile `rustc_public` (lib) due to 4 previous errors
```
2025-11-26 23:32:04 +11:00
Matthias Krüger 34b3c9dd4d Rollup merge of #148261 - aDotInTheVoid:no-sync-for-smir, r=celinval
rustc_public: Make Id types !Send / !Sync

These types are Id's to a table stored in TLS, so using them from another tread will either panic, or give wrong results.

Therefor, I've added a ~~`ReferencesTls`~~`ThreadLocalIndex`  marker type, which ensures types arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

~~It also changes how `DefId` and similar are `Serialize`d. It would be possible to preserve the old behavior if that's needed, but I couldn't see any tests for these.~~ EDIT: Not anymore: https://github.com/rust-lang/rust/pull/148261#discussion_r2476111612

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
2025-11-20 11:15:52 +01:00
Alona Enraght-Moony e7b84604cb rustc_public: Make Id types !Send / !Sync
These types are Id's to a table stored in TLS, so using them from
another tread will either panic, or give wrong results.

Therefor, I've added a `ThreadLocalIndex` marker type, which ensures types
arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
2025-11-19 19:46:18 +00:00
Camille Gillot 72444372ae Replace OffsetOf by an actual sum. 2025-11-18 00:10:03 +00:00
Makai 1f7a3427f2 rustc_public: fix some issues 2025-11-17 16:35:34 +08:00
Jacob Greenfield 99049b3aa8 Add DefId::parent() accessor in rustc_public 2025-11-14 17:12:50 -05:00
Stuart Cook d3475140ee Rollup merge of #128666 - pitaj:intrinsic-overflow_checks, r=BoxyUwU
Add `overflow_checks` intrinsic

This adds an intrinsic which allows code in a pre-built library to inherit the overflow checks option from a crate depending on it. This enables code in the standard library to explicitly change behavior based on whether `overflow_checks` are enabled, regardless of the setting used when standard library was compiled.

This is very similar to the `ub_checks` intrinsic, and refactors the two to use a common mechanism.

The primary use case for this is to allow the new `RangeFrom` iterator to yield the maximum element before overflowing, as requested [here](https://github.com/rust-lang/rust/issues/125687#issuecomment-2151118208). This PR includes a working `IterRangeFrom` implementation based on this new intrinsic that exhibits the desired behavior.

[Prior discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Ability.20to.20select.20code.20based.20on.20.60overflow_checks.60.3F)
2025-11-09 13:22:23 +11:00
Peter Jaszkowiak cc8b95cc54 add overflow_checks intrinsic 2025-11-08 10:57:35 -07:00
bjorn3 222480dcb9 Allow internal_features lint in doc tests
Rustdoc forwards -Zcrate-attr=feature(rustdoc_internals) to doc tests,
but deny(warnings) overrides the -Ainternal_features.
2025-11-05 11:25:29 +00:00
bjorn3 973c7527b4 Unify the configuration of the compiler docs
Previously it was rather inconsistent which crates got the rust logo and
which didn't and setting html_root_url was forgotten in many cases.
2025-11-05 11:25:27 +00:00
Celina G. Val e0b8dd38bc Simplify rustc_public context handling
We no longer need two thread-local variables to store the context.
We used to have two because the conversion logic used to live in a
separate crate from the rest of the business logic.

I'm also removing the Container struct and replacing the
CompilerInterface trait with a struct. This removes the unnecessary
indirection and code duplication. Using a trait would also block us
from adding any generic method to the compiler interface.
2025-10-29 23:31:50 +00:00
Peter Jaszkowiak 2e5d395f2b refactor ub_checks and contract_checks to share logic 2025-10-25 14:30:04 -06:00
Camille Gillot 5dfbf67f94 Replace NullOp::SizeOf and NullOp::AlignOf by lang items. 2025-10-23 00:38:28 +00:00
bors 4d94478977 Auto merge of #147826 - Muscraft:update-typos, r=Noratrieb
Update typos

I saw that `typos` was a few versions out of date and figured it would be a good idea to update it. Upgrading to `1.38.1` adds the [July](https://github.com/crate-ci/typos/issues/1331), [August](https://github.com/crate-ci/typos/issues/1345), and [September](https://github.com/crate-ci/typos/issues/1370) dictionary updates. As part of this change, I also sorted the configuration file.
2025-10-22 13:11:47 +00:00
Oli Scherer ad4bd083f3 Add not-null pointer patterns to pattern types 2025-10-21 11:22:51 +00:00
Scott Schafer 12f6b9697f chore: Update typos to 1.38.1 2025-10-20 12:20:15 -06:00
Camille Gillot b7c2b3dc80 Remove StatementKind::Deinit. 2025-10-10 12:57:24 +00:00
bors 4b9c62b4da Auto merge of #147138 - jackh726:split-canonical-bound, r=lcnr
Split Bound index into Canonical and Bound

See [#t-types/trait-system-refactor > perf &#96;async-closures/post-mono-higher-ranked-hang.rs&#96;](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/perf.20.60async-closures.2Fpost-mono-higher-ranked-hang.2Ers.60/with/541535613) for context

Things compile and tests pass, but not sure if this actually solves the perf issue (edit: it does). Opening up this to do a perf (and maybe crater) run.

r? lcnr
2025-10-02 08:09:33 +00:00
jackh726 d1bbd39c59 Split Bound into Canonical and Bound 2025-09-30 12:58:28 -04:00
beepster4096 aa5a21450a ProjectionElem::Subtype -> CastKind::Subtype 2025-09-26 01:25:26 -07:00
Stuart Cook 540fd20ba6 Rollup merge of #146664 - fmease:clean-up-dyn, r=jdonszelmann
Clean up `ty::Dynamic`

1. As a follow-up to PR rust-lang/rust#143036, remove `DynKind` entirely.
2. Inside HIR ty lowering, consolidate modules `dyn_compatibility` and `lint` into `dyn_trait`
   * `dyn_compatibility` wasn't about dyn compatibility itself, it's about lowering trait object types
   * `lint` contained dyn-Trait-specific diagnostics+lints only
2025-09-18 11:48:51 +10:00
León Orell Valerian Liehr 26f3337d4e Remove DynKind 2025-09-17 04:46:46 +02:00
Camille Gillot 53b91ea87f Remove Rvalue::Len. 2025-09-16 22:23:19 +00:00
Cameron Steffen 9615ec7d10 Split AssocContainer::{InherentImpl,TraitImpl} 2025-09-12 15:14:15 -05:00
Cameron Steffen 5590e55b03 Rename AssocItemContainer -> AssocContainer 2025-09-12 15:10:30 -05:00
Guillaume Gomez 07f7d86f36 Rollup merge of #146102 - fmease:rm-dead-eff-code-iii, r=fee1-dead
Remove dead code stemming from an old effects desugaring

CC https://github.com/rust-lang/rust/pull/132374, https://github.com/rust-lang/rust/pull/133443.

r? fee1-dead
2025-09-02 17:08:58 +02:00
Nicholas Nethercote 301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
León Orell Valerian Liehr 6fc0cf4288 Remove dead code stemming from an old effects desugaring 2025-09-01 21:39:01 +02:00
Nicholas Nethercote 42359b7026 Add scoped-tls to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
Nicholas Nethercote c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
Makai c44fe70d03 fix missing parenthesis in pretty discriminant 2025-08-09 01:35:50 +08:00
AlexanderPortland b9e6bd7fe2 derive hash for placeholder automatically 2025-08-07 09:13:02 -07:00
AlexanderPortland 56d5aab31d make rustc_public types derive Hash 2025-08-06 12:07:02 -07:00
Nicholas Nethercote 704f2ca172 Tidy up Cargo.toml files.
- Add some missing `tidy-alphabetical-*` markers.
- Remove some unnecessary blank lines.
2025-07-31 19:58:04 +10:00
Makai 642deb3c8f remove movability from RigidTy::Coroutine and AggregateKind::Coroutine 2025-07-24 18:26:08 +08:00
Camille GILLOT 0460c92d52 Remove useless lifetime parameter. 2025-07-23 23:54:37 +00:00
Camille GILLOT 9ff071219b Give an AllocId to ConstValue::Slice. 2025-07-23 23:54:37 +00:00
Makai 4d79328091 use RustcPublic instead of StableMir 2025-07-18 18:49:32 +00:00
Makai 483877a9b2 Update docs in rustc_public 2025-07-18 18:49:12 +00:00
Makai a1deaa7097 SmirError to Error 2025-07-18 18:49:12 +00:00
Makai ad0de062b5 use "helper" as a more descriptive name 2025-07-18 18:49:12 +00:00
Makai 7f22e88fab SmirContainer to Container 2025-07-18 18:49:12 +00:00
Makai 966fc57789 SmirCtxt to CompilerCtxt, SmirInterface to CompilerInterface
aaa
2025-07-18 18:49:12 +00:00
Matthias Krüger 35b1f759e7 Rollup merge of #143997 - Coder-256:stable-mir-macro-hygiene, r=oli-obk
Use $crate in macros for rustc_public (aka stable_mir)

This makes `#[macro_use] extern crate rustc_public` unnecessary (which brings all of `rustc_public`'s macros into scope for the entire crate); instead, now you can simply use `rustc_public::run!()`.
2025-07-18 14:49:20 +02:00
Jacob Greenfield c6e1b21777 Use hygenic macros for stable-mir 2025-07-15 20:47:09 -04:00