librustc: Take in account mutability when casting array to raw ptr.

Fixes #14845.