Skip to content

Commit

Permalink
Rollup merge of rust-lang#57650 - AB1908:master, r=petrochenkov
Browse files Browse the repository at this point in the history
librustc_metadata: Pass a default value when unwrapping a span

Fixes rust-lang#57323.

When compiling with `static-nobundle` a-la

`rustc -l static-nobundle=nonexistent main.rs`

we now get a neat output in the form of:

```
error[E0658]: kind="static-nobundle" is feature gated (see issue rust-lang#37403)
  |
  = help: add #![feature(static_nobundle)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
```
The build and tests completed successfully on my machine. Should I be adding a new test?
  • Loading branch information
GuillaumeGomez committed Jan 18, 2019
2 parents 8569848 + 1e3f475 commit e67075e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_metadata/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<'a, 'tcx> Collector<'a, 'tcx> {
!self.tcx.features().static_nobundle {
feature_gate::emit_feature_err(&self.tcx.sess.parse_sess,
"static_nobundle",
span.unwrap(),
span.unwrap_or_else(|| syntax_pos::DUMMY_SP),
GateIssue::Language,
"kind=\"static-nobundle\" is feature gated");
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//~ ERROR kind="static-nobundle" is feature gated
// Test the behavior of rustc when non-existent library is statically linked

// compile-flags: -l static-nobundle=nonexistent

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error[E0658]: kind="static-nobundle" is feature gated (see issue #37403)
|
= help: add #![feature(static_nobundle)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.

0 comments on commit e67075e

Please sign in to comment.