summary refs log tree commit diff
path: root/compiler/rustc_transmute/src/maybe_transmutable
AgeCommit message (Collapse)AuthorLines
2023-04-13Improve safe transmute error reportingBryan Garza-16/+17
This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-3/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2022-12-19clippy::complexity fixesMatthias Krüger-5/+1
filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool
2022-09-04Auto merge of #100726 - jswrenn:transmute, r=oli-obkbors-3/+3
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-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-3/+3
by module
2022-08-22safe transmute: use `Assume` struct to provide analysis optionsJack Wrenn-3/+3
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-07-27safe transmute: lowercase tracing levelsJack Wrenn-5/+5
ref: https://github.com/rust-lang/rust/pull/92268#discussion_r927095154
2022-07-27safe transmute: tweak tracingJack Wrenn-8/+8
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-27Initial (incomplete) implementation of transmutability trait.Jack Wrenn-0/+528
This initial implementation handles transmutations between types with specified layouts, except when references are involved. Co-authored-by: Igor null <m1el.2027@gmail.com>