Indexing into a slice relies on ptr::offset, which says that its UB to use an offset/index larger than isize::MAX. As documented by ptr::offset, "memory acquired directly from allocators or memory mapped files may be too large to handle with this function." Does that mean that e.g. memory mapping a file larger than isize::MAX into a slice is unsound, because safe code can cause UB just by indexing into it? Should the from_raw_parts docs tell callers that they need to check this?
Indexing into a slice relies on
ptr::offset, which says that its UB to use an offset/index larger thanisize::MAX. As documented byptr::offset, "memory acquired directly from allocators or memory mapped files may be too large to handle with this function." Does that mean that e.g. memory mapping a file larger thanisize::MAXinto a slice is unsound, because safe code can cause UB just by indexing into it? Should thefrom_raw_partsdocs tell callers that they need to check this?