Rename Session::span_diagnostic
as Session::dcx
.
This commit is contained in:
parent
9df1576e1d
commit
09af8a667c
66 changed files with 176 additions and 204 deletions
|
@ -143,7 +143,7 @@ pub fn link_binary<'a>(
|
|||
}
|
||||
}
|
||||
if sess.opts.json_artifact_notifications {
|
||||
sess.diagnostic().emit_artifact_notification(&out_filename, "link");
|
||||
sess.dcx().emit_artifact_notification(&out_filename, "link");
|
||||
}
|
||||
|
||||
if sess.prof.enabled() {
|
||||
|
@ -183,13 +183,13 @@ pub fn link_binary<'a>(
|
|||
|preserve_objects: bool, preserve_dwarf_objects: bool, module: &CompiledModule| {
|
||||
if !preserve_objects {
|
||||
if let Some(ref obj) = module.object {
|
||||
ensure_removed(sess.diagnostic(), obj);
|
||||
ensure_removed(sess.dcx(), obj);
|
||||
}
|
||||
}
|
||||
|
||||
if !preserve_dwarf_objects {
|
||||
if let Some(ref dwo_obj) = module.dwarf_object {
|
||||
ensure_removed(sess.diagnostic(), dwo_obj);
|
||||
ensure_removed(sess.dcx(), dwo_obj);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -208,7 +208,7 @@ pub fn link_binary<'a>(
|
|||
|
||||
// Remove the temporary files if output goes to stdout
|
||||
for temp in tempfiles_for_stdout_output {
|
||||
ensure_removed(sess.diagnostic(), &temp);
|
||||
ensure_removed(sess.dcx(), &temp);
|
||||
}
|
||||
|
||||
// If no requested outputs require linking, then the object temporaries should
|
||||
|
@ -933,7 +933,7 @@ fn link_natively<'a>(
|
|||
command: &cmd,
|
||||
escaped_output,
|
||||
};
|
||||
sess.diagnostic().emit_err(err);
|
||||
sess.dcx().emit_err(err);
|
||||
// If MSVC's `link.exe` was expected but the return code
|
||||
// is not a Microsoft LNK error then suggest a way to fix or
|
||||
// install the Visual Studio build tools.
|
||||
|
|
|
@ -558,7 +558,7 @@ fn produce_final_output_artifacts(
|
|||
}
|
||||
if !sess.opts.cg.save_temps && !keep_numbered {
|
||||
// The user just wants `foo.x`, not `foo.#module-name#.x`.
|
||||
ensure_removed(sess.diagnostic(), &path);
|
||||
ensure_removed(sess.dcx(), &path);
|
||||
}
|
||||
} else {
|
||||
let extension = crate_output
|
||||
|
@ -649,19 +649,19 @@ fn produce_final_output_artifacts(
|
|||
for module in compiled_modules.modules.iter() {
|
||||
if let Some(ref path) = module.object {
|
||||
if !keep_numbered_objects {
|
||||
ensure_removed(sess.diagnostic(), path);
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ref path) = module.dwarf_object {
|
||||
if !keep_numbered_objects {
|
||||
ensure_removed(sess.diagnostic(), path);
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ref path) = module.bytecode {
|
||||
if !keep_numbered_bitcode {
|
||||
ensure_removed(sess.diagnostic(), path);
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ fn produce_final_output_artifacts(
|
|||
if !user_wants_bitcode {
|
||||
if let Some(ref allocator_module) = compiled_modules.allocator_module {
|
||||
if let Some(ref path) = allocator_module.bytecode {
|
||||
ensure_removed(sess.diagnostic(), path);
|
||||
ensure_removed(sess.dcx(), path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1842,7 +1842,7 @@ impl SharedEmitterMain {
|
|||
|
||||
match message {
|
||||
Ok(SharedEmitterMessage::Diagnostic(diag)) => {
|
||||
let handler = sess.diagnostic();
|
||||
let handler = sess.dcx();
|
||||
let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msg);
|
||||
if let Some(code) = diag.code {
|
||||
d.code(code);
|
||||
|
|
|
@ -386,7 +386,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
[sym::arm, sym::a32] | [sym::arm, sym::t32] => {
|
||||
if !tcx.sess.target.has_thumb_interworking {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
tcx.sess.dcx(),
|
||||
attr.span,
|
||||
E0779,
|
||||
"target does not support `#[instruction_set]`"
|
||||
|
@ -403,7 +403,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
}
|
||||
_ => {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
tcx.sess.dcx(),
|
||||
attr.span,
|
||||
E0779,
|
||||
"invalid instruction set specified",
|
||||
|
@ -415,7 +415,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
}
|
||||
[] => {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
tcx.sess.dcx(),
|
||||
attr.span,
|
||||
E0778,
|
||||
"`#[instruction_set]` requires an argument"
|
||||
|
@ -425,7 +425,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
}
|
||||
_ => {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
tcx.sess.dcx(),
|
||||
attr.span,
|
||||
E0779,
|
||||
"cannot specify more than one instruction set"
|
||||
|
@ -443,7 +443,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
rustc_attr::parse_alignment(&literal.kind)
|
||||
.map_err(|msg| {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
tcx.sess.dcx(),
|
||||
attr.span,
|
||||
E0589,
|
||||
"invalid `repr(align)` attribute: {}",
|
||||
|
@ -469,27 +469,17 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
Some(MetaItemKind::List(ref items)) => {
|
||||
inline_span = Some(attr.span);
|
||||
if items.len() != 1 {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
attr.span,
|
||||
E0534,
|
||||
"expected one argument"
|
||||
)
|
||||
.emit();
|
||||
struct_span_err!(tcx.sess.dcx(), attr.span, E0534, "expected one argument")
|
||||
.emit();
|
||||
InlineAttr::None
|
||||
} else if list_contains_name(items, sym::always) {
|
||||
InlineAttr::Always
|
||||
} else if list_contains_name(items, sym::never) {
|
||||
InlineAttr::Never
|
||||
} else {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
items[0].span(),
|
||||
E0535,
|
||||
"invalid argument"
|
||||
)
|
||||
.help("valid inline arguments are `always` and `never`")
|
||||
.emit();
|
||||
struct_span_err!(tcx.sess.dcx(), items[0].span(), E0535, "invalid argument")
|
||||
.help("valid inline arguments are `always` and `never`")
|
||||
.emit();
|
||||
|
||||
InlineAttr::None
|
||||
}
|
||||
|
@ -503,7 +493,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
if !attr.has_name(sym::optimize) {
|
||||
return ia;
|
||||
}
|
||||
let err = |sp, s| struct_span_err!(tcx.sess.diagnostic(), sp, E0722, "{}", s).emit();
|
||||
let err = |sp, s| struct_span_err!(tcx.sess.dcx(), sp, E0722, "{}", s).emit();
|
||||
match attr.meta_kind() {
|
||||
Some(MetaItemKind::Word) => {
|
||||
err(attr.span, "expected one argument");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue