diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-18 22:56:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-18 22:56:43 +0100 |
| commit | d2300afd6605843e79b9cb6bec1ebc752e8ba381 (patch) | |
| tree | 4152f8f278ce83f1a1c305754f08873b7c981870 | |
| parent | f63e3d2ef4da1b226ba2d0e3933d59a0641b2182 (diff) | |
| parent | 1e3f475d643603b9570710b13e20de587a22a5ea (diff) | |
| download | rust-d2300afd6605843e79b9cb6bec1ebc752e8ba381.tar.gz rust-d2300afd6605843e79b9cb6bec1ebc752e8ba381.zip | |
Rollup merge of #57650 - AB1908:master, r=petrochenkov
librustc_metadata: Pass a default value when unwrapping a span Fixes #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 #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?
| -rw-r--r-- | src/librustc_metadata/native_libs.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index d35d64957b7..1f00086e32f 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -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"); } diff --git a/src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs new file mode 100644 index 00000000000..92844f9306d --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs @@ -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() {} diff --git a/src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr new file mode 100644 index 00000000000..419c21901a0 --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr @@ -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`. |
