Skip to content

Commit e67075e

Browse files
Rollup merge of rust-lang#57650 - AB1908:master, r=petrochenkov
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?
2 parents 8569848 + 1e3f475 commit e67075e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/librustc_metadata/native_libs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<'a, 'tcx> Collector<'a, 'tcx> {
163163
!self.tcx.features().static_nobundle {
164164
feature_gate::emit_feature_err(&self.tcx.sess.parse_sess,
165165
"static_nobundle",
166-
span.unwrap(),
166+
span.unwrap_or_else(|| syntax_pos::DUMMY_SP),
167167
GateIssue::Language,
168168
"kind=\"static-nobundle\" is feature gated");
169169
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//~ ERROR kind="static-nobundle" is feature gated
2+
// Test the behavior of rustc when non-existent library is statically linked
3+
4+
// compile-flags: -l static-nobundle=nonexistent
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
error[E0658]: kind="static-nobundle" is feature gated (see issue #37403)
2+
|
3+
= help: add #![feature(static_nobundle)] to the crate attributes to enable
4+
5+
error: aborting due to previous error
6+
7+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)