Commit Graph

36 Commits

Author SHA1 Message Date
Oli Scherer
55b6f64902 Eliminate escape hatch 2023-09-25 14:38:26 +00: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
ouz-a
fa57a48cf5 span is index 2023-09-14 00:32:21 +03:00
Santiago Pastorino
3678dbc382 Add explicit_predicates_of to SMIR 2023-09-12 15:12:02 -03:00
ouz-a
d190ebf2fc add function that returns span of an item 2023-09-09 14:17:36 +03:00
Oli Scherer
202fbed1a6 Allow fetching the SMIR body of FnDefs 2023-09-06 08:16:04 +00:00
Oli Scherer
b43e3b9f41 Add type folder to SMIR 2023-09-06 08:15:42 +00:00
Celina G. Val
d10d8290ac Add tests and use ControlFlow 2023-09-05 09:19:56 -07:00
Celina G. Val
3b01f65aa5 Diferentiate between ICE and compilation error 2023-09-05 08:54:03 -07:00
Celina G. Val
2db01be584 Adjust StableMIR interface to return and not crash
Invoking StableMir::run() on a crate that has any compilation error was
crashing the entire process. Instead, return a `CompilerError` so the
user knows compilation did not succeed.

I believe ICE will also be converted to `CompilerError`.

I'm also adding a return value to the callback, because I think it will
be handy for users (at least it was for my current task of implementing
a tool to validate stable-mir). However, if people disagree,
I can remove that.
2023-09-05 08:54:03 -07:00
ouz-a
56d10a883e provide more useful info for DefId Debug 2023-09-04 19:13:43 +03:00
bors
7cc5ac267f Auto merge of #115470 - ericmarkmartin:stable-prov, r=oli-obk
add stable provenance

r? `@spastorino`

implements rust-lang/project-stable-mir#22
2023-09-03 07:38:55 +00:00
Eric Mark Martin
cb7d020fb6 add stable provenance 2023-09-02 01:53:06 -04:00
Oli Scherer
85a1679df9 Create a SMIR visitor 2023-09-01 16:32:22 +00:00
Matthias Krüger
a51e8308c8 Rollup merge of #115300 - spastorino:smir-tweaks, r=oli-obk
Tweaks and improvements on SMIR around generics_of and predicates_of

r? `@oli-obk`

This allows an API like the following ...

```rust
    let trait_decls = stable_mir::all_trait_decls().iter().map(|trait_def| {
        let trait_decl = stable_mir::trait_decl(trait_def);
        let generics = trait_decl.generics_of();
        let predicates = trait_decl.predicates_of().predicates;
```

I didn't like that much `trait_def.trait_decl()` which is it possible but adding a method to a def_id that loads up a whole trait definition looks backwards to me.
2023-08-29 20:49:05 +02:00
ouz-a
c2fe0bf253 Create StableMir replacer for SMirCalls 2023-08-29 16:30:50 +03:00
Santiago Pastorino
0c301e9d36 Deduplicate GenericPredicates 2023-08-29 08:34:28 -03:00
Santiago Pastorino
af6299a1f7 Add stable_mir::DefId as new type wrapper 2023-08-29 08:28:48 -03:00
Santiago Pastorino
e9710f1faa Context::generics _of/predicates_of should receive stable_mir::DefId 2023-08-28 14:55:42 -03:00
Santiago Pastorino
7a653feffb Remove stable_mir::generics_of/predicates_of those shouldn't be exposed 2023-08-28 14:55:08 -03:00
Santiago Pastorino
3dd1c6bc98 Add missing high-level stable_mir::generics_of fn 2023-08-25 09:42:57 -03:00
Eric Mark Martin
107cb5c904 predicates of 2023-08-23 11:47:13 -03:00
ouz-a
015b5cb306 add generics_of to smir 2023-08-22 21:47:46 +03:00
Ralf Jung
44cc3105b1 stable_mir: docs clarification 2023-08-21 13:55:17 +02:00
Santiago Pastorino
826471e93b Add trait related queries to SMIR's rustc_internal 2023-08-15 13:37:47 -03:00
Santiago Pastorino
5f0e662523 Add impl trait declarations to SMIR 2023-08-10 14:17:50 -03:00
Santiago Pastorino
8b29ad7215 Fix copy & paste doc error 2023-08-10 14:17:08 -03:00
Santiago Pastorino
0e69a8ad20 Add all_trait_decls to SMIR 2023-08-07 10:24:11 -03:00
Santiago Pastorino
496faa857c Convert trait declaration to SMIR 2023-08-07 10:24:08 -03:00
yukang
361df86a8d Use scoped-tls for SMIR to map between TyCtxt and SMIR datastructures 2023-07-02 07:48:41 +08:00
Oli Scherer
7f74ae57e8 Create a trait to abstract over the smir API 2023-05-08 14:23:04 +00:00
Oli Scherer
e404e77c0b Add a stable MIR way to get the main function 2023-04-14 07:28:56 +00:00
Oli Scherer
942cac1b8d Implement a minimal subset of MIR statements and terminators for smir 2023-03-16 16:06:12 +00:00
Oli Scherer
6fe982283d Remove DefId from CrateItem in favor of a lookup table 2023-03-16 14:53:57 +00:00
Celina G. Val
5eaeb71b9f Change item collection to be on demand 2023-03-07 12:47:25 -08:00
Celina G. Val
b66db7e4e0 Create new rustc_smir struct to map future crates
+ Add some information to the README.md
2023-03-06 21:57:46 -08:00