Add a comment on is_trivially_sized about obviously !Sized types
This commit is contained in:
parent
88197214b8
commit
4f0047ed10
1 changed files with 6 additions and 0 deletions
|
@ -2280,6 +2280,12 @@ impl<'tcx> TyS<'tcx> {
|
|||
///
|
||||
/// Returning true means the type is known to be sized. Returning
|
||||
/// `false` means nothing -- could be sized, might not be.
|
||||
///
|
||||
/// Note that we could never rely on the fact that a type such as `[_]` is
|
||||
/// trivially `!Sized` because we could be in a type environment with a
|
||||
/// bound such as `[_]: Copy`. A function with such a bound obviously never
|
||||
/// can be called, but that doesn't mean it shouldn't typecheck. This is why
|
||||
/// this method doesn't return `Option<bool>`.
|
||||
pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx>) -> bool {
|
||||
match self.kind() {
|
||||
ty::Infer(ty::IntVar(_) | ty::FloatVar(_))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue