typeck: always expose repeat count `AnonConst`s' parent in `generics_of`.
This should reduce some of the confusion around #43408, although, if you look at the changed test outputs (for the last commit), they all hit #68436, so nothing new will start compiling.
We can let counts of "repeat expressions" (`N` in `[x; N]`) always have the correct generics parenting, because they're always in a body, so nothing in the `where` clauses or `impl` trait/type of the parent can use it, and therefore no query cycles can occur.
<hr/>
Other potential candidates we might want to apply the same approach to, are:
* ~~(easy) `enum` discriminants (see also #70453)~~ opened #70825
* (trickier) array *type* (not *expression*) lengths nested in:
* bodies
* types of (associated or not) `const`/`static`
* RHS of `type` aliases and associated `type`s
* `fn` signatures
We should've done so from the start, the only reason we haven't is because I was squeamish about blacklisting some of the cases, but if we whitelist instead we should be fine.
Also, lazy normalization is taking forever 😞.
<hr/>
There's also 5 other commits here:
* "typeck: track any errors injected during writeback and taint tables appropriately." - fixes#66706, as the next commit would otherwise trigger an ICE again
* "typeck: workaround WF hole in `to_const`." - its purpose is to emulate most of #70107's direct effect, at least in the case of repeat expressions, where the count always goes through `to_const`
* this is the reason no new code can really compile, as the WF checks require #68436 to bypass
* however, this has more test changes than I hoped, so it should be reviewed separately, and maybe even landed separately (as #70107 might take a while, as it's blocked on a few of my PRs)
* "ty: erase lifetimes early in `ty::Const::eval`." - first attempt at fixing #70773
* still useful, I believe the new approach is less likely to cause issues long-term
* I could take this out or move it into another PR if desired or someone else could take over (cc @skinny121)
* "traits/query/normalize: add some `debug!` logging for the result." - debugging aid for #70773
* "borrow_check/type_check: normalize `Aggregate` and `Call` operands." - actually fixes#70773
r? @nikomatsakis cc @pnkfelix @varkor @yodaldevoid @oli-obk @estebank
Remove the last remnant of unsigned Neg
It's been gone since #23945, before Rust 1.0. The former wrapping
semantics have also been available as inherent methods for a long time
now. There's no reason to keep this unused macro around.
Improve async-await/generator obligation errors in some cases
Fixes#68112.
This change is best read one commit at a time (I add a test at the beginning and update it in each change after).
The `test2` function is a case I found while writing the test that we don't handle with this code yet. I don't attempt to fix it in this PR, but it's a good candidate for future work.
r? @davidtwco, @nikomatsakis
It's been gone since #23945, before Rust 1.0. The former wrapping
semantics have also been available as inherent methods for a long time
now. There's no reason to keep this unused macro around.
Rollup of 4 pull requests
Successful merges:
- #70654 (Explain how to work with subtree)
- #71092 (Remove some usage of `DUMMY_HIR_ID`)
- #71103 (Add test case for type aliasing `impl Sized`)
- #71109 (allow const generics in const fn)
Failed merges:
r? @ghost
allow const generics in const fn
This was explicitly forbidden before. As we were unable to think of a reason
why this should still be the case, this check has been removed.
r? @eddyb
cc @varkor @Centril
Suggest .into() over try_into() when it would work
It would be better to suggest x.into() instead, which is shorter, cannot fail, and doesn't require importing a trait.
Tests have been added and made up to date.
Fixes#70851