| Age | Commit message (Collapse) | Author | Lines |
|
|
|
* Use better span for member constraint errors
* Avoid a bad suggestion
* Don't report member constraint errors if we have other universal
region errors.
|
|
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
|
|
`InferCtxt` contains six structures within `RefCell`s. Every time we
create and dispose of (commit or rollback) a snapshot we have to
`borrow_mut` each one of them.
This commit moves the six structures under a single `RefCell`, which
gives significant speed-ups by reducing the number of `borrow_mut`
calls. To avoid runtime errors I had to reduce the lifetimes of dynamic
borrows in a couple of places.
|
|
We now make `'empty` indexed by a universe index, resulting
in a region lattice like this:
```
static ----------+-----...------+ (greatest)
| | |
early-bound and | |
free regions | |
| | |
scope regions | |
| | |
empty(root) placeholder(U1) |
| / |
| / placeholder(Un)
empty(U1) -- /
| /
... /
| /
empty(Un) -------- (smallest)
```
Therefore, `exists<A> { forall<B> { B: A } }` is now unprovable,
because A must be at least Empty(U1) and B is placeholder(U2), and hence
the two regions are unrelated.
|
|
|
|
|
|
|
|
|
|
found via clippy
|
|
|
|
Point at opaque and closure type definitions in type errors
Fixes #57266, fixes #67117.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
|
|
rustc::traits::object_safety::{astconv_object_safety_violations,is_vtable_safe_method,object_safety_violations} free functions.
|
|
rustc::traits::error_reporting::{recursive_type_with_infinite_size_error, report_object_safety_error} free functions.
|
|
note_and_explain_region} free functions.
|
|
|
|
Nix `rustc_hir` reexports in rustc::hir
r? @Zoxc cc @Mark-Simulacrum
|
|
|
|
|
|
Nix reexports from `rustc_span` in `syntax`
Remove reexports `syntax::{source_map, symbol, edition}` and use `rustc_span` paths directly.
r? @petrochenkov
|
|
r=estebank
Suggest adding a lifetime constraint for opaque type
Fixes #67577, where code like this:
```
struct List {
data: Vec<String>,
}
impl List {
fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref())
}
}
```
will show this error:
```
Compiling playground v0.0.1 (/playground)
error[E0597]: `prefix` does not live long enough
--> src/lib.rs:6:47
|
5 | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
| -- lifetime `'a` defined here --------------------------- opaque type requires that `prefix` is borrowed for `'a`
...
```
but without suggesting the lovely `help: you can add a constraint..`.
r? @estebank
|
|
|
|
|
|
|
|
`bound`
|
|
|
|
|
|
|
|
Current name is too specific for incoming changes.
|
|
The existing wording was inappropriate for e.g.
`if let Ok(_) = expr { .. }`. The diagnostic would
leak the fact that we desugar to a `match`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Allocate HIR on an arena 1/4
This PR is the first in a series of 4, aiming at allocating the HIR on an arena, as a memory optimisation.
1. This first PR lays the groundwork and migrates some low-hanging fruits.
2. The second PR will migrate `hir::Expr`, `hir::Pat` and related.
3. The third PR will migrate `hir::Ty` and related.
4. The final PR will be dedicated to eventual cleanups.
In order to make the transition as gradual as possible, some lowering routines receive `Box`-allocated data and move it into the arena. This is a bit wasteful, but hopefully temporary.
Nonetheless, special care should be taken to avoid double arena allocations.
Work mentored by @Zoxc.
|
|
|
|
|