Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ed172db

Browse files
committed
Auto merge of rust-lang#125448 - matthiaskrgr:rollup-vn6nleh, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#124297 (Allow coercing functions whose signature differs in opaque types in their defining scope into a shared function pointer type) - rust-lang#124516 (Allow monomorphization time const eval failures if the cause is a type layout issue) - rust-lang#124976 (rustc: Use `tcx.used_crates(())` more) - rust-lang#125210 (Cleanup: Fix up some diagnostics) - rust-lang#125409 (Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows`) - rust-lang#125416 (Use correct param-env in `MissingCopyImplementations`) - rust-lang#125421 (Rewrite `core-no-oom-handling`, `issue-24445` and `issue-38237` `run-make` tests to new `rmake.rs` format) - rust-lang#125438 (Remove unneeded string conversion) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 39d2f2a + cf92f4c commit ed172db

File tree

70 files changed

+404
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+404
-155
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,12 @@ fn link_natively(
786786
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
787787
&& unknown_arg_regex.is_match(&out)
788788
&& out.contains("-no-pie")
789-
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie")
789+
&& cmd.get_args().iter().any(|e| e == "-no-pie")
790790
{
791791
info!("linker output: {:?}", out);
792792
warn!("Linker does not support -no-pie command line option. Retrying without.");
793793
for arg in cmd.take_args() {
794-
if arg.to_string_lossy() != "-no-pie" {
794+
if arg != "-no-pie" {
795795
cmd.arg(arg);
796796
}
797797
}
@@ -825,7 +825,7 @@ fn link_natively(
825825
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
826826
&& unknown_arg_regex.is_match(&out)
827827
&& (out.contains("-static-pie") || out.contains("--no-dynamic-linker"))
828-
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie")
828+
&& cmd.get_args().iter().any(|e| e == "-static-pie")
829829
{
830830
info!("linker output: {:?}", out);
831831
warn!(
@@ -864,7 +864,7 @@ fn link_natively(
864864
assert!(pre_objects_static.is_empty() || !pre_objects_static_pie.is_empty());
865865
assert!(post_objects_static.is_empty() || !post_objects_static_pie.is_empty());
866866
for arg in cmd.take_args() {
867-
if arg.to_string_lossy() == "-static-pie" {
867+
if arg == "-static-pie" {
868868
// Replace the output kind.
869869
cmd.arg("-static");
870870
} else if pre_objects_static_pie.contains(&arg) {

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ fn upstream_monomorphizations_provider(
399399
tcx: TyCtxt<'_>,
400400
(): (),
401401
) -> DefIdMap<UnordMap<GenericArgsRef<'_>, CrateNum>> {
402-
let cnums = tcx.crates(());
402+
let cnums = tcx.used_crates(());
403403

404404
let mut instances: DefIdMap<UnordMap<_, _>> = Default::default();
405405

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ pub fn collect_debugger_visualizers_transitive(
539539
tcx.debugger_visualizers(LOCAL_CRATE)
540540
.iter()
541541
.chain(
542-
tcx.crates(())
542+
tcx.used_crates(())
543543
.iter()
544544
.filter(|&cnum| {
545545
let used_crate_source = tcx.used_crate_source(*cnum);
@@ -849,7 +849,7 @@ impl CrateInfo {
849849
// `compiler_builtins` are always placed last to ensure that they're linked correctly.
850850
used_crates.extend(compiler_builtins);
851851

852-
let crates = tcx.crates(());
852+
let crates = tcx.used_crates(());
853853
let n_crates = crates.len();
854854
let mut info = CrateInfo {
855855
target_cpu,

compiler/rustc_const_eval/src/const_eval/error.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::mem;
22

33
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, Diagnostic, IntoDiagArg};
44
use rustc_hir::CRATE_HIR_ID;
5-
use rustc_middle::mir::interpret::Provenance;
5+
use rustc_middle::mir::interpret::{Provenance, ReportedErrorInfo};
66
use rustc_middle::mir::AssertKind;
77
use rustc_middle::query::TyCtxtAt;
88
use rustc_middle::ty::TyCtxt;
@@ -139,9 +139,10 @@ where
139139
ErrorHandled::TooGeneric(span)
140140
}
141141
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
142-
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
143-
ErrorHandled::Reported(guar.into(), span)
144-
}
142+
err_inval!(Layout(LayoutError::ReferencesError(guar))) => ErrorHandled::Reported(
143+
ReportedErrorInfo::tainted_by_errors(guar),
144+
span,
145+
),
145146
// Report remaining errors.
146147
_ => {
147148
let (our_span, frames) = get_span_and_frames();

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,20 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
11811181
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
11821182
M::eval_mir_constant(self, *val, span, layout, |ecx, val, span, layout| {
11831183
let const_val = val.eval(*ecx.tcx, ecx.param_env, span).map_err(|err| {
1184-
if M::ALL_CONSTS_ARE_PRECHECKED && !matches!(err, ErrorHandled::TooGeneric(..)) {
1185-
// Looks like the const is not captued by `required_consts`, that's bad.
1186-
bug!("interpret const eval failure of {val:?} which is not in required_consts");
1184+
if M::ALL_CONSTS_ARE_PRECHECKED {
1185+
match err {
1186+
ErrorHandled::TooGeneric(..) => {},
1187+
ErrorHandled::Reported(reported, span) => {
1188+
if reported.is_tainted_by_errors() {
1189+
// const-eval will return "tainted" errors if e.g. the layout cannot
1190+
// be computed as the type references non-existing names.
1191+
// See <https://github.com/rust-lang/rust/issues/124348>.
1192+
} else {
1193+
// Looks like the const is not captued by `required_consts`, that's bad.
1194+
span_bug!(span, "interpret const eval failure of {val:?} which is not in required_consts");
1195+
}
1196+
}
1197+
}
11871198
}
11881199
err.emit_note(*ecx.tcx);
11891200
err

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11591159
let sig = self
11601160
.at(cause, self.param_env)
11611161
.trace(prev_ty, new_ty)
1162-
.lub(DefineOpaqueTypes::No, a_sig, b_sig)
1162+
.lub(DefineOpaqueTypes::Yes, a_sig, b_sig)
11631163
.map(|ok| self.register_infer_ok_obligations(ok))?;
11641164

11651165
// Reify both sides and return the reified fn pointer type.

compiler/rustc_infer/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ infer_compare_impl_item_obligation = ...so that the definition in impl matches t
104104
infer_consider_specifying_length = consider specifying the actual array length
105105
infer_data_flows = ...but data{$label_var1_exists ->
106106
[true] {" "}from `{$label_var1}`
107-
*[false] -> {""}
107+
*[false] {""}
108108
} flows{$label_var2_exists ->
109109
[true] {" "}into `{$label_var2}`
110-
*[false] -> {""}
110+
*[false] {""}
111111
} here
112112
113113
infer_data_lifetime_flow = ...but data with one lifetime flows into the other here

compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
458458
}
459459
}
460460

461-
for &cnum in tcx.crates(()) {
461+
for &cnum in tcx.crates_including_speculative(()) {
462462
let source = tcx.used_crate_source(cnum);
463463
if let Some((path, _)) = &source.dylib {
464464
files.push(escape_dep_filename(&path.display().to_string()));

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ lint_pattern_in_foreign = patterns aren't allowed in foreign function declaratio
627627
.label = pattern not allowed in foreign function
628628
629629
lint_private_extern_crate_reexport =
630-
extern crate `{$ident}` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
630+
extern crate `{$ident}` is private, and cannot be re-exported, consider declaring with `pub`
631631
632632
lint_proc_macro_back_compat = using an old version of `{$crate_name}`
633633
.note = older versions of the `{$crate_name}` crate will stop compiling in future versions of Rust; please update to `{$crate_name}` v{$fixed_version}, or switch to one of the `{$crate_name}` alternatives

compiler/rustc_lint/src/builtin.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,11 +674,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
674674
return;
675675
}
676676
}
677-
let param_env = ty::ParamEnv::empty();
678-
if ty.is_copy_modulo_regions(cx.tcx, param_env) {
677+
if ty.is_copy_modulo_regions(cx.tcx, cx.param_env) {
679678
return;
680679
}
681-
if type_implements_negative_copy_modulo_regions(cx.tcx, ty, param_env) {
680+
if type_implements_negative_copy_modulo_regions(cx.tcx, ty, cx.param_env) {
682681
return;
683682
}
684683
if def.is_variant_list_non_exhaustive()
@@ -694,7 +693,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
694693
.tcx
695694
.infer_ctxt()
696695
.build()
697-
.type_implements_trait(iter_trait, [ty], param_env)
696+
.type_implements_trait(iter_trait, [ty], cx.param_env)
698697
.must_apply_modulo_regions()
699698
{
700699
return;
@@ -711,7 +710,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
711710

712711
if type_allowed_to_implement_copy(
713712
cx.tcx,
714-
param_env,
713+
cx.param_env,
715714
ty,
716715
traits::ObligationCause::misc(item.span, item.owner_id.def_id),
717716
)

0 commit comments

Comments
 (0)