auto merge of #19303 : nodakai/rust/libsyntax-reject-dirs, r=alexcrichton
On *BSD systems, we can `open(2)` a directory and directly `read(2)` from it due to an old tradition. We should avoid doing so by explicitly calling `fstat(2)` to check the type of the opened file. Opening a directory as a module file can't always be avoided. Even when there's no "path" attribute trick involved, there can always be a *directory* named `my_module.rs`. Incidentally, remove unnecessary mutability of `&self` from `io::fs::File::stat()`.
This commit is contained in:
commit
361baabb07
3 changed files with 25 additions and 13 deletions
|
|
@ -18,9 +18,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-freebsd FIXME #12460
|
||||
|
||||
#[path = "../compile-fail"]
|
||||
mod foo; //~ ERROR: illegal operation on a directory
|
||||
mod foo; //~ ERROR: a directory
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue