Skip to content

Commit c170048

Browse files
committed
what am I doing here?
1 parent 91e0cf4 commit c170048

File tree

8 files changed

+55
-55
lines changed

8 files changed

+55
-55
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ trait ArgAbiExt<'ll, 'tcx> {
189189
);
190190
}
191191

192-
impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
192+
impl<'ll: 'tcx, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
193193
/// Gets the LLVM type for a place of the original Rust type of
194194
/// this argument/return, i.e., the result of `type_of::type_of`.
195195
fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
@@ -287,7 +287,7 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
287287
}
288288
}
289289

290-
impl<'ll, 'tcx> ArgAbiBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
290+
impl<'ll: 'tcx, 'tcx> ArgAbiBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
291291
fn store_fn_arg(
292292
&mut self,
293293
arg_abi: &ArgAbi<'tcx, Ty<'tcx>>,
@@ -326,7 +326,7 @@ pub(crate) trait FnAbiLlvmExt<'ll, 'tcx> {
326326
fn apply_attrs_callsite(&self, bx: &mut Builder<'_, 'll, 'tcx>, callsite: &'ll Value);
327327
}
328328

329-
impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
329+
impl<'ll: 'tcx, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
330330
fn llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
331331
// Ignore "extra" args from the call site for C variadic functions.
332332
// Only the "fixed" args are part of the LLVM function signature.

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::type_of::LayoutLlvmExt;
2222
use crate::value::Value;
2323
use crate::{attributes, llvm};
2424

25-
impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
25+
impl<'ll: 'tcx, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
2626
fn codegen_inline_asm(
2727
&mut self,
2828
template: &[InlineAsmTemplatePiece],
@@ -452,8 +452,8 @@ impl<'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
452452
}
453453
}
454454

455-
pub(crate) fn inline_asm_call<'ll>(
456-
bx: &mut Builder<'_, 'll, '_>,
455+
pub(crate) fn inline_asm_call<'ll: 'tcx, 'tcx>(
456+
bx: &mut Builder<'_, 'll, 'tcx>,
457457
asm: &str,
458458
cons: &str,
459459
inputs: &[&'ll Value],
@@ -896,8 +896,8 @@ fn llvm_asm_scalar_type<'ll>(cx: &CodegenCx<'ll, '_>, scalar: Scalar) -> &'ll Ty
896896
}
897897
}
898898

899-
fn any_target_feature_enabled(
900-
cx: &CodegenCx<'_, '_>,
899+
fn any_target_feature_enabled<'ll: 'tcx, 'tcx>(
900+
cx: &CodegenCx<'ll, 'tcx>,
901901
instance: Instance<'_>,
902902
features: &[Symbol],
903903
) -> bool {
@@ -906,7 +906,7 @@ fn any_target_feature_enabled(
906906
}
907907

908908
/// Fix up an input value to work around LLVM bugs.
909-
fn llvm_fixup_input<'ll, 'tcx>(
909+
fn llvm_fixup_input<'ll: 'tcx, 'tcx>(
910910
bx: &mut Builder<'_, 'll, 'tcx>,
911911
mut value: &'ll Value,
912912
reg: InlineAsmRegClass,
@@ -1072,7 +1072,7 @@ fn llvm_fixup_input<'ll, 'tcx>(
10721072
}
10731073

10741074
/// Fix up an output value to work around LLVM bugs.
1075-
fn llvm_fixup_output<'ll, 'tcx>(
1075+
fn llvm_fixup_output<'ll: 'tcx, 'tcx>(
10761076
bx: &mut Builder<'_, 'll, 'tcx>,
10771077
mut value: &'ll Value,
10781078
reg: InlineAsmRegClass,
@@ -1219,7 +1219,7 @@ fn llvm_fixup_output<'ll, 'tcx>(
12191219
}
12201220

12211221
/// Output type to use for llvm_fixup_output.
1222-
fn llvm_fixup_output_type<'ll, 'tcx>(
1222+
fn llvm_fixup_output_type<'ll: 'tcx, 'tcx>(
12231223
cx: &CodegenCx<'ll, 'tcx>,
12241224
reg: InlineAsmRegClass,
12251225
layout: &TyAndLayout<'tcx>,

compiler/rustc_codegen_llvm/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub(crate) fn compile_codegen_unit(
7373
// the time we needed for codegenning it.
7474
let cost = time_to_codegen.as_nanos() as u64;
7575

76-
fn module_codegen(tcx: TyCtxt<'_>, cgu_name: Symbol) -> ModuleCodegen<ModuleLlvm> {
76+
fn module_codegen<'ll: 'tcx, 'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> ModuleCodegen<ModuleLlvm> {
7777
let cgu = tcx.codegen_unit(cgu_name);
7878
let _prof_timer =
7979
tcx.prof.generic_activity_with_arg_recorder("codegen_module", |recorder| {
@@ -86,7 +86,7 @@ pub(crate) fn compile_codegen_unit(
8686
let cx = CodegenCx::new(tcx, cgu, &llvm_module);
8787
let mono_items = cx.codegen_unit.items_in_deterministic_order(cx.tcx);
8888
for &(mono_item, data) in &mono_items {
89-
mono_item.predefine::<Builder<'_, '_, '_>>(&cx, data.linkage, data.visibility);
89+
mono_item.predefine::<Builder<'_, 'll, 'tcx>>(&cx, data.linkage, data.visibility);
9090
}
9191

9292
// ... and now that we have everything pre-defined, fill out those definitions.

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(crate) struct GenericBuilder<'a, 'll, CX: Borrow<SimpleCx<'ll>>> {
6666
pub cx: &'a CX,
6767
}
6868

69-
pub(crate) type Builder<'a, 'll, 'tcx> = GenericBuilder<'a, 'll, CodegenCx<'ll, 'tcx>>;
69+
pub(crate) type Builder<'a, 'll: 'tcx, 'tcx> = GenericBuilder<'a, 'll, CodegenCx<'ll, 'tcx>>;
7070

7171
impl<'a, 'll, CX: Borrow<SimpleCx<'ll>>> Drop for GenericBuilder<'a, 'll, CX> {
7272
fn drop(&mut self) {
@@ -189,7 +189,7 @@ impl<'a, 'll> SBuilder<'a, 'll> {
189189
// FIXME(eddyb) pass `&CStr` directly to FFI once it's a thin pointer.
190190
const UNNAMED: *const c_char = c"".as_ptr();
191191

192-
impl<'ll, 'tcx> BackendTypes for Builder<'_, 'll, 'tcx> {
192+
impl<'ll: 'tcx, 'tcx> BackendTypes for Builder<'_, 'll, 'tcx> {
193193
type Value = <CodegenCx<'ll, 'tcx> as BackendTypes>::Value;
194194
type Metadata = <CodegenCx<'ll, 'tcx> as BackendTypes>::Metadata;
195195
type Function = <CodegenCx<'ll, 'tcx> as BackendTypes>::Function;
@@ -247,7 +247,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
247247
}
248248
}
249249

250-
impl<'ll, 'tcx> Deref for Builder<'_, 'll, 'tcx> {
250+
impl<'ll: 'tcx, 'tcx> Deref for Builder<'_, 'll, 'tcx> {
251251
type Target = CodegenCx<'ll, 'tcx>;
252252

253253
#[inline]
@@ -279,7 +279,7 @@ macro_rules! set_math_builder_methods {
279279
}
280280

281281
//impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
282-
impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for GenericBuilder<'a, 'll, CodegenCx<'ll, 'tcx>> {
282+
impl<'a, 'll: 'tcx, 'tcx> BuilderMethods<'a, 'tcx> for GenericBuilder<'a, 'll, CodegenCx<'ll, 'tcx>> {
283283
type CodegenCx = CodegenCx<'ll, 'tcx>;
284284

285285
fn build(cx: &'a CodegenCx<'ll, 'tcx>, llbb: &'ll BasicBlock) -> Self {
@@ -1347,14 +1347,14 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for GenericBuilder<'a, 'll, Codegen
13471347
}
13481348
}
13491349

1350-
impl<'ll> StaticBuilderMethods for Builder<'_, 'll, '_> {
1350+
impl<'ll: 'tcx, 'tcx> StaticBuilderMethods for Builder<'_, 'll, 'tcx> {
13511351
fn get_static(&mut self, def_id: DefId) -> &'ll Value {
13521352
// Forward to the `get_static` method of `CodegenCx`
13531353
self.cx().get_static(def_id)
13541354
}
13551355
}
13561356

1357-
impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1357+
impl<'a, 'll: 'tcx, 'tcx> Builder<'a, 'll, 'tcx> {
13581358
fn with_cx(cx: &'a CodegenCx<'ll, 'tcx>) -> Self {
13591359
// Create a fresh builder from the crate context.
13601360
let llbuilder = unsafe { llvm::LLVMCreateBuilderInContext(cx.llcx) };

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use crate::type_of::LayoutLlvmExt;
2626
use crate::va_arg::emit_va_arg;
2727
use crate::value::Value;
2828

29-
fn get_simple_intrinsic<'ll>(
30-
cx: &CodegenCx<'ll, '_>,
29+
fn get_simple_intrinsic<'ll: 'tcx, 'tcx>(
30+
cx: &CodegenCx<'ll, 'tcx>,
3131
name: Symbol,
3232
) -> Option<(&'ll Type, &'ll Value)> {
3333
let llvm_name = match name {
@@ -153,7 +153,7 @@ fn get_simple_intrinsic<'ll>(
153153
Some(cx.get_intrinsic(llvm_name))
154154
}
155155

156-
impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
156+
impl<'ll: 'tcx, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
157157
fn codegen_intrinsic_call(
158158
&mut self,
159159
instance: ty::Instance<'tcx>,
@@ -677,8 +677,8 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
677677
}
678678
}
679679

680-
fn catch_unwind_intrinsic<'ll>(
681-
bx: &mut Builder<'_, 'll, '_>,
680+
fn catch_unwind_intrinsic<'a, 'll: 'tcx, 'tcx>(
681+
bx: &mut Builder<'a, 'll, 'tcx>,
682682
try_func: &'ll Value,
683683
data: &'ll Value,
684684
catch_func: &'ll Value,
@@ -709,8 +709,8 @@ fn catch_unwind_intrinsic<'ll>(
709709
// instructions are meant to work for all targets, as of the time of this
710710
// writing, however, LLVM does not recommend the usage of these new instructions
711711
// as the old ones are still more optimized.
712-
fn codegen_msvc_try<'ll>(
713-
bx: &mut Builder<'_, 'll, '_>,
712+
fn codegen_msvc_try<'a, 'll: 'tcx, 'tcx> (
713+
bx: &mut Builder<'a, 'll, 'tcx>,
714714
try_func: &'ll Value,
715715
data: &'ll Value,
716716
catch_func: &'ll Value,
@@ -856,8 +856,8 @@ fn codegen_msvc_try<'ll>(
856856
}
857857

858858
// WASM's definition of the `rust_try` function.
859-
fn codegen_wasm_try<'ll>(
860-
bx: &mut Builder<'_, 'll, '_>,
859+
fn codegen_wasm_try<'ll: 'tcx, 'tcx>(
860+
bx: &mut Builder<'_, 'll, 'tcx>,
861861
try_func: &'ll Value,
862862
data: &'ll Value,
863863
catch_func: &'ll Value,
@@ -940,8 +940,8 @@ fn codegen_wasm_try<'ll>(
940940
// function calling it, and that function may already have other personality
941941
// functions in play. By calling a shim we're guaranteed that our shim will have
942942
// the right personality function.
943-
fn codegen_gnu_try<'ll>(
944-
bx: &mut Builder<'_, 'll, '_>,
943+
fn codegen_gnu_try<'ll: 'tcx, 'tcx>(
944+
bx: &mut Builder<'_, 'll, 'tcx>,
945945
try_func: &'ll Value,
946946
data: &'ll Value,
947947
catch_func: &'ll Value,
@@ -999,8 +999,8 @@ fn codegen_gnu_try<'ll>(
999999
// Variant of codegen_gnu_try used for emscripten where Rust panics are
10001000
// implemented using C++ exceptions. Here we use exceptions of a specific type
10011001
// (`struct rust_panic`) to represent Rust panics.
1002-
fn codegen_emcc_try<'ll>(
1003-
bx: &mut Builder<'_, 'll, '_>,
1002+
fn codegen_emcc_try<'ll: 'tcx, 'tcx>(
1003+
bx: &mut Builder<'_, 'll, 'tcx>,
10041004
try_func: &'ll Value,
10051005
data: &'ll Value,
10061006
catch_func: &'ll Value,
@@ -1081,7 +1081,7 @@ fn codegen_emcc_try<'ll>(
10811081

10821082
// Helper function to give a Block to a closure to codegen a shim function.
10831083
// This is currently primarily used for the `try` intrinsic functions above.
1084-
fn gen_fn<'ll, 'tcx>(
1084+
fn gen_fn<'ll: 'tcx, 'tcx>(
10851085
cx: &CodegenCx<'ll, 'tcx>,
10861086
name: &str,
10871087
rust_fn_sig: ty::PolyFnSig<'tcx>,
@@ -1104,7 +1104,7 @@ fn gen_fn<'ll, 'tcx>(
11041104
// catch exceptions.
11051105
//
11061106
// This function is only generated once and is then cached.
1107-
fn get_rust_try_fn<'ll, 'tcx>(
1107+
fn get_rust_try_fn<'ll: 'tcx, 'tcx>(
11081108
cx: &CodegenCx<'ll, 'tcx>,
11091109
codegen: &mut dyn FnMut(Builder<'_, 'll, 'tcx>),
11101110
) -> (&'ll Type, &'ll Value) {
@@ -1150,7 +1150,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
11501150
rust_try
11511151
}
11521152

1153-
fn generic_simd_intrinsic<'ll, 'tcx>(
1153+
fn generic_simd_intrinsic<'ll: 'tcx, 'tcx>(
11541154
bx: &mut Builder<'_, 'll, 'tcx>,
11551155
name: Symbol,
11561156
callee_ty: Ty<'tcx>,
@@ -1518,7 +1518,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
15181518
}
15191519
}
15201520

1521-
fn simd_simple_float_intrinsic<'ll, 'tcx>(
1521+
fn simd_simple_float_intrinsic<'ll: 'tcx, 'tcx>(
15221522
name: Symbol,
15231523
in_elem: Ty<'_>,
15241524
in_ty: Ty<'_>,
@@ -1634,7 +1634,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
16341634
}
16351635
}
16361636

1637-
fn llvm_vector_ty<'ll>(cx: &CodegenCx<'ll, '_>, elem_ty: Ty<'_>, vec_len: u64) -> &'ll Type {
1637+
fn llvm_vector_ty<'ll: 'tcx, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, elem_ty: Ty<'_>, vec_len: u64) -> &'ll Type {
16381638
let elem_ty = match *elem_ty.kind() {
16391639
ty::Int(v) => cx.type_int_from_ty(v),
16401640
ty::Uint(v) => cx.type_uint_from_ty(v),

compiler/rustc_codegen_llvm/src/type_.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl fmt::Debug for Type {
3535
}
3636
}
3737

38-
impl<'ll> CodegenCx<'ll, '_> {}
38+
//impl<'ll> CodegenCx<'ll, 'tcx> {}
3939
impl<'ll> SimpleCx<'ll> {
4040
pub(crate) fn type_named_struct(&self, name: &str) -> &'ll Type {
4141
let name = SmallCStr::new(name);
@@ -75,7 +75,7 @@ impl<'ll> SimpleCx<'ll> {
7575
}
7676
}
7777
}
78-
impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
78+
impl<'ll: 'tcx, 'tcx> CodegenCx<'ll, 'tcx> {
7979
pub(crate) fn type_bool(&self) -> &'ll Type {
8080
self.type_i8()
8181
}
@@ -142,7 +142,7 @@ impl<'ll> SimpleCx<'ll> {
142142
}
143143
}
144144

145-
impl<'ll, 'tcx> BaseTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
145+
impl<'ll: 'tcx, 'tcx> BaseTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
146146
fn type_i8(&self) -> &'ll Type {
147147
unsafe { llvm::LLVMInt8TypeInContext(self.llcx) }
148148
}
@@ -246,7 +246,7 @@ impl Type {
246246
}
247247
}
248248

249-
impl<'ll, 'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
249+
impl<'ll: 'tcx, 'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
250250
fn backend_type(&self, layout: TyAndLayout<'tcx>) -> &'ll Type {
251251
layout.llvm_type(self)
252252
}
@@ -281,7 +281,7 @@ impl<'ll, 'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
281281
}
282282
}
283283

284-
impl<'ll, 'tcx> TypeMembershipCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
284+
impl<'ll: 'tcx, 'tcx> TypeMembershipCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
285285
fn add_type_metadata(&self, function: &'ll Value, typeid: String) {
286286
let typeid_metadata = self.typeid_metadata(typeid).unwrap();
287287
unsafe {

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use tracing::debug;
1212
use crate::common::*;
1313
use crate::type_::Type;
1414

15-
fn uncached_llvm_type<'a, 'tcx>(
15+
fn uncached_llvm_type<'a: 'tcx, 'tcx>(
1616
cx: &CodegenCx<'a, 'tcx>,
1717
layout: TyAndLayout<'tcx>,
1818
defer: &mut Option<(&'a Type, TyAndLayout<'tcx>)>,
@@ -80,7 +80,7 @@ fn uncached_llvm_type<'a, 'tcx>(
8080
}
8181
}
8282

83-
fn struct_llfields<'a, 'tcx>(
83+
fn struct_llfields<'a: 'tcx, 'tcx>(
8484
cx: &CodegenCx<'a, 'tcx>,
8585
layout: TyAndLayout<'tcx>,
8686
) -> (Vec<&'a Type>, bool) {
@@ -139,7 +139,7 @@ fn struct_llfields<'a, 'tcx>(
139139
(result, packed)
140140
}
141141

142-
impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
142+
impl<'a: 'tcx, 'tcx> CodegenCx<'a, 'tcx> {
143143
pub(crate) fn align_of(&self, ty: Ty<'tcx>) -> Align {
144144
self.layout_of(ty).align.abi
145145
}

0 commit comments

Comments
 (0)