]> git.lizzy.rs Git - rust.git/commit
Give a nicer error for non-Unicode arguments to rustc and rustdoc
authorJosh Stone <jistone@redhat.com>
Thu, 18 May 2017 23:11:22 +0000 (16:11 -0700)
committerJosh Stone <jistone@redhat.com>
Thu, 18 May 2017 23:11:22 +0000 (16:11 -0700)
commite86588e2286ac2c0fb4763bf2d8c3046d0abcc22
tree3c690d41d83eca466d9d0faba0f46badd72b5c70
parent0ed1ec9f9eb8174273867343d01177b5ac13ff4c
Give a nicer error for non-Unicode arguments to rustc and rustdoc

Previously, any non-Unicode argument would panic rustc:

```
$ rustc $'foo\x80bar'
error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report:
https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value:
"foo�bar"', /checkout/src/libcore/result.rs:859 note: Run with
`RUST_BACKTRACE=1` for a backtrace.
```

Now it gives a clean error:

```
$ rustc $'foo\x80bar'
error: Argument 1 is not valid Unicode: "foo�bar"
```

Maybe fixes #15890, although we still can't *compile* arbitrary file names.
src/librustc_driver/lib.rs
src/librustdoc/lib.rs