1
Fork 0

Squash closure cast error into fn ptr cast error

This commit is contained in:
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 2018-10-17 09:04:10 +02:00 committed by GitHub
commit 38f3ad41c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,14 +164,11 @@ fn check_rvalue(
}
}
Rvalue::Cast(CastKind::UnsafeFnPointer, _, _) |
Rvalue::Cast(CastKind::ClosureFnPointer, _, _) |
Rvalue::Cast(CastKind::ReifyFnPointer, _, _) => Err((
span,
"function pointer casts are not allowed in const fn".into(),
)),
Rvalue::Cast(CastKind::ClosureFnPointer, _, _) => Err((
span,
"closures are not allowed in const fn".into(),
)),
Rvalue::Cast(CastKind::Unsize, _, _) => Err((
span,
"unsizing casts are not allowed in const fn".into(),