Skip to content

Commit 6343920

Browse files
committed
jdonszelmann feedback
1 parent 62b3b53 commit 6343920

File tree

2 files changed

+7
-3
lines changed
  • compiler

2 files changed

+7
-3
lines changed

compiler/rustc_error_codes/src/error_codes/E0608.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ let v: Vec<u8> = vec![0, 1, 2, 3];
1717
println!("{}", v[2]);
1818
```
1919

20-
Tuples and structs are indexed with dot (`._`), not with brackets (`[_]`).
21-
Tuple element names are their positions: tuple = (tuple.0, tuple.1, ...)
20+
Tuples and structs are indexed with dot (`.`), not with brackets (`[]`),
21+
and tuple element names are their positions:
22+
```ignore(pseudo code)
23+
// this (pseudo code) expression is true for any tuple:
24+
tuple == (tuple.0, tuple.1, ...)
25+
```

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3553,7 +3553,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
35533553
// Try to give some advice about indexing tuples.
35543554
if let ty::Tuple(types) = base_t.kind() {
35553555
err.help(
3556-
"tuples are indexed with dot (`._`): tuple = (tuple.0, tuple.1, ...)",
3556+
"tuples are indexed with dot: `tuple == (tuple.0, tuple.1, ...)`",
35573557
);
35583558
// If index is an unsuffixed integer, show the fixed expression:
35593559
if let ExprKind::Lit(lit) = idx.kind

0 commit comments

Comments
 (0)