| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
Warn when ignore-tidy-linelength is present, but no lines are too long
It's easy for a `// ignore-tidy-linelength` to be added when there is a genuine need to ignore a file's line length, but then after refactoring the need is gone, but the tidy directive is not removed. This means that in the future, further editing may accidentally add unnecessarily long lines. This change forces `// ignore-tidy-linelength` to be used exactly when necessary, to make sure such changes are intentional.
|
|
|
|
|
|
Don't stop evaluating due to errors before borrow checking
r? @oli-obk
Fix #60005. Follow up to #59903. Blocked on #53708, fixing the ICE in `src/test/ui/consts/match_ice.rs`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fn: Improve wording
fixes #59611
This might need discussion. Feel free to close this PR if we don't need to fix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Unregress using scalar unions in constants.
fixes https://github.com/rust-lang/rust/issues/59126
r? @RalfJung
I also made a bunch of these invariants panic instead of report an error.
|
|
|
|
|
|
|
|
|
|
|
|
Don't promote function calls to nonpromotable things
fixes https://github.com/rust-lang/rust/issues/58767 and fixes https://github.com/rust-lang/rust/issues/58634
r? @eddyb
should we additionally check the function call return type? It might be a promotable function (or any `const fn` inside a `const fn`), but its return type might contain interior mutability.
|
|
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
|
|
|
|
```
error[E0004]: non-exhaustive patterns: type `X` is non-empty
--> file.rs:9:11
|
1 | / enum X {
2 | | A,
| | - variant not covered
3 | | B,
| | - variant not covered
4 | | C,
| | - variant not covered
5 | | }
| |_- `X` defined here
...
9 | match x {
| ^
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `B` and `C` not covered
--> file.rs:11:11
|
1 | / enum X {
2 | | A,
3 | | B,
4 | | C,
| | - not covered
5 | | }
| |_- `X` defined here
...
11 | match x {
| ^ patterns `C` not covered
```
When a match expression doesn't have patterns covering every variant,
point at the enum's definition span. On a best effort basis, point at the
variant(s) that are missing. This does not handle the case when the missing
pattern is due to a field's enum variants:
```
enum E1 {
A,
B,
C,
}
enum E2 {
A(E1),
B,
}
fn foo() {
match E2::A(E1::A) {
E2::A(E1::B) => {}
E2::B => {}
}
//~^ ERROR `E2::A(E1::A)` and `E2::A(E1::C)` not handled
}
```
Unify look between match with no arms and match with some missing patterns.
Fix #37518.
|
|
Make `Unique::as_ptr` const without feature attribute as it's unstable
Make `NonNull::dangling` and `NonNull::cast` const with `feature = "const_ptr_nonnull"`
|
|
|
|
Add expected/provided byte alignments to validation error message
Fixes #58617
|
|
|
|
|
|
|
|
|
|
AFAICT, we do not have the same const-eval issues that we used to when
rust-lang/rust#23926 was filed. (Probably because of the switch to
miri for const-evaluation.)
|
|
r=oli-obk
compile-pass test for #53606
fixes #53606
|
|
|
|
|
|
|
|
|
|
Fix evaluating trivial drop glue in constants
```rust
struct A;
impl Drop for A {
fn drop(&mut self) {}
}
const FOO: Option<A> = None;
const BAR: () = (FOO, ()).1;
```
was erroring with
```
error: any use of this value will cause an error
--> src/lib.rs:9:1
|
9 | const BAR: () = (FOO, ()).1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-^
| |
| calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))`
|
= note: #[deny(const_err)] on by default
error: aborting due to previous error
```
before this PR. According to godbolt this last compiled successfully in 1.27
|
|
|
|
|
|
Rollup of 9 pull requests
Successful merges:
- #57537 (Small perf improvement for fmt)
- #57552 (Default images)
- #57604 (Make `str` indexing generic on `SliceIndex`.)
- #57667 (Fix memory leak in P::filter_map)
- #57677 (const_eval: Predetermine the layout of all locals when pushing a stack frame)
- #57791 (Add regression test for #54582)
- #57798 (Corrected spelling inconsistency)
- #57809 (Add powerpc64-unknown-freebsd)
- #57813 (fix validation range printing when encountering undef)
Failed merges:
r? @ghost
|
|
fix validation range printing when encountering undef
|