We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8819721 commit 4f0047eCopy full SHA for 4f0047e
compiler/rustc_middle/src/ty/sty.rs
@@ -2280,6 +2280,12 @@ impl<'tcx> TyS<'tcx> {
2280
///
2281
/// Returning true means the type is known to be sized. Returning
2282
/// `false` means nothing -- could be sized, might not be.
2283
+ ///
2284
+ /// Note that we could never rely on the fact that a type such as `[_]` is
2285
+ /// trivially `!Sized` because we could be in a type environment with a
2286
+ /// bound such as `[_]: Copy`. A function with such a bound obviously never
2287
+ /// can be called, but that doesn't mean it shouldn't typecheck. This is why
2288
+ /// this method doesn't return `Option<bool>`.
2289
pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx>) -> bool {
2290
match self.kind() {
2291
ty::Infer(ty::IntVar(_) | ty::FloatVar(_))
0 commit comments