Skip to content

Commit 0b4da4a

Browse files
committed
Run cargo fmt
1 parent 2d4fd45 commit 0b4da4a

File tree

34 files changed

+517
-355
lines changed

34 files changed

+517
-355
lines changed

crates/cuda_std/src/atomic/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Raw CUDA-specific atomic functions that map to PTX instructions.
22
33
use crate::gpu_only;
4-
use core::concat;
54
use core::arch::asm;
5+
use core::concat;
66
use paste::paste;
77

88
#[gpu_only]

crates/cuda_std/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@
2525
#![cfg_attr(
2626
target_os = "cuda",
2727
no_std,
28-
feature(
29-
alloc_error_handler,
30-
asm_experimental_arch,
31-
link_llvm_intrinsics
32-
),
28+
feature(alloc_error_handler, asm_experimental_arch, link_llvm_intrinsics),
3329
register_attr(nvvm_internal)
3430
)]
3531

crates/optix/examples/ex02_pipeline/device/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(asm)]
12
#![cfg_attr(
23
target_os = "cuda",
34
no_std,

crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#![cfg_attr(
2-
target_os = "cuda",
3-
no_std,
4-
register_attr(nvvm_internal)
5-
)]
1+
#![cfg_attr(target_os = "cuda", no_std, register_attr(nvvm_internal))]
62
#![allow(non_snake_case, clippy::missing_safety_doc)]
73

84
use cuda_std::kernel;

crates/rustc_codegen_nvvm/build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ fn target_to_llvm_prebuilt(target: &str) -> String {
5555
"x86_64-pc-windows-msvc" => "windows-x86_64",
5656
// NOTE(RDambrosio016): currently disabled because of weird issues with segfaults and building the C++ shim
5757
// "x86_64-unknown-linux-gnu" => "linux-x86_64",
58-
_ => panic!("Unsupported target with no matching prebuilt LLVM: `{}`, install LLVM and set LLVM_CONFIG", target)
58+
_ => panic!(
59+
"Unsupported target with no matching prebuilt LLVM: `{}`, install LLVM and set LLVM_CONFIG",
60+
target
61+
),
5962
};
6063
format!("{}.tar.xz", base)
6164
}

crates/rustc_codegen_nvvm/src/abi.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
488488
}
489489
}
490490
}
491-
for arg in self.args.iter() {
491+
for arg in self.args.iter() {
492492
match &arg.mode {
493493
PassMode::Ignore => {}
494494
PassMode::Indirect {
@@ -518,7 +518,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
518518
apply(bx.cx, a);
519519
apply(bx.cx, b);
520520
}
521-
PassMode::Cast{ pad_i32, .. } => {
521+
PassMode::Cast { pad_i32, .. } => {
522522
if *pad_i32 {
523523
apply(bx.cx, &ArgAttributes::new());
524524
}
@@ -527,7 +527,6 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
527527
}
528528
}
529529
}
530-
531530
}
532531

533532
impl<'a, 'll, 'tcx> AbiBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {

crates/rustc_codegen_nvvm/src/asm.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ impl<'a, 'll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
134134
}
135135
}
136136
InlineAsmTemplatePiece::Placeholder {
137-
operand_idx,
138-
span,
139-
..
137+
operand_idx, span, ..
140138
} => {
141139
match operands[operand_idx] {
142140
InlineAsmOperandRef::In { .. }
@@ -158,7 +156,10 @@ impl<'a, 'll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
158156
// constraints.push("!i".to_owned());
159157
// labels.push(label);
160158

161-
self.tcx.sess.dcx().span_fatal(span, "Operands with label refs are unsupported");
159+
self.tcx
160+
.sess
161+
.dcx()
162+
.span_fatal(span, "Operands with label refs are unsupported");
162163
}
163164
}
164165
}

crates/rustc_codegen_nvvm/src/back.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ use libc::{c_char, size_t};
66
use rustc_codegen_ssa::back::write::{TargetMachineFactoryConfig, TargetMachineFactoryFn};
77
use rustc_codegen_ssa::traits::{DebugInfoCodegenMethods, MiscCodegenMethods};
88
use rustc_codegen_ssa::{
9+
CompiledModule, ModuleCodegen, ModuleKind,
910
back::write::{CodegenContext, ModuleConfig},
1011
base::maybe_create_entry_wrapper,
1112
mono_item::MonoItemExt,
1213
traits::{BaseTypeCodegenMethods, ThinBufferMethods},
13-
CompiledModule, ModuleCodegen, ModuleKind,
1414
};
1515
use rustc_errors::{DiagCtxtHandle, FatalError};
1616
use rustc_fs_util::path_to_c_string;
1717
use rustc_middle::bug;
1818
use rustc_middle::mir::mono::{MonoItem, MonoItemData};
1919
use rustc_middle::{dep_graph, ty::TyCtxt};
20-
use rustc_session::config::{self, DebugInfo, OutputType};
2120
use rustc_session::Session;
21+
use rustc_session::config::{self, DebugInfo, OutputType};
2222
use rustc_span::Symbol;
2323
use rustc_target::spec::{CodeModel, RelocModel};
2424

2525
use crate::common::AsCCharPtr;
2626
use crate::llvm::{self};
2727
use crate::override_fns::define_or_override_fn;
28-
use crate::{builder::Builder, context::CodegenCx, lto::ThinBuffer, LlvmMod, NvvmCodegenBackend};
28+
use crate::{LlvmMod, NvvmCodegenBackend, builder::Builder, context::CodegenCx, lto::ThinBuffer};
2929

3030
pub fn llvm_err(handle: DiagCtxtHandle, msg: &str) -> FatalError {
3131
match llvm::last_error() {
@@ -121,12 +121,7 @@ pub fn target_machine_factory(
121121
false,
122122
)
123123
};
124-
tm.ok_or_else(|| {
125-
format!(
126-
"Could not create LLVM TargetMachine for triple: {}",
127-
triple
128-
)
129-
})
124+
tm.ok_or_else(|| format!("Could not create LLVM TargetMachine for triple: {}", triple))
130125
})
131126
}
132127

@@ -199,8 +194,8 @@ pub(crate) unsafe fn codegen(
199194
.temp_path(OutputType::LlvmAssembly, module_name);
200195
let out = out.to_str().unwrap();
201196

202-
203-
let result = llvm::LLVMRustPrintModule(llmod, out.as_c_char_ptr(), out.len(), demangle_callback);
197+
let result =
198+
llvm::LLVMRustPrintModule(llmod, out.as_c_char_ptr(), out.len(), demangle_callback);
204199

205200
result.into_result().map_err(|()| {
206201
let msg = format!("failed to write NVVM IR to {}", out);
@@ -262,7 +257,15 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen
262257

263258
let mono_items = cx.codegen_unit.items_in_deterministic_order(cx.tcx);
264259

265-
for &(mono_item, MonoItemData { linkage, visibility, .. }) in &mono_items {
260+
for &(
261+
mono_item,
262+
MonoItemData {
263+
linkage,
264+
visibility,
265+
..
266+
},
267+
) in &mono_items
268+
{
266269
mono_item.predefine::<Builder<'_, '_, '_>>(&cx, linkage, visibility);
267270
}
268271

@@ -294,7 +297,10 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen
294297
cx.create_used_variable_impl(c"llvm.used", &*cx.used_statics.borrow());
295298
}
296299
if !cx.compiler_used_statics.borrow().is_empty() {
297-
cx.create_used_variable_impl(c"llvm.compiler.used", &*cx.compiler_used_statics.borrow());
300+
cx.create_used_variable_impl(
301+
c"llvm.compiler.used",
302+
&*cx.compiler_used_statics.borrow(),
303+
);
298304
}
299305

300306
// Finalize debuginfo

crates/rustc_codegen_nvvm/src/builder.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,11 +1185,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
11851185
unsafe { llvm::LLVMBuildVAArg(self.llbuilder, list, ty, unnamed()) }
11861186
}
11871187

1188-
pub(crate) fn call_intrinsic(
1189-
&mut self,
1190-
intrinsic: &str,
1191-
args: &[&'ll Value],
1192-
) -> &'ll Value {
1188+
pub(crate) fn call_intrinsic(&mut self, intrinsic: &str, args: &[&'ll Value]) -> &'ll Value {
11931189
let (ty, f) = self.cx.get_intrinsic(intrinsic);
11941190
self.call(ty, None, None, f, args, None, None)
11951191
}

crates/rustc_codegen_nvvm/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ impl AsCCharPtr for [u8] {
1616
fn as_c_char_ptr(&self) -> *const c_char {
1717
self.as_ptr().cast()
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)