Note why rust-call abi requires sized obl
This commit is contained in:
parent
b7095f5572
commit
b95ea45a60
2 changed files with 8 additions and 1 deletions
|
@ -2663,9 +2663,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
| ObligationCauseCode::LetElse
|
| ObligationCauseCode::LetElse
|
||||||
| ObligationCauseCode::BinOp { .. }
|
| ObligationCauseCode::BinOp { .. }
|
||||||
| ObligationCauseCode::AscribeUserTypeProvePredicate(..)
|
| ObligationCauseCode::AscribeUserTypeProvePredicate(..)
|
||||||
| ObligationCauseCode::RustCall
|
|
||||||
| ObligationCauseCode::DropImpl
|
| ObligationCauseCode::DropImpl
|
||||||
| ObligationCauseCode::ConstParam(_) => {}
|
| ObligationCauseCode::ConstParam(_) => {}
|
||||||
|
ObligationCauseCode::RustCall => {
|
||||||
|
if let Some(pred) = predicate.to_opt_poly_trait_pred()
|
||||||
|
&& Some(pred.def_id()) == self.tcx.lang_items().sized_trait()
|
||||||
|
{
|
||||||
|
err.note("argument required to be sized due to `extern \"rust-call\"` ABI");
|
||||||
|
}
|
||||||
|
}
|
||||||
ObligationCauseCode::SliceOrArrayElem => {
|
ObligationCauseCode::SliceOrArrayElem => {
|
||||||
err.note("slice and array elements must have `Sized` type");
|
err.note("slice and array elements must have `Sized` type");
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ LL | f(*slice);
|
||||||
|
|
|
|
||||||
= help: within `([u8],)`, the trait `Sized` is not implemented for `[u8]`
|
= help: within `([u8],)`, the trait `Sized` is not implemented for `[u8]`
|
||||||
= note: required because it appears within the type `([u8],)`
|
= note: required because it appears within the type `([u8],)`
|
||||||
|
= note: argument required to be sized due to `extern "rust-call"` ABI
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue