Skip to content

Commit

Permalink
Auto merge of rust-lang#123540 - matthiaskrgr:rollup-8ewq0zt, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123294 (Require LLVM_CONFIG to be set in rustc_llvm/build.rs)
 - rust-lang#123467 (MSVC targets should use COFF as their archive format)
 - rust-lang#123498 (explaining `DefKind::Field`)
 - rust-lang#123519 (Improve cfg and check-cfg configuration)
 - rust-lang#123525 (CFI: Don't rewrite ty::Dynamic directly)
 - rust-lang#123526 (Do not ICE when calling incorrectly defined `transmute` intrinsic)
 - rust-lang#123528 (Hide async_gen_internals from standard library documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Apr 6, 2024
2 parents 8d490e3 + 58ac1b4 commit 3f10032
Show file tree
Hide file tree
Showing 14 changed files with 465 additions and 406 deletions.
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ impl<'a> ArArchiveBuilder<'a> {
"gnu" => ArchiveKind::Gnu,
"bsd" => ArchiveKind::Bsd,
"darwin" => ArchiveKind::Darwin,
"coff" => ArchiveKind::Coff,
"coff" => {
// FIXME: ar_archive_writer doesn't support COFF archives yet.
// https://github.com/rust-lang/ar_archive_writer/issues/9
ArchiveKind::Gnu
}
"aix_big" => ArchiveKind::AixBig,
kind => {
self.sess.dcx().emit_fatal(UnknownArchiveKind { kind });
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ pub enum DefKind {
InlineConst,
/// Opaque type, aka `impl Trait`.
OpaqueTy,
/// A field in a struct, enum or union. e.g.
/// - `bar` in `struct Foo { bar: u8 }`
/// - `Foo::Bar::0` in `enum Foo { Bar(u8) }`
Field,
/// Lifetime parameter: the `'a` in `struct Foo<'a> { ... }`
LifetimeParam,
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if tcx.fn_sig(did).skip_binder().abi() == RustIntrinsic
&& tcx.item_name(did) == sym::transmute
{
let from = fn_sig.inputs().skip_binder()[0];
let Some(from) = fn_sig.inputs().skip_binder().get(0) else {
let e = self.dcx().span_delayed_bug(
tcx.def_span(did),
"intrinsic fn `transmute` defined with no parameters",
);
self.set_tainted_by_errors(e);
return Ty::new_error(tcx, e);
};
let to = fn_sig.output().skip_binder();
// We defer the transmute to the end of typeck, once all inference vars have
// been resolved or we errored. This is important as we can only check transmute
// on concrete types, but the output type may not be known yet (it would only
// be known if explicitly specified via turbofish).
self.deferred_transmute_checks.borrow_mut().push((from, to, expr.hir_id));
self.deferred_transmute_checks.borrow_mut().push((*from, to, expr.hir_id));
}
if !tcx.features().unsized_fn_params {
// We want to remove some Sized bounds from std functions,
Expand Down
22 changes: 2 additions & 20 deletions compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,10 @@ fn main() {

restore_library_path();

let target = env::var("TARGET").expect("TARGET was not set");
let llvm_config =
tracked_env_var_os("LLVM_CONFIG").map(|x| Some(PathBuf::from(x))).unwrap_or_else(|| {
if let Some(dir) = tracked_env_var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
let to_test = dir
.parent()
.unwrap()
.parent()
.unwrap()
.join(&target)
.join("llvm/bin/llvm-config");
if Command::new(&to_test).output().is_ok() {
return Some(to_test);
}
}
None
});
PathBuf::from(tracked_env_var_os("LLVM_CONFIG").expect("LLVM_CONFIG was not set"));

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

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

0 comments on commit 3f10032

Please sign in to comment.