| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
Rollup of 8 pull requests
Successful merges:
- #77334 (Reorder benches const variable)
- #77888 (Simplify a nested bool match)
- #77921 (f64: Refactor collapsible_if)
- #78523 (Revert invalid `fn` return type parsing change)
- #78524 (Avoid BorrowMutError with RUSTC_LOG=debug)
- #78545 (Make anonymous binders start at 0)
- #78554 (Improve wording of `core::ptr::drop_in_place` docs)
- #78556 (Link to pass docs from NRVO module docs)
Failed merges:
- #78424 (Fix some more clippy warnings)
r? `@ghost`
|
|
Make anonymous binders start at 0
A few changes to some test outputs, but these actually look *more* correct to me.
|
|
Avoid BorrowMutError with RUSTC_LOG=debug
```console
$ touch empty.rs
$ env RUSTC_LOG=debug rustc +stage1 --crate-type=lib empty.rs
```
Fails with a `BorrowMutError` because source map files are already
borrowed while `features_query` attempts to format a log message
containing a span.
Release the borrow before the query to avoid the issue.
|
|
Revert invalid `fn` return type parsing change
Revert one of the changes in #78379.
Fix #78507.
|
|
Always record reference to binding in match if guards
When encountering a binding from a `match` pattern in its `if` guard when computing a generator's interior types, we must always record the type of a reference to the binding because of how `if` guards are lowered to MIR. This was missed in #75213 because the binding in that test case was autorefed and we recorded that adjusted type anyway.
Fixes #78366
|
|
Handle type errors in closure/generator upvar_tys
Fixes #77993
|
|
|
|
Prefer new associated numeric consts in float error messages
Fix https://github.com/rust-lang/rust/issues/78382
|
|
Do not ICE on invalid input
Fix #78372.
|
|
|
|
Fix #78507.
|
|
Rollup of 11 pull requests
Successful merges:
- #77213 (rustdoc options to set default theme (and other settings))
- #78224 (min_const_generics: allow ty param in repeat expr)
- #78428 (MinConstGenerics UI test for invalid values for bool & char)
- #78460 (Adjust turbofish help message for const generics)
- #78470 (Clean up intra-doc links in `std::path`)
- #78475 (fix a comment in validity check)
- #78478 (Add const generics tests for supertraits + dyn traits.)
- #78487 (Fix typo "compiltest")
- #78491 (Inline NonZeroN::from(n))
- #78492 (Update books)
- #78494 (Fix typos)
Failed merges:
r? `@ghost`
|
|
Add const generics tests for supertraits + dyn traits.
Partially addresses #78433
|
|
Adjust turbofish help message for const generics
Types are no longer special. (This message arguably only makes sense with `min_const_generics` or more, but we'll be there soon.)
r? @lcnr
|
|
MinConstGenerics UI test for invalid values for bool & char
This adds a test for `feature(min_const_generics)` with some invalid values for bools and chars and ensures that they do not ICE and error with understandable messages.
r? @lcnr
|
|
min_const_generics: allow ty param in repeat expr
implements https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/repeat.20expressions
Even with `min_const_generics` active, now keeps resulting in future compat warnings instead of hard errors.
Const parameters, for example `[0; N + 1]`, still result in hard errors during resolve.
```rust
#![allow(dead_code)]
fn foo<T>() {
[0; std::mem::size_of::<*mut T>()];
}
struct Foo<T>(T);
impl<T> Foo<T> {
const ASSOC: usize = 4;
fn test() {
[0; Self::ASSOC];
}
}
```
r? @varkor cc @petrochenkov
|
|
Clarify main code paths in exhaustiveness checking
This PR massively clarifies the main code paths of exhaustiveness checking, by using the `Constructor` enum to a fuller extent. I've been itching to write it for more than a year, but the complexity of matching consts had prevented me. Behold a massive simplification :D.
This in particular removes a fair amount of duplication between various parts, localizes code into methods of relevant types when applicable, makes some implicit assumptions explicit, and overall improves legibility a lot (or so I hope). Additionally, after my changes undoing #76918 turned out to be a noticeable perf gain.
As usual I tried my best to make the commits self-contained and easy to follow. I've also tried to keep the code well-commented, but I tend to forget how complex this file is; I'm happy to clarify things as needed.
My measurements show good perf improvements on the two match-heavy benchmarks (-18.0% on `unicode_normalization-check`! :D); I'd like a perf run to check the overall impact.
r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
|
|
|
|
|
|
|
|
|
|
|
|
Rollup of 10 pull requests
Successful merges:
- #78152 (Separate unsized locals)
- #78297 (Suggest calling await on method call and field access)
- #78351 (Move "mutable thing in const" check from interning to validity)
- #78365 (check object safety of generic constants)
- #78379 (Tweak invalid `fn` header and body parsing)
- #78391 (Add const_fn in generics test)
- #78401 (resolve: private fields in tuple struct ctor diag)
- #78408 (Remove tokens from foreign items in `TokenStripper`)
- #78447 (Fix typo in comment)
- #78453 (Fix typo in comments)
Failed merges:
r? `@ghost`
|
|
Remove tokens from foreign items in `TokenStripper`
Fixes #78398
I forgot to handle this case in #77255
|
|
davidtwco:issue-75906-tuple-construct-private-field, r=estebank
resolve: private fields in tuple struct ctor diag
Fixes #75906.
This PR improves the diagnostic emitted when a tuple struct is being constructed which has private fields so that private fields are labelled and the message is improved.
r? @estebank
|
|
Add const_fn in generics test
Adds a test that constant functions in generic parameters work properly. I was surprised this works, but I also to turbofish the constant in main, otherwise it didn't infer properly:
```
let v: ConstU32<3> = ...
```
Did not work as I expected, which I can highlight in the test if that's the intended behaviour.
r? @lcnr
|
|
Tweak invalid `fn` header and body parsing
* Rely on regular "expected"/"found" parser error for `fn`, fix #77115
* Recover empty `fn` bodies when encountering `}`
* Recover trailing `>` in return types
* Recover from non-type in array type `[<BAD TOKEN>; LEN]`
|
|
check object safety of generic constants
As `Self` can only be effectively used in constants with `const_evaluatable_checked` this should not matter outside of it.
Implements the first item of #72219
> Object safety interactions with constants
r? @oli-obk for now cc @nikomatsakis
|
|
Move "mutable thing in const" check from interning to validity
This moves the check for mutable things (such as `UnsafeCell` or `&mut`) in a`const` from interning to validity. That means we can give more targeted error messages (pointing out *where* the problem lies), and we can simplify interning a bit.
Also fix the interning mode used for promoteds in statics.
r? @oli-obk
|
|
Suggest calling await on method call and field access
When encountering a failing method or field resolution on a `Future`,
look at the `Output` and try the same operation on it. If successful,
suggest calling `.await` on the `Future`.
This had already been introduced in #72784, but at some point they
stopped working.
Built on top of #78214, only last commit is relevant.
r? @oli-obk
|
|
Separate unsized locals
Closes #71694
Takes over again #72029 and #74971
cc @RalfJung @oli-obk @pnkfelix @eddyb as they've participated in previous reviews of this PR.
|
|
Uplift `temporary-cstring-as-ptr` lint from `clippy` into rustc
The general consensus seems to be that this lint covers a common enough mistake to warrant inclusion in rustc.
The diagnostic message might need some tweaking, as I'm not sure the use of second-person perspective matches the rest of rustc, but I'd like to hear others' thoughts on that.
(cc #53224).
r? `@oli-obk`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|