Skip to content

Commit 46b64aa

Browse files
authored
Rollup merge of rust-lang#112498 - SamZhang3:rust-reference-link-update, r=Nilstrieb
Update links to Rust Reference in diagnostic Instead of linking to the [old Rust Reference site](https://static.rust-lang.org/doc/master/reference.html#literals), which is severely outdated (Rust 1.17), link to the [current website](https://doc.rust-lang.org/stable/reference/expressions/literal-expr.html) in diagnostic about incorrect literals.
2 parents 0ff35f2 + 6336da9 commit 46b64aa

6 files changed

+9
-9
lines changed

compiler/rustc_parse/src/lexer/unescape_error_reporting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub(crate) fn emit_unescape_error(
158158

159159
diag.help(
160160
"for more information, visit \
161-
<https://static.rust-lang.org/doc/master/reference.html#literals>",
161+
<https://doc.rust-lang.org/reference/tokens.html#literals>",
162162
);
163163
}
164164
diag.emit();

tests/ui/lexer/lex-bad-char-literals-1.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error: unknown character escape: `\u{25cf}`
1616
LL | '\●'
1717
| ^ unknown character escape
1818
|
19-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
19+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
2020
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
2121
|
2222
LL | r"\●"
@@ -28,7 +28,7 @@ error: unknown character escape: `\u{25cf}`
2828
LL | "\●"
2929
| ^ unknown character escape
3030
|
31-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
31+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
3232
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
3333
|
3434
LL | r"\●"

tests/ui/parser/bad-escape-suggest-raw-string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ fn main() {
22
let ok = r"ab\[c";
33
let bad = "ab\[c";
44
//~^ ERROR unknown character escape: `[`
5-
//~| HELP for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
5+
//~| HELP for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
66
//~| HELP if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
77
}

tests/ui/parser/bad-escape-suggest-raw-string.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: unknown character escape: `[`
44
LL | let bad = "ab\[c";
55
| ^ unknown character escape
66
|
7-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
7+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
88
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
99
|
1010
LL | let bad = r"ab\[c";

tests/ui/parser/byte-literals.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error: unknown byte escape: `f`
44
LL | static FOO: u8 = b'\f';
55
| ^ unknown byte escape
66
|
7-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
7+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
88

99
error: unknown byte escape: `f`
1010
--> $DIR/byte-literals.rs:6:8
1111
|
1212
LL | b'\f';
1313
| ^ unknown byte escape
1414
|
15-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
15+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
1616

1717
error: invalid character in numeric character escape: `Z`
1818
--> $DIR/byte-literals.rs:7:10

tests/ui/parser/byte-string-literals.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error: unknown byte escape: `f`
44
LL | static FOO: &'static [u8] = b"\f";
55
| ^ unknown byte escape
66
|
7-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
7+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
88

99
error: unknown byte escape: `f`
1010
--> $DIR/byte-string-literals.rs:4:8
1111
|
1212
LL | b"\f";
1313
| ^ unknown byte escape
1414
|
15-
= help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals>
15+
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
1616

1717
error: invalid character in numeric character escape: `Z`
1818
--> $DIR/byte-string-literals.rs:5:10

0 commit comments

Comments
 (0)