Skip to content

No diagnostic reported for non-primitive casts #17897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lnicola opened this issue Aug 15, 2024 · 1 comment · Fixed by #17984
Closed

No diagnostic reported for non-primitive casts #17897

lnicola opened this issue Aug 15, 2024 · 1 comment · Fixed by #17984
Assignees
Labels
A-diagnostics diagnostics / error reporting A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@lnicola
Copy link
Member

lnicola commented Aug 15, 2024

_ = ((), ()) as ();
@lnicola lnicola added A-ty type system / type inference / traits / method resolution C-bug Category: bug A-diagnostics diagnostics / error reporting labels Aug 15, 2024
@ShoyuVanilla
Copy link
Member

It seems that we aren't making any diagnostics here yet

pub(super) fn check(self, table: &mut InferenceTable<'_>) {
// FIXME: This function currently only implements the bits that influence the type
// inference. We should return the adjustments on success and report diagnostics on error.
let expr_ty = table.resolve_ty_shallow(&self.expr_ty);
let cast_ty = table.resolve_ty_shallow(&self.cast_ty);
if table.coerce(&expr_ty, &cast_ty).is_ok() {
return;
}
if check_ref_to_ptr_cast(expr_ty, cast_ty, table) {
// Note that this type of cast is actually split into a coercion to a
// pointer type and a cast:
// &[T; N] -> *[T; N] -> *T
}
// FIXME: Check other kinds of non-coercion casts and report error if any?
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants