Skip to content

Commit 4d6ae78

Browse files
committed
Remove old diagnostic notes for type ascription syntax
Type ascription syntax was removed in 2023.
1 parent efb1e3d commit 4d6ae78

26 files changed

+1
-62
lines changed

Diff for: compiler/rustc_parse/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,6 @@ parse_trait_alias_cannot_be_unsafe = trait aliases cannot be `unsafe`
806806
parse_transpose_dyn_or_impl = `for<...>` expected after `{$kw}`, not before
807807
.suggestion = move `{$kw}` before the `for<...>`
808808
809-
parse_type_ascription_removed =
810-
if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
811-
812809
parse_unclosed_unicode_escape = unterminated unicode escape
813810
.label = missing a closing `{"}"}`
814811
.terminate = terminate the unicode escape

Diff for: compiler/rustc_parse/src/errors.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1598,9 +1598,6 @@ pub(crate) struct PathSingleColon {
15981598

15991599
#[suggestion(applicability = "machine-applicable", code = ":", style = "verbose")]
16001600
pub suggestion: Span,
1601-
1602-
#[note(parse_type_ascription_removed)]
1603-
pub type_ascription: bool,
16041601
}
16051602

16061603
#[derive(Diagnostic)]
@@ -1617,9 +1614,6 @@ pub(crate) struct ColonAsSemi {
16171614
#[primary_span]
16181615
#[suggestion(applicability = "machine-applicable", code = ";", style = "verbose")]
16191616
pub span: Span,
1620-
1621-
#[note(parse_type_ascription_removed)]
1622-
pub type_ascription: bool,
16231617
}
16241618

16251619
#[derive(Diagnostic)]

Diff for: compiler/rustc_parse/src/parser/diagnostics.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1943,10 +1943,7 @@ impl<'a> Parser<'a> {
19431943
&& self.token == token::Colon
19441944
&& self.look_ahead(1, |next| line_idx(self.token.span) < line_idx(next.span))
19451945
{
1946-
self.dcx().emit_err(ColonAsSemi {
1947-
span: self.token.span,
1948-
type_ascription: self.psess.unstable_features.is_nightly_build(),
1949-
});
1946+
self.dcx().emit_err(ColonAsSemi { span: self.token.span });
19501947
self.bump();
19511948
return true;
19521949
}

Diff for: compiler/rustc_parse/src/parser/path.rs

-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ impl<'a> Parser<'a> {
273273
self.dcx().emit_err(PathSingleColon {
274274
span: self.prev_token.span,
275275
suggestion: self.prev_token.span.shrink_to_hi(),
276-
type_ascription: self.psess.unstable_features.is_nightly_build(),
277276
});
278277
}
279278
continue;
@@ -348,7 +347,6 @@ impl<'a> Parser<'a> {
348347
err = self.dcx().create_err(PathSingleColon {
349348
span: self.token.span,
350349
suggestion: self.prev_token.span.shrink_to_hi(),
351-
type_ascription: self.psess.unstable_features.is_nightly_build(),
352350
});
353351
}
354352
// Attempt to find places where a missing `>` might belong.

Diff for: compiler/rustc_parse/src/parser/stmt.rs

-4
Original file line numberDiff line numberDiff line change
@@ -771,10 +771,6 @@ impl<'a> Parser<'a> {
771771
Applicability::MaybeIncorrect,
772772
);
773773
}
774-
if self.psess.unstable_features.is_nightly_build() {
775-
// FIXME(Nilstrieb): Remove this again after a few months.
776-
err.note("type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>");
777-
}
778774
}
779775
}
780776

Diff for: tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ error: unexpected `,` in pattern
6666
LL | let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
6767
| ^
6868
|
69-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
7069
help: try adding parentheses to match on a tuple
7170
|
7271
LL | let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()

Diff for: tests/ui/generics/single-colon-path-not-const-generics.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | a: Vec<foo::bar:A>,
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | a: Vec<foo::bar::A>,

Diff for: tests/ui/or-patterns/or-patterns-syntactic-fail.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ LL | let _ = |A | B: E| ();
66
| |
77
| while parsing the body of this closure
88
|
9-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
109
help: you might have meant to open the body of the closure
1110
|
1211
LL | let _ = |A | { B: E| ();

Diff for: tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr

-18
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,18 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
4949
|
5050
LL | let _ = 0i32: i32: i32.count_ones();
5151
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
52-
|
53-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
5452

5553
error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, `?`, or `else`, found `:`
5654
--> $DIR/issue-35813-postfix-after-cast.rs:43:21
5755
|
5856
LL | let _ = 0 as i32: i32.count_ones();
5957
| ^ expected one of 8 possible tokens
60-
|
61-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
6258

6359
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
6460
--> $DIR/issue-35813-postfix-after-cast.rs:47:17
6561
|
6662
LL | let _ = 0i32: i32 as i32.count_ones();
6763
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
68-
|
69-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
7064

7165
error: cast cannot be followed by a method call
7266
--> $DIR/issue-35813-postfix-after-cast.rs:51:13
@@ -84,16 +78,12 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
8478
|
8579
LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones();
8680
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
87-
|
88-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
8981

9082
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
9183
--> $DIR/issue-35813-postfix-after-cast.rs:60:17
9284
|
9385
LL | let _ = 0i32: i32.count_ones(): u32;
9486
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
95-
|
96-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
9787

9888
error: cast cannot be followed by a method call
9989
--> $DIR/issue-35813-postfix-after-cast.rs:64:13
@@ -111,16 +101,12 @@ error: expected one of `.`, `;`, `?`, or `else`, found `:`
111101
|
112102
LL | let _ = 0 as i32.count_ones(): u32;
113103
| ^ expected one of `.`, `;`, `?`, or `else`
114-
|
115-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
116104

117105
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
118106
--> $DIR/issue-35813-postfix-after-cast.rs:69:17
119107
|
120108
LL | let _ = 0i32: i32.count_ones() as u32;
121109
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
122-
|
123-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
124110

125111
error: cast cannot be followed by a method call
126112
--> $DIR/issue-35813-postfix-after-cast.rs:73:13
@@ -138,8 +124,6 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
138124
|
139125
LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32;
140126
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
141-
|
142-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
143127

144128
error: cast cannot be followed by a method call
145129
--> $DIR/issue-35813-postfix-after-cast.rs:82:13
@@ -262,8 +246,6 @@ error: expected identifier, found `:`
262246
|
263247
LL | drop_ptr: F();
264248
| ^ expected identifier
265-
|
266-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
267249

268250
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:`
269251
--> $DIR/issue-35813-postfix-after-cast.rs:160:13

Diff for: tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, fo
44
LL | let x = Tr<A, A:>;
55
| ^ expected one of 8 possible tokens
66
|
7-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: maybe write a path separator here
98
|
109
LL | let x = Tr<A, A::>;

Diff for: tests/ui/parser/ternary_operator.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
3333
|
3434
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
3535
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
36-
|
37-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
3836

3937
error: Rust has no ternary operator
4038
--> $DIR/ternary_operator.rs:26:19

Diff for: tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `:`
1111
|
1212
LL | let a @ (b: u8);
1313
| ^ expected one of `)`, `,`, `@`, `if`, or `|`
14-
|
15-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
1614

1715
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@`
1816
--> $DIR/nested-type-ascription-syntactically-invalid.rs:30:15

Diff for: tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result {
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

Diff for: tests/ui/suggestions/many-type-ascription.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
33
|
44
LL | let _ = 0: i32;
55
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
6-
|
7-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
86

97
error: aborting due to 1 previous error
108

Diff for: tests/ui/suggestions/struct-field-type-including-single-colon.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | a: foo:A,
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | a: foo::A,
@@ -16,7 +15,6 @@ error: path separator must be a double colon
1615
LL | b: foo::bar:B,
1716
| ^
1817
|
19-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
2018
help: use a double colon instead
2119
|
2220
LL | b: foo::bar::B,

Diff for: tests/ui/suggestions/type-ascription-instead-of-method.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | let _ = Box:new("foo".to_string());
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | let _ = Box::new("foo".to_string());

Diff for: tests/ui/suggestions/type-ascription-instead-of-path-2.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: expected one of `(`, `.`, `::`, `;`, `?`, `else`, or an operator, found `
44
LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
55
| ^ expected one of 7 possible tokens
66
|
7-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: maybe write a path separator here
98
|
109
LL | let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?;

Diff for: tests/ui/suggestions/type-ascription-instead-of-path.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | std:io::stdin();
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | std::io::stdin();

Diff for: tests/ui/suggestions/type-ascription-instead-of-variant.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | let _ = Option:Some("");
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | let _ = Option::Some("");

Diff for: tests/ui/type/ascription/issue-47666.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | let _ = Option:Some(vec![0, 1]);
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | let _ = Option::Some(vec![0, 1]);

Diff for: tests/ui/type/ascription/issue-54516.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>());

Diff for: tests/ui/type/ascription/issue-60933.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: path separator must be a double colon
44
LL | let _: usize = std::mem:size_of::<u32>();
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a double colon instead
98
|
109
LL | let _: usize = std::mem::size_of::<u32>();

Diff for: tests/ui/type/missing-let-in-binding.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: expected identifier, found `:`
44
LL | _foo: i32 = 4;
55
| ^ expected identifier
66
|
7-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: you might have meant to introduce a new binding
98
|
109
LL | let _foo: i32 = 4;

Diff for: tests/ui/type/type-ascription-instead-of-statement-end.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: statements are terminated with a semicolon
44
LL | println!("test"):
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a semicolon instead
98
|
109
LL - println!("test"):

Diff for: tests/ui/type/type-ascription-precedence.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ error: expected identifier, found `:`
3333
|
3434
LL | S .. S: S;
3535
| ^ expected identifier
36-
|
37-
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
3836

3937
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
4038
--> $DIR/type-ascription-precedence.rs:53:13

Diff for: tests/ui/type/type-ascription-with-fn-call.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: statements are terminated with a semicolon
44
LL | f() :
55
| ^
66
|
7-
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
87
help: use a semicolon instead
98
|
109
LL - f() :

0 commit comments

Comments
 (0)