Skip to content

Commit 839170f

Browse files
committed
doc: Be more specific about how to box closures
1 parent 06c6b3c commit 839170f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/librustc/middle/ty.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5151,8 +5151,7 @@ pub fn note_and_explain_type_err<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>, sp
51515151
if expected_str == found_str && expected_str == "closure" {
51525152
cx.sess.span_note(sp, &format!("no two closures, even if identical, have the same \
51535153
type"));
5154-
cx.sess.span_help(sp, &format!("consider boxing your closure and/or \
5155-
using it as a trait object"));
5154+
cx.sess.span_help(sp, &format!("consider boxing your closure as a trait object"));
51565155
}
51575156
}
51585157
_ => {}

src/test/compile-fail/issue-24036.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn closure_to_loc() {
1313
x = |c| c + 1;
1414
//~^ ERROR mismatched types
1515
//~| NOTE no two closures, even if identical, have the same type
16-
//~| HELP consider boxing your closure and/or using it as a trait object
16+
//~| HELP consider boxing your closure as a trait object
1717
}
1818

1919
fn closure_from_match() {
@@ -24,7 +24,7 @@ fn closure_from_match() {
2424
};
2525
//~^^^^^ ERROR match arms have incompatible types
2626
//~| NOTE no two closures, even if identical, have the same type
27-
//~| HELP consider boxing your closure and/or using it as a trait object
27+
//~| HELP consider boxing your closure as a trait object
2828
}
2929

3030
fn main() { }

0 commit comments

Comments
 (0)