Mark all optimize methods and the codegen method as safe
There is no safety contract and I don't think any of them can actually cause UB in more ways than passing malicious source code to rustc can. While LtoModuleCodegen::optimize says that the returned ModuleCodegen points into the LTO module, the LTO module has already been dropped by the time this function returns, so if the returned ModuleCodegen indeed points into the LTO module, we would have seen crashes on every LTO compilation, which we don't. As such the comment is outdated.
This commit is contained in:
parent
96be6effa4
commit
244ea125f1
1 changed files with 3 additions and 3 deletions
|
|
@ -391,7 +391,7 @@ impl WriteBackendMethods for GccCodegenBackend {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
unsafe fn optimize(
|
||||
fn optimize(
|
||||
_cgcx: &CodegenContext<Self>,
|
||||
_dcx: DiagCtxtHandle<'_>,
|
||||
module: &mut ModuleCodegen<Self::Module>,
|
||||
|
|
@ -409,14 +409,14 @@ impl WriteBackendMethods for GccCodegenBackend {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn optimize_thin(
|
||||
fn optimize_thin(
|
||||
cgcx: &CodegenContext<Self>,
|
||||
thin: ThinModule<Self>,
|
||||
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
|
||||
back::lto::optimize_thin_module(thin, cgcx)
|
||||
}
|
||||
|
||||
unsafe fn codegen(
|
||||
fn codegen(
|
||||
cgcx: &CodegenContext<Self>,
|
||||
dcx: DiagCtxtHandle<'_>,
|
||||
module: ModuleCodegen<Self::Module>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue