Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #107318

Merged
merged 21 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift click to select a range
9f5a933
Remove backwards compat for LLVM 12 coverage format
Swatinem Jan 9, 2023
6155b9a
Avoid __cxa_thread_atexit_impl on Emscripten
RReverser Jan 12, 2023
ab20f8d
remove optimistic spinning from `mpsc::SyncSender`
ibraheemdev Jan 14, 2023
a41c5f9
Re-add #[allow(unused)] attr
RReverser Jan 14, 2023
25f0147
implement Hash for proc_macro::LineColumn
dtolnay Jan 16, 2023
783caf3
Append .dwp to the binary filename instead of replacing the existing …
khuey Jan 13, 2023
0accf08
remove unnecessary check for opaque types
lcnr Jan 19, 2023
a2d1cb2
impl DispatchFromDyn for Cell and UnsafeCell
dimpolo May 24, 2022
af58854
add feature gate tests for DispatchFromDyn
dimpolo Oct 26, 2022
b222f2e
Move `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`
Noratrieb Jan 25, 2023
943000f
Use `can_eq` to compare types for default assoc type error
Noratrieb Jan 25, 2023
3016f55
improve fn pointer notes
mattjperez Jan 25, 2023
e0d71f5
Rollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnay
matthiaskrgr Jan 26, 2023
b2448f9
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
matthiaskrgr Jan 26, 2023
cc92bdb
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
matthiaskrgr Jan 26, 2023
59fcb7a
Rollup merge of #106811 - khuey:dwp_extension, r=davidtwco
matthiaskrgr Jan 26, 2023
35a8d6f
Rollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu
matthiaskrgr Jan 26, 2023
d667105
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
matthiaskrgr Jan 26, 2023
c1d722c
Rollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-…
matthiaskrgr Jan 26, 2023
f2f1234
Rollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=comp…
matthiaskrgr Jan 26, 2023
3aeafca
Rollup merge of #107304 - Nilstrieb:ᐸTy as PartialEqᐳ::eq because wha…
matthiaskrgr Jan 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 17 additions & 28 deletions compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
use crate::common::CodegenCx;
use crate::coverageinfo;
use crate::errors::InstrumentCoverageRequiresLLVM12;
use crate::llvm;

use llvm::coverageinfo::CounterMappingRegion;
Expand All @@ -19,8 18,8 @@ use std::ffi::CString;

/// Generates and exports the Coverage Map.
///
/// Rust Coverage Map generation supports LLVM Coverage Mapping Format versions
/// 5 (LLVM 12, only) and 6 (zero-based encoded as 4 and 5, respectively), as defined at
/// Rust Coverage Map generation supports LLVM Coverage Mapping Format version
/// 6 (zero-based encoded as 5), as defined at
/// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format).
/// These versions are supported by the LLVM coverage tools (`llvm-profdata` and `llvm-cov`)
/// bundled with Rust's fork of LLVM.
Expand All @@ -33,13 32,10 @@ use std::ffi::CString;
pub fn finalize(cx: &CodegenCx<'_, '_>) {
let tcx = cx.tcx;

// Ensure the installed version of LLVM supports at least Coverage Map
// Version 5 (encoded as a zero-based value: 4), which was introduced with
// LLVM 12.
// Ensure the installed version of LLVM supports Coverage Map Version 6
// (encoded as a zero-based value: 5), which was introduced with LLVM 13.
let version = coverageinfo::mapping_version();
if version < 4 {
tcx.sess.emit_fatal(InstrumentCoverageRequiresLLVM12);
}
assert_eq!(version, 5, "The `CoverageMappingVersion` exposed by `llvm-wrapper` is out of sync");

debug!("Generating coverage map for CodegenUnit: `{}`", cx.codegen_unit.name());

Expand All @@ -61,7 57,7 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
return;
}

let mut mapgen = CoverageMapGenerator::new(tcx, version);
let mut mapgen = CoverageMapGenerator::new(tcx);

// Encode coverage mappings and generate function records
let mut function_data = Vec::new();
Expand Down Expand Up @@ -124,25 120,18 @@ struct CoverageMapGenerator {
}

impl CoverageMapGenerator {
fn new(tcx: TyCtxt<'_>, version: u32) -> Self {
fn new(tcx: TyCtxt<'_>) -> Self {
let mut filenames = FxIndexSet::default();
if version >= 5 {
// LLVM Coverage Mapping Format version 6 (zero-based encoded as 5)
// requires setting the first filename to the compilation directory.
// Since rustc generates coverage maps with relative paths, the
// compilation directory can be combined with the relative paths
// to get absolute paths, if needed.
let working_dir = tcx
.sess
.opts
.working_dir
.remapped_path_if_available()
.to_string_lossy()
.to_string();
let c_filename =
CString::new(working_dir).expect("null error converting filename to C string");
filenames.insert(c_filename);
}
// LLVM Coverage Mapping Format version 6 (zero-based encoded as 5)
// requires setting the first filename to the compilation directory.
// Since rustc generates coverage maps with relative paths, the
// compilation directory can be combined with the relative paths
// to get absolute paths, if needed.
let working_dir =
tcx.sess.opts.working_dir.remapped_path_if_available().to_string_lossy().to_string();
let c_filename =
CString::new(working_dir).expect("null error converting filename to C string");
filenames.insert(c_filename);
Self { filenames }
}

Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 39,6 @@ pub(crate) struct ErrorCreatingImportLibrary<'a> {
pub error: String,
}

#[derive(Diagnostic)]
#[diag(codegen_llvm_instrument_coverage_requires_llvm_12)]
pub(crate) struct InstrumentCoverageRequiresLLVM12;

#[derive(Diagnostic)]
#[diag(codegen_llvm_symbol_already_defined)]
pub(crate) struct SymbolAlreadyDefined<'a> {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 599,8 @@ fn link_dwarf_object<'a>(
cg_results: &CodegenResults,
executable_out_filename: &Path,
) {
let dwp_out_filename = executable_out_filename.with_extension("dwp");
let mut dwp_out_filename = executable_out_filename.to_path_buf().into_os_string();
dwp_out_filename.push(".dwp");
debug!(?dwp_out_filename, ?executable_out_filename);

#[derive(Default)]
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_const_eval/src/transform/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,7 @@ use rustc_middle::mir::{
ProjectionElem, RetagKind, RuntimePhase, Rvalue, SourceScope, Statement, StatementKind,
Terminator, TerminatorKind, UnOp, START_BLOCK,
};
use rustc_middle::ty::{self, InstanceDef, ParamEnv, Ty, TyCtxt, TypeVisitable};
use rustc_middle::ty::{self, InstanceDef, ParamEnv, Ty, TyCtxt};
use rustc_mir_dataflow::impls::MaybeStorageLive;
use rustc_mir_dataflow::storage::always_storage_live_locals;
use rustc_mir_dataflow::{Analysis, ResultsCursor};
Expand Down Expand Up @@ -230,11 230,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
// Equal types, all is good.
return true;
}
// Normalization reveals opaque types, but we may be validating MIR while computing
// said opaque types, causing cycles.
if (src, dest).has_opaque_types() {
return true;
}

crate::util::is_subtype(self.tcx, self.param_env, src, dest)
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_error_messages/locales/en-US/codegen_llvm.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 11,6 @@ codegen_llvm_unknown_ctarget_feature_prefix =
codegen_llvm_error_creating_import_library =
Error creating import library for {$lib_name}: {$error}

codegen_llvm_instrument_coverage_requires_llvm_12 =
rustc option `-C instrument-coverage` requires LLVM 12 or higher.

codegen_llvm_symbol_already_defined =
symbol `{$symbol_name}` is already defined

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 79,7 @@ use std::path::PathBuf;
use std::{cmp, fmt, iter};

mod note;
mod note_and_explain;
mod suggest;

pub(crate) mod need_type_info;
Expand Down Expand Up @@ -1846,7 1847,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}

self.check_and_note_conflicting_crates(diag, terr);
self.tcx.note_and_explain_type_err(diag, terr, cause, span, cause.body_id.to_def_id());

self.note_and_explain_type_err(diag, terr, cause, span, cause.body_id.to_def_id());

if let Some(ValuePairs::PolyTraitRefs(exp_found)) = values
&& let ty::Closure(def_id, _) = exp_found.expected.skip_binder().self_ty().kind()
Expand Down
Loading