Skip to content

Commit 0ff6d48

Browse files
committed
save work
1 parent 11c2a4c commit 0ff6d48

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

crates/rustc_codegen_nvvm/src/back.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_codegen_ssa::{
1313
CompiledModule, ModuleCodegen, ModuleKind,
1414
};
1515
use rustc_data_structures::small_c_str::SmallCStr;
16-
use rustc_errors::{FatalError, Handler};
16+
use rustc_errors::{FatalError, Handler, DiagnosticMessage, DiagnosticBuilder};
1717
use rustc_fs_util::path_to_c_string;
1818
use rustc_middle::bug;
1919
use rustc_middle::mir::mono::MonoItem;
@@ -22,6 +22,7 @@ use rustc_session::config::{self, DebugInfo, OutputType};
2222
use rustc_session::Session;
2323
use rustc_span::Symbol;
2424
use rustc_target::spec::{CodeModel, RelocModel};
25+
use std::convert::TryFrom;
2526
use std::ffi::CString;
2627
use std::sync::Arc;
2728
use std::{
@@ -31,7 +32,7 @@ use std::{
3132

3233
pub fn llvm_err(handler: &Handler, msg: &str) -> FatalError {
3334
match llvm::last_error() {
34-
Some(err) => handler.fatal(&format!("{}: {}", msg, err)),
35+
Some(err) => handler.fatal(format!("{}: {}", msg, err)),
3536
None => handler.fatal(msg),
3637
}
3738
}
@@ -220,7 +221,7 @@ pub(crate) unsafe fn codegen(
220221

221222
if let Err(e) = std::fs::write(&out, data) {
222223
let msg = format!("failed to write bytecode to {}: {}", out.display(), e);
223-
diag_handler.err(&msg);
224+
diag_handler.err(msg);
224225
}
225226

226227
Ok(CompiledModule {
@@ -387,7 +388,7 @@ pub(crate) unsafe fn optimize(
387388

388389
for pass in &config.passes {
389390
if !addpass(pass) {
390-
diag_handler.warn(&format!("unknown pass `{}`, ignoring", pass));
391+
diag_handler.warn(format!("unknown pass `{}`, ignoring", pass));
391392
}
392393
}
393394

crates/rustc_codegen_nvvm/src/debug_info/create_scope_map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::context::CodegenCx;
66
use crate::llvm;
77
use crate::llvm::debuginfo::{DILocation, DIScope};
88
use rustc_middle::mir::{Body, SourceScope};
9-
use rustc_middle::ty::{self, Instance};
9+
use rustc_middle::ty::{self, Instance, EarlyBinder};
1010
use rustc_session::config::DebugInfo;
1111

1212
use rustc_index::bit_set::BitSet;
@@ -110,7 +110,7 @@ fn make_mir_scope<'ll, 'tcx>(
110110
let callee = cx.tcx.subst_and_normalize_erasing_regions(
111111
instance.substs,
112112
ty::ParamEnv::reveal_all(),
113-
callee,
113+
EarlyBinder::bind(callee),
114114
);
115115
let callee_fn_abi = cx.fn_abi_of_instance(callee, ty::List::empty());
116116
cx.dbg_scope_fn(callee, callee_fn_abi, None)

crates/rustc_codegen_nvvm/src/debug_info/metadata.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
77
use rustc_hir::def::CtorKind;
88
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
99
use rustc_index::vec::{Idx, IndexVec};
10+
use rustc_abi::FieldIdx;
1011
use rustc_middle::mir::{self, GeneratorLayout};
1112
use rustc_middle::ty::layout::{self, IntegerExt, LayoutOf, PrimitiveExt, TyAndLayout};
1213
use rustc_middle::ty::subst::GenericArgKind;
@@ -1212,7 +1213,7 @@ fn closure_saved_names_of_captured_variables(tcx: TyCtxt<'_>, def_id: DefId) ->
12121213
.iter()
12131214
.filter_map(|var| {
12141215
let is_ref = match var.value {
1215-
mir::VarDebugInfoContents::Place(place) if place.local == mir::Local::new(1) => {
1216+
mir::VarDebugInfoContents::Place(place) if place.local == rustc_middle::mir::Local::new(1) => {
12161217
// The projection is either `[.., Field, Deref]` or `[.., Field]`. It
12171218
// implies whether the variable is captured by value or by reference.
12181219
matches!(place.projection.last().unwrap(), mir::ProjectionElem::Deref)
@@ -1676,7 +1677,7 @@ impl<'tcx> VariantInfo<'_, 'tcx> {
16761677
fn field_name(&self, i: usize, cx: &CodegenCx<'_, 'tcx>) -> String {
16771678
let field_name = match *self {
16781679
VariantInfo::Adt(variant) if variant.ctor_kind() != Some(CtorKind::Fn) => {
1679-
Some(variant.fields[i].ident(cx.tcx).name)
1680+
Some(variant.fields[FieldIdx::from_usize(i)].ident(cx.tcx).name)
16801681
}
16811682
VariantInfo::Generator {
16821683
generator_layout,

crates/rustc_codegen_nvvm/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ impl WriteBackendMethods for NvvmCodegenBackend {
256256
}
257257
}
258258

259+
type TargetMachineError; // idk wtf im supposed to do with this but ill fix later
260+
259261
// fn run_lto_pass_manager(
260262
// _: &CodegenContext<Self>,
261263
// _: &ModuleCodegen<Self::Module>,

crates/rustc_codegen_nvvm/src/link.rs

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ impl fmt::Debug for NvvmMetadataLoader {
3636
write!(f, "Placeholder until i know what to put here...: {}", self)
3737
}
3838
}
39+
40+
impl fmt::Display for NvvmMetadataLoader {
41+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
42+
write!(f, "Placeholder until i know what to put here...: {}", self)
43+
}
44+
}
3945
impl MetadataLoader for NvvmMetadataLoader {
4046
fn get_rlib_metadata(&self, _target: &Target,
4147
filename: &Path) -> Result<OwnedSlice, String> {

crates/rustc_codegen_nvvm/src/mono_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl<'ll, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> {
4141
.unwrap_or_else(|| {
4242
self.sess().span_fatal(
4343
self.tcx.def_span(def_id),
44-
&format!("symbol `{}` is already defined", symbol_name),
44+
format!("symbol `{}` is already defined", symbol_name),
4545
)
4646
});
4747

0 commit comments

Comments
 (0)