Recursive items are currently detected in the `check_const` pass which runs after type checking. This means a recursive static item used as an array length will cause type checking to blow the stack. This PR separates the recursion check out into a separate pass which is run before type checking.
Closes issue #17252
r? @nick29581
Avoids warnings during bootstrap, similar to:
src/librustc/lib.rs:149:1: 149:39 warning: diagnostic code E0099 never used
src/librustc/lib.rs:149 __build_diagnostic_array!(DIAGNOSTICS)
All of these codes stopped being used in this commit:
688ddf7 ("typeck/kind -- stop using old trait framework.")
See also similar fix: https://github.com/rust-lang/rust/issues/16449
This prevents confusing errors when accidentally using an assignment
in an `if` expression. For example:
```rust
fn main() {
let x = 1u;
if x = x {
println!("{}", x);
}
}
```
Previously, this yielded:
```
test.rs:4:16: 4:17 error: expected `:`, found `!`
test.rs:4 println!("{}", x);
^
```
With this change, it now yields:
```
test.rs:3:8: 3:13 error: mismatched types: expected `bool`, found `()` (expected bool, found ())
test.rs:3 if x = x {
^~~~~
```
Closes issue #17283
As per [RFC 52](https://github.com/rust-lang/rfcs/blob/master/active/0052-ownership-variants.md), use `_mut` suffixes to mark mutable variants, and `into_iter` for moving iterators. Additional details and motivation in the RFC.
Note that the iterator *type* names are not changed by this RFC; those are awaiting a separate RFC for standardization.
Closes#13660Closes#16810
[breaking-change]
This is part of the migration of crates into the Cargo ecosystem. There
is now an external repository https://github.com/rust-lang/num for bignums.
The single use of libnum elsewhere in the repository is for a shootout
benchmark, which is being moved into the external crate.
Due to deprecation, this is a:
[breaking-change]
lifetime bounds. This doesn't really cause any difficulties, because
we already had to accommodate the fact that multiple implicit bounds
could accumulate. Object types still require precisely one lifetime
bound. This is a pre-step towards generalized where clauses (once you
have lifetime bounds in where clauses, it is harder to restrict them
to exactly one).
Currently the ZSH completions are quite old an nearly useless. This
brings them up to be compatible with current rust and makes them far
more useful.
Closes#17305
This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way.
Major changes:
- Do not track impls through trans, instead recompute as needed.
- Isolate trait matching code into its own module, carefully structure to distinguish various phases (selection vs confirmation vs fulfillment)
- Consider where clauses in their more general form
- Integrate checking of builtin bounds into the trait matching process, rather than doing it separately in kind.rs (important for opt-in builtin bounds)
What is not included:
- Where clauses are still not generalized. This should be a straightforward follow-up patch.
- Caching. I did not include much caching. I have plans for various kinds of caching we can do. Should be straightforward. Preliminary perf measurements suggested that this branch keeps compilation times roughly what they are.
- Method resolution. The initial algorithm I proposed for #5527 does not work as well as I hoped. I have a revised plan which is much more similar to what we do today.
- Deref vs deref-mut. The initial fix I had worked great for autoderef, but not for explicit deref.
- Permitting blanket impls to overlap with specific impls. Initial plan to consider all nested obligations before considering an impl to match caused many compilation errors. We have a revised plan but it is not implemented here, should be a relatively straightforward extension.