Commit Graph

292 Commits

Author SHA1 Message Date
Celina G. Val
d3fa6a0e35 Add place.ty() and Ty build from a kind to smir 2023-11-20 12:43:39 -08:00
ouz-a
92657f163a use new apis and add new function 2023-11-17 23:28:17 +03:00
Oğuz Ağcayazı
71c990470a move pretty into stable_mir 2023-11-17 13:28:43 +03:00
Oğuz Ağcayazı
3883645a9b change smir to StableMir 2023-11-17 13:28:07 +03:00
Oğuz Ağcayazı
c821603484 remove unwrap 2023-11-17 13:28:07 +03:00
Oğuz Ağcayazı
ebd9c145f6 better formatting for statements 2023-11-17 13:28:07 +03:00
Oğuz Ağcayazı
0f0e9baf19 cover statements 2023-11-17 13:28:07 +03:00
Oğuz Ağcayazı
ae179a04b6 emit basic smir 2023-11-17 13:28:07 +03:00
Celina G. Val
8e81fc0087 Fix has_body() and change resolve_drop_in_place() sig
Fixed the `has_body()` function operator. Before that, this function was
returning false for all shims.

Change resolve_drop_in_place() to also return an instance for empty
shims, since they may still be required for vtable construction.
2023-11-16 12:04:25 -08:00
Celina G. Val
4c00aa3d74 Always run builder to evaluate constants
We were previously skipping it for non-generic functions, but this was
leaving some constants unevaluated.
2023-11-16 12:01:18 -08:00
Celina G. Val
08036a8005 Address PR comments 2023-11-16 12:01:18 -08:00
Celina G. Val
6515ac9d3f Add more APIs and fix Instance::body
Add more APIs to retrieve information about types, and add more instance
resolution options.

Make `Instance::body()` return an Option<Body>, since not every instance
might have an available body. For example, foreign instances, virtual
instances, dependencies.
2023-11-16 12:01:10 -08:00
Celina G. Val
e70839ac84 Add more SMIR internal impl and callback return value
In cases like Kani, we will invoke the rustc_internal run command
directly for now. It would be handly to be able to have a callback
that can return a value.

We also need extra methods to convert stable constructs into internal
ones, so we can break down the transition into finer grain commits.
2023-11-16 11:05:36 -08:00
Mark Rousskov
db3e2bacb6 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
bors
1500db7314 Auto merge of #117908 - lcnr:region-kind-rename, r=BoxyUwU
finish `RegionKind` renaming

second step of https://github.com/rust-lang/types-team/issues/95

continues the work from #117876. While working on this and I encountered a bunch of further cleanup which I'll either open a tracking issue for or will do in a separate PR:
- rewrite the `RegionKind` docs, they still talk about `ReEmpty` and are generally out of date
- rename `DescriptionCtx` to `DescriptionCtxt`
- what is `CheckRegions::Bound`?
- `collect_late_bound_regions` et al
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased`?
- `EraseEarlyRegions` visitor should be removed, feels duplicate

r? `@BoxyUwU`
2023-11-15 12:55:42 +00:00
bors
698fcc8219 Auto merge of #117517 - klinvill:smir-projections, r=ouz-a
Add richer structure for Stable MIR Projections

Resolves https://github.com/rust-lang/project-stable-mir/issues/49.

Projections in Stable MIR are currently just strings. This PR replaces that representation with a richer structure, namely projections become vectors of `ProjectionElem`s, just as in MIR. The `ProjectionElem` enum is heavily based off of the MIR `ProjectionElem`.

This PR is a draft since there are several outstanding issues to resolve, including:

- How should `UserTypeProjection`s be represented in Stable MIR? In MIR, the projections are just a vector of `ProjectionElem<(),()>`, meaning `ProjectionElem`s that don't have Local or Type arguments (for `Index`, `Field`, etc. objects). Should `UserTypeProjection`s be represented this way in Stable MIR as well? Or is there a more user-friendly representation that wouldn't drag along all the `ProjectionElem` variants that presumably can't appear?
- What is the expected behavior of a `Place`'s `ty` function? Should it resolve down the chain of projections so that something like `*_1.f` would return the type referenced by field `f`?
- Tests should be added for `UserTypeProjection`
2023-11-15 06:05:54 +00:00
Kirby Linvill
c036a10ed5
Make UserTypeProjection projections Opaque
Also shifts comments explaining why Stable MIR drops an optional variant
name field, for `Downcast` projection elements, to the `Place::stable`
function.
2023-11-14 19:19:35 -07:00
lcnr
15f21562e6 finish RegionKind rename
- `ReFree` -> `ReLateParam`
- `ReEarlyBound` -> `ReEarlyParam`
2023-11-14 13:13:27 +00:00
bors
d97bb195bf Auto merge of #117787 - ouz-a:smir_coroutinewitness, r=celinval
Add CoroutineWitness to covered types in smir

Previously we accepted `CouroutineWitness` as `unreachable!` but https://github.com/rust-lang/project-stable-mir/issues/50 shows it is indeed reachable, this pr fixes that and covers `CouroutineWitness`
2023-11-14 13:10:25 +00:00
lcnr
86fa1317a3 rename ReLateBound to ReBound
other changes:
- `Region::new_late_bound` -> `Region::new_bound`
- `Region::is_late_bound` -> `Region::is_bound`
2023-11-13 14:13:54 +00:00
Oğuz Ağcayazı
6812f64c35 add CoroutineWitness to covered types 2023-11-10 17:02:08 +03:00
Kirby Linvill
2e70d95cdb
Remove rich UserTypeProjection projections in SMIR
It's not clear to me (klinvill) that UserTypeProjections are produced
anymore with the removal of type ascriptions as per
https://github.com/rust-lang/rfcs/pull/3307. Furthermore, it's not clear
to me which variants of ProjectionElem could appear in such projections.
For these reasons, I'm reverting projections in UserTypeProjections to
simple strings until I can get more clarity on UserTypeProjections.
2023-11-09 20:56:40 -07:00
Kirby Linvill
b1585983cc
Add stable MIR Projections support based on MIR structure
This commit includes richer projections for both Places and
UserTypeProjections. However, the tests only touch on Places. There are
also outstanding TODOs regarding how projections should be resolved to
produce Place types, and regarding if UserTypeProjections should just
contain ProjectionElem<(),()> objects as in MIR.
2023-11-09 20:56:35 -07:00
Matthias Krüger
7fd7719ca1
Rollup merge of #117741 - eltociear:patch-23, r=compiler-errors
Fix typo in internal.rs

covert -> convert
2023-11-10 01:50:25 +01:00
Ikko Eltociear Ashimine
b8648216a5
Fix typo in internal.rs
covert -> convert
2023-11-09 16:10:37 +09:00
lcnr
992d93f687 rename BorrowKind::Shallow to Fake
also adds some comments
2023-11-08 22:55:28 +01:00
bors
146dafa262 Auto merge of #114208 - GKFX:offset_of_enum, r=wesleywiser
Support enum variants in offset_of!

This MR implements support for navigating through enum variants in `offset_of!`, placing the enum variant name in the second argument to `offset_of!`. The RFC placed it in the first argument, but I think it interacts better with nested field access in the second, as you can then write things like

```rust
offset_of!(Type, field.Variant.field)
```

Alternatively, a syntactic distinction could be made between variants and fields (e.g. `field::Variant.field`) but I'm not convinced this would be helpful.

[RFC 3308 # Enum Support](https://rust-lang.github.io/rfcs/3308-offset_of.html#enum-support-offset_ofsomeenumstructvariant-field_on_variant)
Tracking Issue #106655.
2023-11-01 14:17:56 +00:00
George Bateman
d995bd61e7
Enums in offset_of: update based on est31, scottmcm & llogiq review 2023-10-31 23:26:02 +00:00
George Bateman
e936416a8d
Support enum variants in offset_of! 2023-10-31 23:25:54 +00:00
Matthias Krüger
290daf9318
Rollup merge of #117417 - celinval:smir-visitor, r=oli-obk
Add a stable MIR visitor

This change also adds a few utility functions as well and extend most `mir` and `ty` ADTs to implement `PartialEq` and `Eq`.

Fixes https://github.com/rust-lang/project-stable-mir/issues/32

r? `@oli-obk`
2023-10-31 19:03:21 +01:00
Celina G. Val
af7472ecbc Add a stable MIR visitor
Add a few utility functions as well and extend most `mir` and `ty`
ADTs to implement `PartialEq` and `Eq`.
2023-10-30 13:11:14 -07:00
Nicholas Nethercote
8ff624a9f2 Clean up rustc_*/Cargo.toml.
- Sort dependencies and features sections.
- Add `tidy` markers to the sorted sections so they stay sorted.
- Remove empty `[lib`] sections.
- Remove "See more keys..." comments.

Excluded files:
- rustc_codegen_{cranelift,gcc}, because they're external.
- rustc_lexer, because it has external use.
- stable_mir, because it has external use.
2023-10-30 08:46:02 +11:00
bors
2cad938a81 Auto merge of #116447 - oli-obk:gen_fn, r=compiler-errors
Implement `gen` blocks in the 2024 edition

Coroutines tracking issue https://github.com/rust-lang/rust/issues/43122
`gen` block tracking issue https://github.com/rust-lang/rust/issues/117078

This PR implements `gen` blocks that implement `Iterator`. Most of the logic with `async` blocks is shared, and thus I renamed various types that were referring to `async` specifically.

An example usage of `gen` blocks is

```rust
fn foo() -> impl Iterator<Item = i32> {
    gen {
        yield 42;
        for i in 5..18 {
            if i.is_even() { continue }
            yield i * 2;
        }
    }
}
```

The limitations (to be resolved) of the implementation are listed in the tracking issue
2023-10-29 00:03:52 +00:00
Matthias Krüger
33744804fe
Rollup merge of #117262 - celinval:issue-38-norm, r=oli-obk
Create a new ConstantKind variant (ZeroSized) for StableMIR

ZeroSized constants can be represented as `mir::Const::Val` even if their layout is not yet known. In those cases, CrateItem::body() was crashing when trying to convert a `ConstValue::ZeroSized` into its stable counterpart  `ConstantKind::Allocated`.

Instead, we now map `ConstValue::ZeroSized` into a new variant: `ConstantKind::ZeroSized`.

**Note:** I didn't add any new test here since we already have covering tests in our project repository which I manually confirmed that will fix the issue.
2023-10-27 11:48:07 +02:00
Celina G. Val
613e6181a6 Specialize ZeroSized constants
ZeroSized constants can be represented as `mir::Const::Val` even if
their layout is not yet known. In those cases, CrateItem::body() was
crashing when trying to convert a `ConstValue::ZeroSized` into its
stable counterpart `ConstantKind::Allocated`.

Instead, we now map `ConstValue::ZeroSized` into a new variant:
`ConstantKind::ZeroSized`.
2023-10-26 20:17:44 -07:00
Matthias Krüger
b66c6e719f
Rollup merge of #117095 - klinvill:smir-fn-arg-count, r=oli-obk
Add way to differentiate argument locals from other locals in Stable MIR

This PR resolves rust-lang/project-stable-mir#47 which request a way to differentiate argument locals in a SMIR `Body` from other locals.

Specifically, this PR exposes the `arg_count` field from the MIR `Body`. However, I'm opening this as a draft PR because I think there are a few outstanding questions on how this information should be exposed and described. Namely:

- Is exposing `arg_count` the best way to surface this information to SMIR users? Would it be better to leave `arg_count` as a private field and add public methods (e.g. `fn arguments(&self) -> Iter<'_, LocalDecls>`) that may use the underlying `arg_count` info from the MIR body, but expose this information to users in a more convenient form? Or is it best to stick close to the current MIR convention?
- If the answer to the above point is to stick with the current MIR convention (`arg_count`), is it reasonable to also commit to sticking to the current MIR convention that the first local is always the return local, while the next `arg_count` locals are always the (in-order) argument locals?
- Should `Body` in SMIR only represent function bodies (as implied by the comment I added)? That seems to be the current case in MIR, but should this restriction always be the case for SMIR?

r? `@celinval`
r? `@oli-obk`
2023-10-26 17:45:43 +02:00
Oli Scherer
14423080f1 Add hir::GeneratorKind::Gen 2023-10-26 07:10:25 +00:00
Matthias Krüger
4e4e5619af
Rollup merge of #117175 - oli-obk:gen_fn_split, r=compiler-errors
Rename AsyncCoroutineKind to CoroutineSource

pulled out of https://github.com/rust-lang/rust/pull/116447

Also refactors the printing infra of `CoroutineSource` to be ready for easily extending it with a `Gen` variant for `gen` blocks
2023-10-25 23:37:11 +02:00
Kirby Linvill
93d1b3e92a
Replace arg_count in public API with return/arg getters
This commit hides the arg_count field in Body and instead exposes more
stable and user-friendly methods to get the return and argument locals.
As a result, Body instances must now be constructed using the `new`
function.
2023-10-25 22:15:47 +01:00
Kirby Linvill
e4c41b07f0
Add arg_count field to Body in Stable MIR
This field allows SMIR consumers to identify which locals correspond to
argument locals. It simply exposes the arg_count field from the MIR
representation.
2023-10-25 22:15:47 +01:00
Oli Scherer
af8a998b1e Rename AsyncCoroutineKind to CoroutineSource
similar to how we have `MatchSource`, it explains where the desugaring came from.
2023-10-25 16:14:05 +00:00
bors
b66fe58f68 Auto merge of #117113 - celinval:smir-stable-ty, r=oli-obk
Remove fold code and add `Const::internal()` to StableMIR

We are not planning to support user generated constant in the foreseeable future, so we are cleaning up the fold logic and user created type for now. Users should use `Instance::resolve` in order to trigger monomorphization.

The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that.

I decided to keep the `Const` fields private in case we decide to translate them lazily.
2023-10-25 13:19:54 +00:00
bors
98108dc26c Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726
Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`

Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`.

Blocked on #116951

r? `@ghost`
2023-10-25 05:02:04 +00:00
Celina G. Val
17f6df9c63 Use IndexMap for handling stable Ty 2023-10-24 15:37:43 -07:00
Celina G. Val
3f60165d27 Remove fold code and add Const::internal()
We are not planning to support user generated constant in the
foreseeable future, so we are removing the Fold logic for now in
favor of the Instance::resolve logic.

The Instance::resolve was however incomplete, since we weren't handling
internalizing constants yet. Thus, I added that.

I decided to keep the Const fields private in case we decide to
translate them lazily.
2023-10-24 14:50:58 -07:00
Celina G. Val
ae86f59cc9 Add test and remove double ref 2023-10-23 21:36:43 -07:00
Celina G. Val
421631a3a1 Remove unsafe and Rc 2023-10-23 14:22:04 -07:00
Celina G. Val
f613b26cfb Add internal() method counterpart to stable()
Note: We do not expect to provide internalizing methods for all
StableMIR constructs. They exist only to help migrating efforts to allow
users to mix StableMIR and internal constructs.
2023-10-23 12:11:07 -07:00
Celina G. Val
66a554b045 Add method to convert internal to stable constructs 2023-10-23 12:01:39 -07:00
Oli Scherer
4a5fecb187 Avoid having rustc_smir depend on rustc_interface or rustc_driver 2023-10-23 09:48:15 +00:00
Matthias Krüger
b7035198e6
Rollup merge of #116964 - celinval:smir-mono-body, r=oli-obk
Add stable Instance::body() and RustcInternal trait

The `Instance::body()` returns a monomorphized body.

For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal.

Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed.

The tests here are very simple, and I'm planning on creating more exhaustive tests in the project-mir repo. But I was hoping to get some feedback here first.

r? ```@oli-obk```
2023-10-21 10:08:17 +02:00
Michael Goulet
573f475853 Uplift ClauseKind and PredicateKind 2023-10-20 17:14:49 -07:00
Oli Scherer
2d91c76d5d Rename CoroutineKind::Gen to ::Coroutine 2023-10-20 21:14:01 +00:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Celina G. Val
6ed2a76bcc Add stable Instance::body() and RustcInternal trait
The `Instance::body()` returns a monomorphized body.

For that, we had to implement visitor that monomorphize types and
constants. We are also introducing the RustcInternal trait that will
allow us to convert back from Stable to Internal.

Note that this trait is not yet visible for our users as it depends on
Tables. We should probably add a new trait that can be exposed.
2023-10-19 17:12:26 -07:00
Celina G. Val
364f1a3f16 Add MonoItems and Instance to stable_mir
Also add a few methods to instantiate instances and get an instance
definition.

We're still missing support to actually monomorphize the instance body.
2023-10-16 12:01:24 -07:00
Oğuz Ağcayazı
d6a55d3409 change fn name, return loc info, local name 2023-10-13 11:44:38 +03:00
Oğuz Ağcayazı
1d9481fdc8 implement get_filename/lines for span 2023-10-11 17:55:57 +03:00
bors
6d05c430d2 Auto merge of #115948 - notriddle:notriddle/logo-lockup, r=fmease
rustdoc: show crate name beside smaller logo

*Blocked on https://github.com/rust-lang/cargo/pull/12800*

## Summary

In this PR, the crate name and version are always shown in the sidebar, even in subpages, and the lateral navigation is always shown in the sidebar, even in modules.

Clicking the crate name does the same thing clicking the logo always did: take you to the crate root (the crate's home page, at least within Rustdoc).

The Rust logo is also no longer shown by default for non-Rust docs.

### Screenshots

<details><summary>Before</summary>

| | Macro | Module |
|--|-------|--------|
| In crate | ![image](https://github.com/rust-lang/rust/assets/1593513/d5db0a46-2bb6-44a2-a3aa-2d915ecb8595) |![image](https://github.com/rust-lang/rust/assets/1593513/61f8c1ee-c298-4e2c-b791-18ecb79ab83b)
| In module[^1] | ![image](https://github.com/rust-lang/rust/assets/1593513/73abca59-0b69-4650-a1e2-7278ca34795c) | ![image](https://github.com/rust-lang/rust/assets/1593513/0baf02c2-2ec7-4674-80e5-a6a74a973376)

[^1]: This PR also includes a bug fix for derive macros not showing up in the lateral navigation part of the sidebar

</details>

#### Whole sidebar screenshots

| | Macro | Module |
|--|-------|--------|
| In crate | ![image](https://github.com/rust-lang/rust/assets/1593513/75d1bd07-41f7-4f11-ba24-fd5476e0586a) | ![image](https://github.com/rust-lang/rust/assets/1593513/52960259-2b65-4131-b380-01826f0a0eb7)
| In module | ![image](https://github.com/rust-lang/rust/assets/1593513/06e57928-8cb0-41bd-b152-be16cc53e5ec) | ![image](https://github.com/rust-lang/rust/assets/1593513/37291c69-2a07-4467-a382-d9b029084a47)

#### Different logo configurations

|         | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root    | ![short-root]    | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]

[short-root]: https://github.com/rust-lang/rust/assets/1593513/9e2b4fa8-f581-4106-b562-1e0372c13f79
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/8331cdb8-fa13-4671-a1e2-dcc1cdca7451
[long-root]: https://github.com/rust-lang/rust/assets/1593513/7d377fec-0f1d-4343-9f82-0e35a8f58056
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/3b3094a4-63c9-477c-8c15-b6075837df30

##### Without a logo

![image](https://github.com/rust-lang/rust/assets/1593513/66672b79-6c59-4be8-a527-25ef6f0b04ab)

### Preview pages

https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/rocket/index.html

https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/rocket_sync_db_pools/index.html

https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rust-compiler/index.html

https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rust/std/index.html

https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/tokio/index.html

## Motivation

This improves visual information density (the construct with the logo and crate name is *shorter* than the logo on its own, because it's not square) and navigation clarity (we can now see what clicking the Rust logo does, specifically).

Compare this with the layout at [Phoenix's Hexdocs] (which is what this proposal is closely based on), the old proposal on [Internals Discourse] (which always says "Rust standard library" in the sidebar, but doesn't do the side-by-side layout).

[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018

## Guide-level explanation

This PR cleans up some of the sidebar navigation.

It makes the logo in the desktop sidebar a bit smaller, and puts the crate name and version next to it (either beside it, or below it, depending on if there's space), making it clearer what clicking on it does: click the crate name to open the crate's home page. It also removes the Rust logo from non-official-Rust crates, again to make the navigation and supply chain clearer (since the crate name has been added, the logo is no longer necessary for navigation).

It adds a bit more clarifying information for lateral navigation. On items that don't add their own sidebar items, it just shows its siblings directly below the crate name and logo, but for other items, it shows "In crate alloc" instead of just "In alloc". It also shows the lateral navigation tools on module pages, making modules consistent with every other item.

## Drawbacks

While this actually takes up less screen real estate than the old layout on desktop, it takes up more HTML. It's also a bit more visually complex.

## Rationale and alternatives

I could do what the Internals POC did and keep the vertically stacked layout all the time, instead of doing a horizontal stack where possible. It would take up more screen real estate, though.

## Prior art

This design is lifted almost verbatim from Hexdocs. It seems to work for them. [`opentelemetry_process_propagator`], for example, has a long application name.

[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html

## Unresolved questions

Maybe we should encourage crate authors to include their own logo more often? It certainly helps give people a better sense of "place." This seems to be blocked on coming up with an API to do it without requiring them to host the file somewhere.

## Future possibilities

Beyond this, plenty of other changes could be made to improve the layout, like

* Fix things so that clicking an item in the sidebar doesn't cause it to scroll back to the top.
  * The [Internals demo](https://utherii.github.io/new.html) does this right: clicking an item in the sidebar changes the content area, but the sidebar itself does not change. This is nice, because clicking is cheap and I can skim the opening few paragraphs while browsing.
  * The layout of the docs sidebar causes trouble to implement this, because it's different on different pages, but at least fix this on the file browser.
* Come up with a less cluttered way to do disclosure. There's a lot of `[-]` on the page.
  * We don't lack ideas to fix this one. We have *too many*.
* Do a better job of separating local navigation (vec::Vec links to vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new).
  * A possibility: add a Back arrow next to the "In [module]" header?
    ![image](https://github.com/rust-lang/rust/assets/1593513/e969faf7-7722-457a-b8c6-8d962e9e1e23)
* Give readers more control of how much rustdoc shows them, and giving doc authors more control of how much it generates. Basically, https://github.com/rust-lang/rust/pull/115660 is great, let's do it too.

But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-10-11 06:28:36 +00:00
Guillaume Gomez
100713ef08
Rollup merge of #116560 - ouz-a:efficient_ids, r=oli-obk
In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses https://github.com/rust-lang/project-stable-mir/issues/35

r? ``@oli-obk``
2023-10-10 18:44:46 +02:00
Oğuz Ağcayazı
0bcb058fb1 add new wrapper for FxIndexMap 2023-10-10 13:18:31 +03:00
Oğuz Ağcayazı
77df2cd9a5 spans are now indexmapped 2023-10-09 13:03:58 +03:00
Oğuz Ağcayazı
5f079dd2ff alloc id is indexmapped 2023-10-09 12:58:41 +03:00
Oğuz Ağcayazı
0f27c1b5b5 defids are indexmapped 2023-10-09 12:56:14 +03:00
Oğuz Ağcayazı
4ff6e87a8c return crates instead of a crate 2023-10-09 10:33:23 +03:00
Michael Howell
c6e6ecb1af rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
Nicholas Nethercote
e7dabc9f87 Remove unnecessary pub. 2023-10-06 14:59:11 +11:00
Nicholas Nethercote
093b435b78 Remove unneeded features. 2023-10-06 14:58:01 +11:00
Nicholas Nethercote
4b51a3eb52 Remove unneeded dependency.
Also sort them.
2023-10-06 14:57:25 +11:00
Oğuz Ağcayazı
a49138e46e impl stable for kinds 2023-10-05 11:15:34 +03:00
ouz-a
a79567b01c add span to statements 2023-10-05 11:15:34 +03:00
ouz-a
999a354a81 add span to terminator 2023-09-30 16:52:10 +03:00
ouz-a
9130484db9 create localdecl and add span to it 2023-09-30 16:40:15 +03:00
ouz-a
34f10e2ab9 remove unimplemented 2023-09-28 19:52:41 +03:00
ouz-a
bb17fe8bf5 add real folder to Region 2023-09-28 12:32:15 +03:00
ouz-a
da2f897e59 remove un-needed variants 2023-09-28 11:43:21 +03:00
ouz-a
2069e8c218 fix imports 2023-09-28 11:36:53 +03:00
ouz-a
5dc2214884 add stable for RegionKind 2023-09-28 11:19:51 +03:00
ouz-a
e49aa04000 add RegionDef 2023-09-28 11:19:51 +03:00
Oli Scherer
411e431c70 Rebase fallout 2023-09-25 15:02:10 +00:00
Oli Scherer
a38e98371b Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things 2023-09-25 14:38:27 +00:00
Oli Scherer
19f1d782d5 Move Opaque to stable_mir 2023-09-25 14:38:27 +00:00
Oli Scherer
33998a9751 Fix test by adding a stable way to get an opaque DefKind 2023-09-25 14:38:27 +00:00
Oli Scherer
55b6f64902 Eliminate escape hatch 2023-09-25 14:38:26 +00:00
Oli Scherer
e02a139a23 Eliminate with_tables helper 2023-09-25 14:38:26 +00:00
Camille GILLOT
26cb34cd18 Remove span from BrAnon. 2023-09-24 09:46:55 +00:00
Camille GILLOT
44ac8dcc71 Remove GeneratorWitness and rename GeneratorWitnessMIR. 2023-09-23 13:47:30 +00:00
Guillaume Gomez
208f6ed95c
Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const

Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`.

Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all.

However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish...

``@oli-obk`` any ideas?
2023-09-21 13:25:39 +02:00
Ralf Jung
c94410c145 rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
Ralf Jung
ea22adbabd adjust constValue::Slice to work for arbitrary slice types 2023-09-19 20:17:43 +02:00
Ralf Jung
5a0a1ff0cd move ConstValue into mir
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19 11:11:02 +02:00
Matthias Krüger
4f90a52ae6
Rollup merge of #115772 - ouz-a:smir_span2, r=oli-obk
Improve Span in smir

Addressing https://github.com/rust-lang/project-stable-mir/issues/31

r? ``@oli-obk``
2023-09-14 19:12:31 +02:00
Ralf Jung
430c386821 make it more clear which functions create fresh AllocId 2023-09-14 07:27:31 +02:00
Ralf Jung
0f8908da27 cleanup op_to_const a bit; rename ConstValue::ByRef → Indirect 2023-09-14 07:27:30 +02:00
Ralf Jung
551f481ffb use AllocId instead of Allocation in ConstValue::ByRef 2023-09-14 07:26:24 +02:00
ouz-a
fa57a48cf5 span is index 2023-09-14 00:32:21 +03:00
bors
1fe747c160 Auto merge of #115793 - spastorino:smir-explicit-predicates-of, r=oli-obk
Add explicit_predicates_of to SMIR

Adding `explicit_predicates_of` so we can use it from Mir formality.

r? `@oli-obk`
2023-09-13 04:51:19 +00:00
Santiago Pastorino
3678dbc382
Add explicit_predicates_of to SMIR 2023-09-12 15:12:02 -03:00
Matthias Krüger
2a087be735
Rollup merge of #115749 - oli-obk:smir_consts, r=compiler-errors
Allow loading the SMIR for constants and statics

cc https://github.com/rust-lang/project-stable-mir/issues/34

before this PR we were ICEing when trying to access the SMIR of anything other than functions
2023-09-11 21:16:23 +02:00