| Age | Commit message (Collapse) | Author | Lines |
|
interpret/validity: separately control checking numbers for being init and non-ptr
This lets Miri control this in a more fine-grained way.
r? `@oli-obk`
|
|
|
|
|
|
|
|
|
|
r=nikomatsakis
generator_interior: Count match pattern bindings as borrowed for the whole guard expression
The test case `yielding-in-match-guard.rs` was failing with `-Zdrop-tracking` enabled. The reason is that the copy of a local (`y`) was not counted as a borrow in typeck, while MIR did consider this as borrowed.
The correct thing to do here is to count pattern bindings are borrowed for the whole guard. Instead, what we were doing is to record the type at the use site of the variable and check if the variable comes from a borrowed pattern. Due to the fix for #57017, we were considering too small of a scope for this variable, which meant it was not counted as borrowed.
Because we now unconditionally record the borrow, rather than only for bindings that are used, this PR is also able to remove a lot of the logic around match bindings that was there before.
r? `@nikomatsakis`
|
|
Use pointers in `cell::{Ref,RefMut}` to avoid `noalias`
When `Ref` and `RefMut` were based on references, they would get LLVM `noalias` attributes that were incorrect, because that alias guarantee is only true until the guard drops. A `&RefCell` on the same value can get a new borrow that aliases the previous guard, possibly leading to miscompilation. Using `NonNull` pointers in `Ref` and `RefCell` avoids `noalias`.
Fixes the library side of #63787, but we still might want to explore language solutions there.
|
|
|
|
This reverts commit 0d270b5e9f48268735f9a05462df65c9d1039855.
|
|
|
|
Thanks to @tmiasko for this one!
|
|
|
|
|
|
non-ptr
|
|
Add regression test for #88119
Closes #88119
|
|
|
|
|
|
|
|
This alters the diagnostics a bit, as the trait method is still stable.
The only thing this check does is ensure that compilation fails if a
trait implementation is declared const-stable.
|
|
Rather than deferring to const eval for checking if a trait is const, we
now check up-front. This allows the error to be emitted earlier, notably
at the same time as other stability checks.
Also included in this commit is a change of the default const stability
level to UNstable. Previously, an item that was `const` but did not
explicitly state it was unstable was implicitly stable.
|
|
|
|
Transition to valtrees pt1
Compartmentalising https://github.com/rust-lang/rust/pull/96591 as much as possible.
r? `@oli-obk`
|
|
use `hir::Let` in `hir::Guard::IfLet`
This PR fixes the FIXME about using `hir::Let` in `hir::Guard::IfLet`
|
|
Permit `asm_const` and `asm_sym` to reference generic params
Related #96557
These constructs will be allowed:
```rust
fn foofoo<const N: usize>() {}
unsafe fn foo<const N: usize>() {
asm!("/* {0} */", const N);
asm!("/* {0} */", const N + 1);
asm!("/* {0} */", sym foofoo::<N>);
}
fn barbar<T>() {}
unsafe fn bar<T>() {
asm!("/* {0} */", const std::mem::size_of::<T>());
asm!("/* {0} */", const std::mem::size_of::<(T, T)>());
asm!("/* {0} */", sym barbar::<T>);
asm!("/* {0} */", sym barbar::<(T, T)>);
}
```
`@Amanieu,` I didn't switch inline asms to use `DefKind::InlineAsm`, as I see little value doing that; given that no type inference is needed, it will only make typecking slower and more complex but will have no real gains. I did switch them to follow the same code path as inline asm during symbol resolution, though.
The `error: unconstrained generic constant` you mentioned in #76001 is due to the fact that `to_const` will actually add a wfness obligation to the constant, which we don't need for `asm_const`, so I have that removed.
`@rustbot` label: +A-inline-assembly +F-asm
|
|
Clean fix for #96223
Okay, so here we are (hopefully) :+1:
Closes #96223
Thanks a lot to `@jackh726` for your help and explanation :pray:
- Modified `InferCtxt::mk_trait_obligation_with_new_self_ty` to take as argument a `Binder<(TraitPredicate, Ty)>` instead of a `Binder<TraitPredicate>` and a separate `Ty` with no bound vars.
- Modified all call places to avoid calling `Binder::no_bounds_var` or `Binder::skip_binder` when it is not safe.
r? `@jackh726`
|
|
Mention traits and types involved in unstable trait upcasting
Fixes #95972 by printing the traits being upcasted and the types being coerced that cause that upcasting...
---
the poor span mentioned in the original issue has nothing to do with trait upcasting diagnostic here...
> The original example I had that made me run into this issue had an even longer expression there (multiple chained
iterator methods) which just got all highlighted as one big block saying "somewhere here trait coercion is used and it's not allowed".
I don't think I can solve that issue in general without fixing the ObligationCauseCode and span that gets passed into Coerce.
|
|
update coherence docs, fix generator + opaque type ICE
the world is confusing, this makes it slightly less so
|
|
Suggest dereferencing non-lval mutable reference on assignment
1. Adds deref suggestions for LHS of assignment (or assign-binop) when it implements `DerefMut`
2. Fixes missing deref suggestions for LHS when it isn't a place expr
Fixes #46276
Fixes #93980
|
|
|
|
|
|
|
|
|
|
interpret/validity: reject references to uninhabited types
According to https://doc.rust-lang.org/reference/behavior-considered-undefined.html, this is definitely UB. And we can check this without actually looking up anything in memory, we just need the reference value and its type, making this a great candidate for a validity invariant IMO and my favorite resolution of https://github.com/rust-lang/unsafe-code-guidelines/issues/77.
With this PR, Miri with `-Zmiri-check-number-validity` implements all my preferred options for what the validity invariants of our types could be. :)
CTFE has been doing recursive checking anyway, so this is backwards compatible but might change the error output. I will submit a PR with the new Miri tests soon.
r? `@oli-obk`
|
|
Types with reachable constructors are reachable
Fixes #96934.
r? `@petrochenkov`
|
|
r=cjgillot
Omit unnecessary help to add `#[cfg(test)]` when already annotated
Closes: https://github.com/rust-lang/rust/issues/96611
The related PR is: https://github.com/rust-lang/rust/pull/91770
|
|
|
|
|
|
|
|
Update function pointer call error message
It now uses the type of context. (fixes #97082)
|
|
Add regression test for #81804
Closes #81804
r? ``@compiler-errors``
|
|
Add a couple tests for #90887 fixes
closes #56556
closes #90875
These are confirmed fixes by #90887, so
r? ``@jackh726``
|
|
|
|
|
|
Retire `ItemLikeVisitor` trait
Issue #95004
cc `@cjgillot`
|
|
|
|
It now uses the type of context. (issue 97082)
|
|
Clean up derived obligation creation
r? `@estebank`
working on fixing the perf regression from https://github.com/rust-lang/rust/pull/91030#issuecomment-1083360210
|
|
|
|
|
|
|