You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 820b200
Browse filesBrowse the repository at this point in the historyBrowse files
Rollup merge of #165725 - RalfJung:target-modifier-error, r=mati865
change target modifier errors to use the diagnostic APIs instead of structs
This deduplicates a bunch of strings that were previously duplicated across three strict types.
Copy file name to clipboardExpand all lines: compiler/rustc_metadata/src/creader.rs
+62-29Lines changed: 62 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -380,6 +380,11 @@ impl CStore {
380
380
}
381
381
let extern_crate = data.name();
382
382
383
+
let emit = |mutdiag: rustc_errors::Diag<'_>| {
384
+
diag.help(format!("if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={opt_name}` to silence this {}", diag.level()));
385
+
diag.emit();
386
+
};
387
+
383
388
if prefix.is_empty(){
384
389
// A synthetic target modifier, does not correspond to an actual flag.
385
390
match opt_name.as_str(){
@@ -426,8 +431,7 @@ impl CStore {
426
431
let after = if extern_features.len() == 1{"is"}else{"are"};
427
432
diag.help(format!("the target {before} {features} {after} enabled in `{extern_crate}` but disabled in this crate"));
428
433
}
429
-
diag.help("if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=target-feature` to silence this warning");
430
-
diag.emit();
434
+
emit(diag);
431
435
}
432
436
"codegen-backend-name" => {
433
437
let diag = format!(
@@ -436,50 +440,79 @@ impl CStore {
436
440
letmut diag = tcx.dcx().struct_err(diag);
437
441
diag.help("this crate has `-Zllvm-target-feature` set, which means different codegen backends could interpret the target features differently, or ignore them entirely");
438
442
diag.help("some target features modify the ABI so Rust crates compiled with different target features cannot be used together safely");
439
-
diag.help("if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=codegen-backend-name` to silence this warning");
Copy file name to clipboardExpand all lines: tests/ui-fulldeps/codegen-backend/llvm-target-features.stderr
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ error: mixing codegen backends while using backend-specific target features may
2
2
|
3
3
= help: this crate has `-Zllvm-target-feature` set, which means different codegen backends could interpret the target features differently, or ignore them entirely
4
4
= help: some target features modify the ABI so Rust crates compiled with different target features cannot be used together safely
5
-
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=codegen-backend-name` to silence this warning
5
+
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=codegen-backend-name` to silence this error
0 commit comments