codegen_llvm: avoid Deref
impls w/ extern type
`rustc_codegen_llvm` relied on `Deref` impls where `Deref::Target` was or contained an extern type - in my experimental implementation of rust-lang/rfcs#3729, this isn't possible as the `Target` associated type's `?Sized` bound cannot be relaxed backwards compatibly (unless we come up with some way of doing this). In later pull requests with the rust-lang/rfcs#3729 implementation, breakage like this could only occur for nightly users relying on the `extern_types` feature. Upstreaming this to avoid needing to keep carrying this patch locally, and I think it'll necessarily need to change eventually.
This commit is contained in:
parent
ad27045c31
commit
a5615d3c62
8 changed files with 31 additions and 30 deletions
|
@ -331,7 +331,8 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
|
|||
if let Some(feat) = to_llvm_features(sess, feature) {
|
||||
for llvm_feature in feat {
|
||||
let cstr = SmallCStr::new(llvm_feature);
|
||||
if !unsafe { llvm::LLVMRustHasFeature(&target_machine, cstr.as_ptr()) } {
|
||||
if !unsafe { llvm::LLVMRustHasFeature(target_machine.raw(), cstr.as_ptr()) }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -453,8 +454,8 @@ pub(crate) fn print(req: &PrintRequest, out: &mut String, sess: &Session) {
|
|||
require_inited();
|
||||
let tm = create_informational_target_machine(sess, false);
|
||||
match req.kind {
|
||||
PrintKind::TargetCPUs => print_target_cpus(sess, &tm, out),
|
||||
PrintKind::TargetFeatures => print_target_features(sess, &tm, out),
|
||||
PrintKind::TargetCPUs => print_target_cpus(sess, tm.raw(), out),
|
||||
PrintKind::TargetFeatures => print_target_features(sess, tm.raw(), out),
|
||||
_ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue