@@ -71,24 +71,27 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
7171throw_unsup_format ! ( "Miri does not support file-backed memory mappings" ) ;
7272}
7373
74- // POSIX says:
75- // [ENOTSUP]
76- // * MAP_FIXED or MAP_PRIVATE was specified in the flags argument and the implementation
77- // does not support this functionality.
78- // * The implementation does not support the combination of accesses requested in the
79- // prot argument.
80- //
81- // Miri doesn't support MAP_FIXED or any any protections other than PROT_READ|PROT_WRITE.
82- if flags& map_fixed !=0 || prot != prot_read | prot_write{
83- this. set_last_error ( this. eval_libc ( "ENOTSUP" ) ) ?;
84- return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
74+ // Miri doesn't support MAP_FIXED.
75+ if flags& map_fixed !=0 {
76+ throw_unsup_format ! (
77+ "Miri does not support calls to mmap with MAP_FIXED as part of the flags argument" ,
78+ ) ;
79+ }
80+
81+ // Miri doesn't support protections other than PROT_READ|PROT_WRITE.
82+ if prot != prot_read | prot_write{
83+ throw_unsup_format ! (
84+ "Miri does not support calls to mmap with protections other than\
85+ PROT_READ|PROT_WRITE",
86+ ) ;
8587}
8688
8789// Miri does not support shared mappings, or any of the other extensions that for example
8890// Linux has added to the flags arguments.
8991if flags != map_private | map_anonymous{
9092throw_unsup_format ! (
91- "Miri only supports calls to mmap which set the flags argument to MAP_PRIVATE|MAP_ANONYMOUS"
93+ "Miri only supports calls to mmap which set the flags argument to\
94+ MAP_PRIVATE|MAP_ANONYMOUS",
9295) ;
9396}
9497