Skip to content

Rollup of 10 pull requests #111760

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

Closed
wants to merge 21 commits into from
Closed
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
926e874
Dont check `must_use` on nested `impl Future` from fn
compiler-errors May 12, 2023
d371b80
Bump `cc` for `bootstrap`
r-value May 18, 2023
f0f9d88
Add Iterator::map_windows
frank-king May 10, 2023
e6a7fde
Give a more useful location for where a span_bug was delayed
jyn514 May 18, 2023
f577cc4
Fix doc comment for `ConstParamTy` derive
juntyr May 18, 2023
30c0e4e
Add more tests for the offset_of!() macro
est31 May 17, 2023
3e4ed61
do not overwrite obligations
lcnr May 18, 2023
0426562
very minor cleanups
jyn514 May 15, 2023
ad5955b
Migrate GUI colors test to original CSS color format
GuillaumeGomez May 18, 2023
1551495
Fix an ICE in CGU dumping code.
nnethercote May 18, 2023
1bb957e
Improve CGU partitioning debug output.
nnethercote May 18, 2023
4c03da9
Rollup merge of #94667 - frank-king:feature/iter_map_windows, r=Mark-…
GuillaumeGomez May 19, 2023
477cc24
Rollup merge of #111491 - compiler-errors:nested-fut-must-use, r=wesl…
GuillaumeGomez May 19, 2023
f410a76
Rollup merge of #111606 - jyn514:nightly-diagnostics, r=lcnr
GuillaumeGomez May 19, 2023
3d86765
Rollup merge of #111665 - est31:offset_of_tests, r=WaffleLapkin
GuillaumeGomez May 19, 2023
c00e88a
Rollup merge of #111701 - r-value:patch-1, r=jyn514
GuillaumeGomez May 19, 2023
98989f3
Rollup merge of #111708 - jyn514:delay-span-bug-msg, r=compiler-errors
GuillaumeGomez May 19, 2023
af26f19
Rollup merge of #111715 - juntyr:const-param-ty-derive-fix, r=Nilstrieb
GuillaumeGomez May 19, 2023
3b393c1
Rollup merge of #111723 - lcnr:overwrite-obligations, r=compiler-errors
GuillaumeGomez May 19, 2023
1123c72
Rollup merge of #111726 - GuillaumeGomez:gui-test-migrate-color, r=no…
GuillaumeGomez May 19, 2023
807f36a
Rollup merge of #111743 - nnethercote:improve-cgu-merging-debug-outpu…
GuillaumeGomez May 19, 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
3 changes: 2 additions & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,8 @@ pub fn install_ice_hook(bug_report_url: &'static str, extra_info: fn(&Handler))
#[cfg(windows)]
if let Some(msg) = info.payload().downcast_ref::<String>() {
if msg.starts_with("failed printing to stdout: ") && msg.ends_with("(os error 232)") {
early_error_no_abort(ErrorOutputType::default(), msg.as_str());
// the error code is already going to be reported when the panic unwinds up the stack
let _ = early_error_no_abort(ErrorOutputType::default(), msg.as_str());
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ impl DelayedDiagnostic {
}

fn decorate(mut self) -> Diagnostic {
self.inner.note(format!("delayed at {}", self.note));
self.inner.note(format!("delayed at {}\n{}", self.inner.emitted_at, self.note));
self.inner
}
}
Expand Down
13 changes: 6 additions & 7 deletions compiler/rustc_infer/src/infer/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,19 +530,18 @@ impl<'tcx> InferCtxt<'tcx> {
// these are the same span, but not in cases like `-> (impl
// Foo, impl Bar)`.
let span = cause.span;

let mut obligations = vec![];
let prev = self.inner.borrow_mut().opaque_types().register(
OpaqueTypeKey { def_id, substs },
OpaqueHiddenType { ty: hidden_ty, span },
origin,
);
if let Some(prev) = prev {
obligations = self
.at(&cause, param_env)
let mut obligations = if let Some(prev) = prev {
self.at(&cause, param_env)
.eq_exp(DefineOpaqueTypes::Yes, a_is_expected, prev, hidden_ty)?
.obligations;
}
.obligations
} else {
Vec::new()
};

let item_bounds = tcx.explicit_item_bounds(def_id);

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
&& let ty = cx.typeck_results().expr_ty(&await_expr)
&& let ty::Alias(ty::Opaque, ty::AliasTy { def_id: future_def_id, .. }) = ty.kind()
&& cx.tcx.ty_is_opaque_future(ty)
// FIXME: This also includes non-async fns that return `impl Future`.
&& let async_fn_def_id = cx.tcx.parent(*future_def_id)
&& matches!(cx.tcx.def_kind(async_fn_def_id), DefKind::Fn | DefKind::AssocFn)
// Check that this `impl Future` actually comes from an `async fn`
&& cx.tcx.asyncness(async_fn_def_id).is_async()
&& check_must_use_def(
cx,
async_fn_def_id,
Expand Down
30 changes: 18 additions & 12 deletions compiler/rustc_monomorphize/src/partitioning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ where
cgu.create_size_estimate(tcx);
}

debug_dump(tcx, "INITIAL PARTITIONING:", initial_partitioning.codegen_units.iter());
debug_dump(tcx, "INITIAL PARTITIONING", &initial_partitioning.codegen_units);

// Merge until we have at most `max_cgu_count` codegen units.
{
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_merge_cgus");
partitioner.merge_codegen_units(cx, &mut initial_partitioning);
debug_dump(tcx, "POST MERGING:", initial_partitioning.codegen_units.iter());
debug_dump(tcx, "POST MERGING", &initial_partitioning.codegen_units);
}

// In the next step, we use the inlining map to determine which additional
Expand All @@ -272,7 +272,7 @@ where
cgu.create_size_estimate(tcx);
}

debug_dump(tcx, "POST INLINING:", post_inlining.codegen_units.iter());
debug_dump(tcx, "POST INLINING", &post_inlining.codegen_units);

// Next we try to make as many symbols "internal" as possible, so LLVM has
// more freedom to optimize.
Expand Down Expand Up @@ -322,6 +322,8 @@ where

result.sort_by(|a, b| a.name().as_str().cmp(b.name().as_str()));

debug_dump(tcx, "FINAL", &result);

result
}

Expand All @@ -346,33 +348,37 @@ struct PostInliningPartitioning<'tcx> {
internalization_candidates: FxHashSet<MonoItem<'tcx>>,
}

fn debug_dump<'a, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I)
where
I: Iterator<Item = &'a CodegenUnit<'tcx>>,
'tcx: 'a,
{
fn debug_dump<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx>, label: &str, cgus: &[CodegenUnit<'tcx>]) {
let dump = move || {
use std::fmt::Write;

let num_cgus = cgus.len();
let max = cgus.iter().map(|cgu| cgu.size_estimate()).max().unwrap();
let min = cgus.iter().map(|cgu| cgu.size_estimate()).min().unwrap();
let ratio = max as f64 / min as f64;

let s = &mut String::new();
let _ = writeln!(s, "{label}");
let _ = writeln!(
s,
"{label} ({num_cgus} CodegenUnits, max={max}, min={min}, max/min={ratio:.1}):"
);
for cgu in cgus {
let _ =
writeln!(s, "CodegenUnit {} estimated size {} :", cgu.name(), cgu.size_estimate());
writeln!(s, "CodegenUnit {} estimated size {}:", cgu.name(), cgu.size_estimate());

for (mono_item, linkage) in cgu.items() {
let symbol_name = mono_item.symbol_name(tcx).name;
let symbol_hash_start = symbol_name.rfind('h');
let symbol_hash = symbol_hash_start.map_or("<no hash>", |i| &symbol_name[i..]);

let _ = writeln!(
let _ = with_no_trimmed_paths!(writeln!(
s,
" - {} [{:?}] [{}] estimated size {}",
mono_item,
linkage,
symbol_hash,
mono_item.size_estimate(tcx)
);
));
}

let _ = writeln!(s);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ impl<'a> DerefMut for SnapshotParser<'a> {

impl<'a> Parser<'a> {
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_span_err<S: Into<MultiSpan>>(
&self,
sp: S,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,7 @@ fn early_error_handler(output: config::ErrorOutputType) -> rustc_errors::Handler

#[allow(rustc::untranslatable_diagnostic)]
#[allow(rustc::diagnostic_outside_of_impl)]
#[must_use = "ErrorGuaranteed must be returned from `run_compiler` in order to exit with a non-zero status code"]
pub fn early_error_no_abort(
output: config::ErrorOutputType,
msg: impl Into<DiagnosticMessage>,
Expand Down
Loading