Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Be more specific about how to box closures #26014

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5151,8 +5151,7 @@ pub fn note_and_explain_type_err<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>, sp
if expected_str == found_str && expected_str == "closure" {
cx.sess.span_note(sp, &format!("no two closures, even if identical, have the same \
type"));
cx.sess.span_help(sp, &format!("consider boxing your closure and/or \
using it as a trait object"));
cx.sess.span_help(sp, &format!("consider boxing your closure as a trait object"));
}
}
_ => {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-24036.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn closure_to_loc() {
x = |c| c + 1;
//~^ ERROR mismatched types
//~| NOTE no two closures, even if identical, have the same type
//~| HELP consider boxing your closure and/or using it as a trait object
//~| HELP consider boxing your closure as a trait object
}

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

fn main() { }