Rollup merge of #100709 - JhonnyBillM:port-expected-used-symbol-diagnostic, r=compiler-errors
Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic` r? ``@davidtwco``
This commit is contained in:
commit
67f77f5a55
3 changed files with 10 additions and 6 deletions
|
@ -131,3 +131,5 @@ typeck_unused_extern_crate =
|
||||||
typeck_extern_crate_not_idiomatic =
|
typeck_extern_crate_not_idiomatic =
|
||||||
`extern crate` is not idiomatic in the new edition
|
`extern crate` is not idiomatic in the new edition
|
||||||
.suggestion = convert it to a `{$msg_code}`
|
.suggestion = convert it to a `{$msg_code}`
|
||||||
|
|
||||||
|
typeck_expected_used_symbol = expected `used`, `used(compiler)` or `used(linker)`
|
||||||
|
|
|
@ -2836,12 +2836,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
|
||||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED;
|
codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED;
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
tcx.sess
|
tcx.sess.emit_err(errors::ExpectedUsedSymbol { span: attr.span });
|
||||||
.struct_span_err(
|
|
||||||
attr.span,
|
|
||||||
"expected `used`, `used(compiler)` or `used(linker)`",
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
// Unfortunately, unconditionally using `llvm.used` causes
|
// Unfortunately, unconditionally using `llvm.used` causes
|
||||||
|
|
|
@ -340,3 +340,10 @@ pub struct ExternCrateNotIdiomatic {
|
||||||
pub msg_code: String,
|
pub msg_code: String,
|
||||||
pub suggestion_code: String,
|
pub suggestion_code: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(SessionDiagnostic)]
|
||||||
|
#[error(typeck::expected_used_symbol)]
|
||||||
|
pub struct ExpectedUsedSymbol {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue