Skip to content

Commit 3f10032

Browse files
committed
Auto merge of #123540 - matthiaskrgr:rollup-8ewq0zt, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #123294 (Require LLVM_CONFIG to be set in rustc_llvm/build.rs) - #123467 (MSVC targets should use COFF as their archive format) - #123498 (explaining `DefKind::Field`) - #123519 (Improve cfg and check-cfg configuration) - #123525 (CFI: Don't rewrite ty::Dynamic directly) - #123526 (Do not ICE when calling incorrectly defined `transmute` intrinsic) - #123528 (Hide async_gen_internals from standard library documentation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8d490e3 + 58ac1b4 commit 3f10032

File tree

14 files changed

+465
-406
lines changed

14 files changed

+465
-406
lines changed

compiler/rustc_codegen_ssa/src/back/archive.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ impl<'a> ArArchiveBuilder<'a> {
231231
"gnu" => ArchiveKind::Gnu,
232232
"bsd" => ArchiveKind::Bsd,
233233
"darwin" => ArchiveKind::Darwin,
234-
"coff" => ArchiveKind::Coff,
234+
"coff" => {
235+
// FIXME: ar_archive_writer doesn't support COFF archives yet.
236+
// https://github.com/rust-lang/ar_archive_writer/issues/9
237+
ArchiveKind::Gnu
238+
}
235239
"aix_big" => ArchiveKind::AixBig,
236240
kind => {
237241
self.sess.dcx().emit_fatal(UnknownArchiveKind { kind });

compiler/rustc_hir/src/def.rs

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ pub enum DefKind {
113113
InlineConst,
114114
/// Opaque type, aka `impl Trait`.
115115
OpaqueTy,
116+
/// A field in a struct, enum or union. e.g.
117+
/// - `bar` in `struct Foo { bar: u8 }`
118+
/// - `Foo::Bar::0` in `enum Foo { Bar(u8) }`
116119
Field,
117120
/// Lifetime parameter: the `'a` in `struct Foo<'a> { ... }`
118121
LifetimeParam,

compiler/rustc_hir_typeck/src/expr.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
544544
if tcx.fn_sig(did).skip_binder().abi() == RustIntrinsic
545545
&& tcx.item_name(did) == sym::transmute
546546
{
547-
let from = fn_sig.inputs().skip_binder()[0];
547+
let Some(from) = fn_sig.inputs().skip_binder().get(0) else {
548+
let e = self.dcx().span_delayed_bug(
549+
tcx.def_span(did),
550+
"intrinsic fn `transmute` defined with no parameters",
551+
);
552+
self.set_tainted_by_errors(e);
553+
return Ty::new_error(tcx, e);
554+
};
548555
let to = fn_sig.output().skip_binder();
549556
// We defer the transmute to the end of typeck, once all inference vars have
550557
// been resolved or we errored. This is important as we can only check transmute
551558
// on concrete types, but the output type may not be known yet (it would only
552559
// be known if explicitly specified via turbofish).
553-
self.deferred_transmute_checks.borrow_mut().push((from, to, expr.hir_id));
560+
self.deferred_transmute_checks.borrow_mut().push((*from, to, expr.hir_id));
554561
}
555562
if !tcx.features().unsized_fn_params {
556563
// We want to remove some Sized bounds from std functions,

compiler/rustc_llvm/build.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -112,28 +112,10 @@ fn main() {
112112

113113
restore_library_path();
114114

115-
let target = env::var("TARGET").expect("TARGET was not set");
116115
let llvm_config =
117-
tracked_env_var_os("LLVM_CONFIG").map(|x| Some(PathBuf::from(x))).unwrap_or_else(|| {
118-
if let Some(dir) = tracked_env_var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
119-
let to_test = dir
120-
.parent()
121-
.unwrap()
122-
.parent()
123-
.unwrap()
124-
.join(&target)
125-
.join("llvm/bin/llvm-config");
126-
if Command::new(&to_test).output().is_ok() {
127-
return Some(to_test);
128-
}
129-
}
130-
None
131-
});
116+
PathBuf::from(tracked_env_var_os("LLVM_CONFIG").expect("LLVM_CONFIG was not set"));
132117

133-
if let Some(llvm_config) = &llvm_config {
134-
println!("cargo:rerun-if-changed={}", llvm_config.display());
135-
}
136-
let llvm_config = llvm_config.unwrap_or_else(|| PathBuf::from("llvm-config"));
118+
println!("cargo:rerun-if-changed={}", llvm_config.display());
137119

138120
// Test whether we're cross-compiling LLVM. This is a pretty rare case
139121
// currently where we're producing an LLVM for a different platform than

0 commit comments

Comments
 (0)