From 839170f2129664677358fe00d34e3a7958fdb908 Mon Sep 17 00:00:00 2001 From: Richo Healey <richo@psych0tik.net> Date: Thu, 4 Jun 2015 13:46:29 -0700 Subject: [PATCH] doc: Be more specific about how to box closures --- src/librustc/middle/ty.rs | 3 +-- src/test/compile-fail/issue-24036.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index a67a968ea2cf9..2028077d07311 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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")); } } _ => {} diff --git a/src/test/compile-fail/issue-24036.rs b/src/test/compile-fail/issue-24036.rs index 3c8a64eaf7de4..ef71c8c62c963 100644 --- a/src/test/compile-fail/issue-24036.rs +++ b/src/test/compile-fail/issue-24036.rs @@ -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() { @@ -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() { }