提交 9569c633 编写于 作者: J Jack Fransham

Avoid showing no-derivable-lifetime error message when there are no arguments

上级 a1a48c42
......@@ -234,7 +234,13 @@ fn report_elision_failure(
}
}
if !any_lifetimes {
if len == 0 {
fileline_help!(tcx.sess, default_span,
"this function's return type contains a borrowed value, but \
there is no value for it to be borrowed from");
fileline_help!(tcx.sess, default_span,
"consider giving it a 'static lifetime");
} else if !any_lifetimes {
fileline_help!(tcx.sess, default_span,
"this function's return type contains a borrowed value with \
an elided lifetime, but the lifetime cannot be derived from \
......@@ -247,12 +253,6 @@ fn report_elision_failure(
"this function's return type contains a borrowed value, but \
the signature does not say which {} it is borrowed from",
m);
} else if len == 0 {
fileline_help!(tcx.sess, default_span,
"this function's return type contains a borrowed value, but \
there is no value for it to be borrowed from");
fileline_help!(tcx.sess, default_span,
"consider giving it a 'static lifetime");
} else {
fileline_help!(tcx.sess, default_span,
"this function's return type contains a borrowed value, but \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册