Skip to content

Commit 34a5701

Browse files
committed
Revert "Create a safe wrapper around LLVMRustDIBuilderCreateTemplateTypeParameter"
This reverts commit eef70a9.
1 parent 3c67bc4 commit 34a5701

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,16 @@ fn build_generic_type_param_di_nodes<'ll, 'tcx>(
12981298
kind.as_type().map(|ty| {
12991299
let actual_type = cx.tcx.normalize_erasing_regions(cx.typing_env(), ty);
13001300
let actual_type_di_node = type_di_node(cx, actual_type);
1301-
cx.create_template_type_parameter(name.as_str(), actual_type_di_node)
1301+
let name = name.as_str();
1302+
unsafe {
1303+
llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
1304+
DIB(cx),
1305+
None,
1306+
name.as_c_char_ptr(),
1307+
name.len(),
1308+
actual_type_di_node,
1309+
)
1310+
}
13021311
})
13031312
})
13041313
.collect();

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+13-23
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ use crate::builder::Builder;
3434
use crate::common::{AsCCharPtr, CodegenCx};
3535
use crate::llvm;
3636
use crate::llvm::debuginfo::{
37-
DIArray, DIBuilderBox, DIFile, DIFlags, DILexicalBlock, DILocation, DISPFlags, DIScope,
38-
DITemplateTypeParameter, DIType, DIVariable,
37+
DIArray, DIBuilderBox, DIFile, DIFlags, DILexicalBlock, DILocation, DISPFlags, DIScope, DIType,
38+
DIVariable,
3939
};
4040
use crate::value::Value;
4141

@@ -251,7 +251,7 @@ struct DebugLoc {
251251
col: u32,
252252
}
253253

254-
impl<'ll> CodegenCx<'ll, '_> {
254+
impl CodegenCx<'_, '_> {
255255
/// Looks up debug source information about a `BytePos`.
256256
// FIXME(eddyb) rename this to better indicate it's a duplicate of
257257
// `lookup_char_pos` rather than `dbg_loc`, perhaps by making
@@ -279,22 +279,6 @@ impl<'ll> CodegenCx<'ll, '_> {
279279
DebugLoc { file, line, col }
280280
}
281281
}
282-
283-
fn create_template_type_parameter(
284-
&self,
285-
name: &str,
286-
actual_type_metadata: &'ll DIType,
287-
) -> &'ll DITemplateTypeParameter {
288-
unsafe {
289-
llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
290-
DIB(self),
291-
None,
292-
name.as_c_char_ptr(),
293-
name.len(),
294-
actual_type_metadata,
295-
)
296-
}
297-
}
298282
}
299283

300284
impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
@@ -499,10 +483,16 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
499483
kind.as_type().map(|ty| {
500484
let actual_type = cx.tcx.normalize_erasing_regions(cx.typing_env(), ty);
501485
let actual_type_metadata = type_di_node(cx, actual_type);
502-
Some(cx.create_template_type_parameter(
503-
name.as_str(),
504-
actual_type_metadata,
505-
))
486+
let name = name.as_str();
487+
unsafe {
488+
Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
489+
DIB(cx),
490+
None,
491+
name.as_c_char_ptr(),
492+
name.len(),
493+
actual_type_metadata,
494+
))
495+
}
506496
})
507497
})
508498
.collect()

0 commit comments

Comments
 (0)