Closed
Description
To reproduce, check out commit cdc509f of rustc and then edit this line:
Specifically, add another '_,
before the 'tcx
. Then run ./x.py check miri
. This results in some surprising errors:
error[E0107]: struct takes 4 lifetime arguments but 5 lifetime arguments were supplied
--> src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs:278:19
|
278 | dcx: &mut DiagnosticCx<'_, '_, '_, '_,'tcx>,
| ^^^^^^^^^^^^ ---- help: remove this lifetime argument
| |
| expected 4 lifetime arguments
|
note: struct defined here, with 4 lifetime parameters: `'history`, `'ecx`, `'mir`, `'tcx`
--> src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs:123:12
|
123 | pub struct DiagnosticCx<'history, 'ecx, 'mir, 'tcx> {
| ^^^^^^^^^^^^ -------- ---- ---- ----
error[E0621]: explicit lifetime required in the type of `dcx`
--> src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs:285:13
|
278 | dcx: &mut DiagnosticCx<'_, '_, '_, '_,'tcx>,
| -------------------------------------- help: add explicit lifetime `'tcx` to the type of `dcx`: `&mut DiagnosticCx<'_, '_, '_, 'tcx>`
...
285 | self.find_granting(access, tag, exposed_tags).map_err(|()| dcx.access_error(self))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'tcx` required
error[E0621]: explicit lifetime required in the type of `dcx`
--> src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs:305:17
|
278 | dcx: &mut DiagnosticCx<'_, '_, '_, '_,'tcx>,
| -------------------------------------- help: add explicit lifetime `'tcx` to the type of `dcx`: `&mut DiagnosticCx<'_, 'tcx, '_, '_>`
...
305 | dcx.log_invalidation(item.tag());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'tcx` required
The first error is what I expected, but the other two are not useful: they are referring to an argument type that's not even a valid type, so they should not be shown. When doing refactoring, it can be quite hard to spot the actual errors in this sea of false errors.
So far I have not managed to reproduce this with a smaller example.
Cc @oli-obk is this a consequence of your recent work to keep compiling in more cases?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done