Commit Graph

19 Commits

Author SHA1 Message Date
Cameron Steffen
349415d1c6 Remove TypeckResults from InferCtxt 2022-10-07 07:06:19 -05:00
Takayuki Maeda
0e615caa8d check if const is ADT or not 2022-10-03 17:51:18 +09:00
Josh Stone
a72666ed56 rustc_transmute: fix big-endian discriminants 2022-09-20 13:03:43 -07:00
bors
8521a8c92d Auto merge of #100726 - jswrenn:transmute, r=oli-obk
safe transmute: use `Assume` struct to provide analysis options

This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411).

**Before:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<
    Src,
    Context,
    const ASSUME_ALIGNMENT: bool,
    const ASSUME_LIFETIMES: bool,
    const ASSUME_VALIDITY: bool,
    const ASSUME_VISIBILITY: bool,
> where
    Src: ?Sized,
{}
```
**After:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
where
    Src: ?Sized,
{}
```

`Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change).

r? `@oli-obk`

---

Related:
- https://github.com/rust-lang/compiler-team/issues/411
- https://github.com/rust-lang/rust/issues/99571
2022-09-04 07:55:44 +00:00
Oli Scherer
ee3c835018 Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
Jack Wrenn
fbcc038a22 safe transmute: use to_valtree to destructure const Assume
ref: https://github.com/rust-lang/rust/pull/100726#discussion_r954813220
2022-08-31 18:17:32 +00:00
Dezhi Wu
b1430fb7ca Fix a bunch of typo
This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos
2022-08-31 18:24:55 +08:00
Yuki Okushi
ba31a9b505
Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-se
Remove unstable Result::into_ok_or_err

Pending FCP: https://github.com/rust-lang/rust/issues/82223#issuecomment-1214920203

```@rustbot``` label +waiting-on-fcp
2022-08-26 09:51:44 +09:00
Jack Wrenn
1d844fe629 safe transmute: use FxIndex{Map,Set} instead of FxHash{Map,Set}
resolves query instability issues, and probably better for performance
2022-08-23 15:52:49 +00:00
Jack Wrenn
f46fffc276 safe transmute: use Assume struct to provide analysis options
This was left as a TODO in #92268, and brings the trait more in
line with what was defined in MCP411.

`Assume::visibility` has been renamed to `Assume::safety`, as
library safety is what's actually being assumed; visibility is
just the mechanism by which it is currently checked (this may
change).

ref: https://github.com/rust-lang/compiler-team/issues/411
ref: https://github.com/rust-lang/rust/issues/99571
2022-08-22 18:37:54 +00:00
Jhonny Bill Mena
c835d9c0d2 ADD - diagnostic lints to rustc_transmute
Module is complete because it has zero diagnostics.
2022-08-21 09:17:09 -04:00
David Tolnay
39809c5f68
Replace a try_fold in rustc_transmute to use ControlFlow instead of Result 2022-08-17 17:20:42 -07:00
David Tolnay
83f081fc01
Remove unstable Result::into_ok_or_err 2022-08-17 17:20:42 -07:00
Jack Wrenn
965ffb0b5c safe transmute: fix broken intradoc link 2022-08-02 14:44:23 +00:00
Jack Wrenn
e8a1925b64 safe transmute: use AtomicU32 State ids to appease mips
...instead of `AtomicU64`, which is unavailable.

ref: https://github.com/rust-lang/rust/pull/92268#issuecomment-1197797990
2022-07-28 13:47:11 +00:00
Jack Wrenn
aee5f31c68 safe transmute: lowercase tracing levels
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r927095154
2022-07-27 17:33:57 +00:00
Jack Wrenn
2268603046 safe transmute: tweak Nfa::union to consume params by value
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925274516
2022-07-27 17:33:57 +00:00
Jack Wrenn
c0d0ce95eb safe transmute: tweak tracing
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925246903
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925250811
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925255782
2022-07-27 17:33:56 +00:00
Jack Wrenn
bc4a1dea41 Initial (incomplete) implementation of transmutability trait.
This initial implementation handles transmutations between types with specified layouts, except when references are involved.

Co-authored-by: Igor null <m1el.2027@gmail.com>
2022-07-27 17:33:56 +00:00