Skip to content

Commit 2e8ffed

Browse files
authored
Rollup merge of #86096 - FabianWolff:ec-E0316, r=GuillaumeGomez
Comment out unused error codes and add description for E0316 I have added an extended description of `E0316` and commented out a bunch of unused error codes to make clear the fact that they are no longer in use. You can check for yourself with ```shell for ec in \ E0314 E0315 E0473 E0474 E0475 E0479 E0480 E0481 \ E0483 E0484 E0485 E0486 E0487 E0488 E0489 do if [ ! -z "`grep -r $ec compiler/* --exclude-dir=rustc_error_codes`" ] then echo $ec false fi done ``` i.e. these error codes appear nowhere in the compiler code and thus cannot be emitted. r? ```@GuillaumeGomez```
2 parents f99a892 + 09307a3 commit 2e8ffed

File tree

3 files changed

+49
-16
lines changed

3 files changed

+49
-16
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ E0308: include_str!("./error_codes/E0308.md"),
157157
E0309: include_str!("./error_codes/E0309.md"),
158158
E0310: include_str!("./error_codes/E0310.md"),
159159
E0312: include_str!("./error_codes/E0312.md"),
160+
E0316: include_str!("./error_codes/E0316.md"),
160161
E0317: include_str!("./error_codes/E0317.md"),
161162
E0321: include_str!("./error_codes/E0321.md"),
162163
E0322: include_str!("./error_codes/E0322.md"),
@@ -553,9 +554,8 @@ E0783: include_str!("./error_codes/E0783.md"),
553554
E0311, // thing may not live long enough
554555
E0313, // lifetime of borrowed pointer outlives lifetime of captured
555556
// variable
556-
E0314, // closure outlives stack frame
557-
E0315, // cannot invoke closure outside of its lifetime
558-
E0316, // nested quantification of lifetimes
557+
// E0314, // closure outlives stack frame
558+
// E0315, // cannot invoke closure outside of its lifetime
559559
// E0319, // trait impls for defaulted traits allowed just for structs/enums
560560
E0320, // recursive overflow during dropck
561561
// E0372, // coherence not object safe
@@ -584,21 +584,21 @@ E0783: include_str!("./error_codes/E0783.md"),
584584
// E0470, removed
585585
// E0471, // constant evaluation error (in pattern)
586586
E0472, // llvm_asm! is unsupported on this target
587-
E0473, // dereference of reference outside its lifetime
588-
E0474, // captured variable `..` does not outlive the enclosing closure
589-
E0475, // index of slice outside its lifetime
587+
// E0473, // dereference of reference outside its lifetime
588+
// E0474, // captured variable `..` does not outlive the enclosing closure
589+
// E0475, // index of slice outside its lifetime
590590
E0476, // lifetime of the source pointer does not outlive lifetime bound...
591-
E0479, // the type `..` (provided as the value of a type parameter) is...
592-
E0480, // lifetime of method receiver does not outlive the method call
593-
E0481, // lifetime of function argument does not outlive the function call
591+
// E0479, // the type `..` (provided as the value of a type parameter) is...
592+
// E0480, // lifetime of method receiver does not outlive the method call
593+
// E0481, // lifetime of function argument does not outlive the function call
594594
E0482, // lifetime of return value does not outlive the function call
595-
E0483, // lifetime of operand does not outlive the operation
596-
E0484, // reference is not valid at the time of borrow
597-
E0485, // automatically reference is not valid at the time of borrow
598-
E0486, // type of expression contains references that are not valid during..
599-
E0487, // unsafe use of destructor: destructor might be called while...
600-
E0488, // lifetime of variable does not enclose its declaration
601-
E0489, // type/lifetime parameter not in scope here
595+
// E0483, // lifetime of operand does not outlive the operation
596+
// E0484, // reference is not valid at the time of borrow
597+
// E0485, // automatically reference is not valid at the time of borrow
598+
// E0486, // type of expression contains references that are not valid during..
599+
// E0487, // unsafe use of destructor: destructor might be called while...
600+
// E0488, // lifetime of variable does not enclose its declaration
601+
// E0489, // type/lifetime parameter not in scope here
602602
E0490, // a value of type `..` is borrowed for too long
603603
E0498, // malformed plugin attribute
604604
E0514, // metadata version mismatch
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
A `where` clause contains a nested quantification over lifetimes.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0316
6+
trait Tr<'a, 'b> {}
7+
8+
fn foo<T>(t: T)
9+
where
10+
for<'a> &'a T: for<'b> Tr<'a, 'b>, // error: nested quantification
11+
{
12+
}
13+
```
14+
15+
Rust syntax allows lifetime quantifications in two places within
16+
`where` clauses: Quantifying over the trait bound only (as in
17+
`Ty: for<'l> Trait<'l>`) and quantifying over the whole clause
18+
(as in `for<'l> &'l Ty: Trait<'l>`). Using both in the same clause
19+
leads to a nested lifetime quantification, which is not supported.
20+
21+
The following example compiles, because the clause with the nested
22+
quantification has been rewritten to use only one `for<>`:
23+
24+
```
25+
trait Tr<'a, 'b> {}
26+
27+
fn foo<T>(t: T)
28+
where
29+
for<'a, 'b> &'a T: Tr<'a, 'b>, // ok
30+
{
31+
}
32+
```

src/test/ui/where-clauses/where-for-self.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | where for<'a> &'a T: for<'b> Bar<'b>
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0316`.

0 commit comments

Comments
 (0)