The compiler knows that "hello" is five bytes long. However, there is no such thing as a sized string type in Rust. That is, the compiler has no way to encode this "five bytes" into a type. Note that &str doesn't say anything about the length.
Aside: arrays don't have this problem. You have sized types like [u8; 5] along with the dynamically sized [u8]. str doesn't have corresponding sized types.
The compiler is not complaining that a string doesn't have a length, it's complaining that the type itself doesn't have a length. For example, the compiler couldn't define a local variable of type str because... how much space would it reserve? It doesn't (and can't) know.
It's fine to have a reference to such types (like &str or Box<str>), but you can't ever have values of that type. By default, generics assume you want "sized" types (since that's overwhelmingly the case). If you want to also allow unsized types, you'd use T: ?Sized.
To illustrate further: there is a function to obtain the size of a type, std::mem::size_of. If you call size_of::<i32>() it will return 4. But there is no correct answer to size_of::<str>() because each instance ofstr has its own particular size. That's what “dynamically sized” means.