Skip to content

Give a nicer error for non-Unicode arguments to rustc and rustdoc #42092

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 19, 2017

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented May 18, 2017

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.

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 rust-lang#15890, although we still can't *compile* arbitrary file names.
@rust-highfive
Copy link
Contributor

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@Mark-Simulacrum
Copy link
Member

Seems like a clear improvement to me, thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented May 18, 2017

📌 Commit e86588e has been approved by Mark-Simulacrum

@bors
Copy link
Collaborator

bors commented May 19, 2017

⌛ Testing commit e86588e with merge 9963379...

@bors
Copy link
Collaborator

bors commented May 19, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member

@shepmaster shepmaster added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 19, 2017
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 19, 2017
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 rust-lang#15890, although we still can't *compile* arbitrary file names.
bors added a commit that referenced this pull request May 19, 2017
@bors bors merged commit e86588e into rust-lang:master May 19, 2017
@cuviper cuviper deleted the args_os branch September 26, 2017 06:39
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot compile a file in a non-utf8 directory
7 participants