| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
suggest `once_cell::Lazy` for non-const statics
Addresses https://github.com/rust-lang/rust/issues/100410
Some questions:
- removing the `if` seems to include too many cases (e.g. calls to non-const functions inside a `const fn`), but this code excludes the following case:
```rust
const FOO: Foo = non_const_fn();
```
Should we suggest `once_cell` in this case as well?
- The original issue mentions suggesting `AtomicI32` instead of `Mutex<i32>`, should this PR address that as well?
|
|
make NOP dyn casts not require anything about the vtable
As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
|
|
interpret: only consider 1-ZST when searching for receiver
`repr(transparent)` currently entirely rejects ZST with alignment larger than 1 (which is odd, arguably [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=02870f29396fa948c3123cb53d869ad1) should be accepted), so this should be safe. And if it ever isn't safe then that is very likely a bug elsewhere in the compiler.
|
|
Rename Machine memory hooks to suggest when they run
Some of the other memory hooks start with `before_` or `after_` to indicate that they run before or after a certain operation. These don't, so I was a bit confused as to when they are supposed to run.
`memory_read` can be read two ways in English, "memory was read" or "this is a memory read" so without the prefix this was especially ambiguous.
|
|
|
|
|
|
Erase regions better in `promote_candidate`
Use `tcx.erase_regions` instead of manually walking through the substs.... this also makes the code slightly simpler :see_no_evil:
Fixes #100360
Fixes #89851
|
|
|
|
add -Zextra-const-ub-checks to enable more UB checking in const-eval
Cc https://github.com/rust-lang/rust/issues/99923
r? `@oli-obk`
|
|
|
|
Improve size assertions
r? `@lqd`
|
|
Some of these don't need a `use` statement because there is already a
`#[macro_use] extern crate rustc_data_structures` item in the crate.
|
|
|
|
add method to get the mutability of an AllocId
Miri needs this for https://github.com/rust-lang/miri/issues/2463.
|
|
|
|
|
|
Some `FulfillmentContext`-related cleanups
Use `ObligationCtxt` in some places, remove some `FulfillmentContext`s in others...
r? types
|
|
|
|
More EarlyBinder cleanups
Each commit is independent
r? types
|
|
It spawns up a trait engine, registers the single obligation, then fully
solves it
|
|
Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`
Not sure if this change is worthwhile, but couldn't hurt re: chalkification
r? types
|
|
fix is_disaligned logic for nested packed structs
https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests.
Fixes https://github.com/rust-lang/rust/issues/99838
|
|
|
|
|
|
|
|
|
|
Improve size assertions.
- For any file with four or more size assertions, move them into a
separate module (as is already done for `hir.rs`).
- Add some more for AST nodes and THIR nodes.
- Put the `hir.rs` ones in alphabetical order.
r? `@lqd`
|
|
- For any file with four or more size assertions, move them into a
separate module (as is already done for `hir.rs`).
- Add some more for AST nodes and THIR nodes.
- Put the `hir.rs` ones in alphabetical order.
|
|
|
|
|
|
r=oli-obk
Deeply deny fn and raw ptrs in const generics
I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter.
We now reject both of these in the same way:
```
#![feature(adt_const_params)]
#[derive(Eq, PartialEq)]
struct Wrapper();
fn foo<const W: Wrapper>() {}
fn foo2<const F: fn()>() {}
```
This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place.
cc: ``@b-naber`` who introduced that test^
fixes #99641
|
|
|
|
interpret, ptr_offset_from: refactor and test too-far-apart check
We didn't have any tests for the "too far apart" message, and indeed that check mostly relied on the in-bounds check and was otherwise probably not entirely correct... so I rewrote that check, and it is before the in-bounds check so we can test it separately.
|
|
FulfillmentCtxt::new_in_snapshot
|
|
don't ICE on invalid dyn calls
Due to https://github.com/rust-lang/rust/issues/50781 this is actually reachable.
Fixes https://github.com/rust-lang/miri/issues/2432
r? ``@oli-obk``
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|