mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Rollup merge of #97328 - petrochenkov:nativice, r=michaelwoerister
rustc: Fix ICE in native library error reporting Fixes https://github.com/rust-lang/rust/issues/97299
This commit is contained in:
@@ -383,10 +383,11 @@ fn process_command_line(&mut self) {
|
||||
// involved or not, library reordering and kind overriding without
|
||||
// explicit `:rename` in particular.
|
||||
if lib.has_modifiers() || passed_lib.has_modifiers() {
|
||||
self.tcx.sess.span_err(
|
||||
self.tcx.def_span(lib.foreign_module.unwrap()),
|
||||
"overriding linking modifiers from command line is not supported"
|
||||
);
|
||||
let msg = "overriding linking modifiers from command line is not supported";
|
||||
match lib.foreign_module {
|
||||
Some(def_id) => self.tcx.sess.span_err(self.tcx.def_span(def_id), msg),
|
||||
None => self.tcx.sess.err(msg),
|
||||
};
|
||||
}
|
||||
if passed_lib.kind != NativeLibKind::Unspecified {
|
||||
lib.kind = passed_lib.kind;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Regression test for issue #97299, one command line library with modifiers
|
||||
// overrides another command line library with modifiers.
|
||||
|
||||
// compile-flags:-lstatic:+whole-archive=foo -lstatic:+whole-archive=foo
|
||||
// error-pattern: overriding linking modifiers from command line is not supported
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,4 @@
|
||||
error: overriding linking modifiers from command line is not supported
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Reference in New Issue
Block a user