mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-21 04:03:11 +00:00
rollup merge of #18409 : gamazeps/issue15273
This commit is contained in:
commit
ce63fbc7bd
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
@ -282,7 +282,9 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
}
|
||||
_ => {
|
||||
span_err!(self.tcx().sess, reason.span(self.tcx()), E0100,
|
||||
"cannot coerce non-statically resolved bare fn");
|
||||
"cannot coerce non-statically resolved bare fn to closure");
|
||||
span_help!(self.tcx().sess, reason.span(self.tcx()),
|
||||
"consider embedding the function in a closure");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,13 @@ macro_rules! span_note(
|
||||
})
|
||||
)
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! span_help(
|
||||
($session:expr, $span:expr, $($message:tt)*) => ({
|
||||
($session).span_help($span, format!($($message)*).as_slice())
|
||||
})
|
||||
)
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! register_diagnostics(
|
||||
($($code:tt),*) => (
|
||||
|
@ -13,7 +13,9 @@ fn foo() {}
|
||||
fn main() {
|
||||
let f = foo;
|
||||
let f_closure: || = f;
|
||||
//~^ ERROR: cannot coerce non-statically resolved bare fn
|
||||
//~^ ERROR: cannot coerce non-statically resolved bare fn to closure
|
||||
//~^ HELP: consider embedding the function in a closure
|
||||
let f_proc: proc() = f;
|
||||
//~^ ERROR: cannot coerce non-statically resolved bare fn
|
||||
//~^ ERROR: cannot coerce non-statically resolved bare fn to closure
|
||||
//~^ HELP: consider embedding the function in a closure
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user