Skip to content

Commit 4f2dc04

Browse files
committed
Auto merge of rust-lang#125444 - matthiaskrgr:rollup-379ukwx, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#125210 (Cleanup: Fix up some diagnostics) - rust-lang#125224 (Migrate `run-make/issue-53964` to `rmake`) - rust-lang#125227 (Migrate `run-make/issue-30063` to `rmake`) - rust-lang#125383 (Rewrite `emit`, `mixing-formats` and `bare-outfile` `run-make` tests in `rmake.rs` format) - rust-lang#125401 (Migrate `run-make/rustdoc-scrape-examples-macros` to `rmake.rs`) - 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 + 0ec485f commit 4f2dc04

File tree

51 files changed

+419
-265
lines changed

Some content is hidden

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

51 files changed

+419
-265
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+4-4
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_infer/messages.ftl

+2-2
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_lint/messages.ftl

+1-1
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

+4-5
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
)

compiler/rustc_lint/src/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,7 @@ pub struct MacroUseDeprecated;
22282228
pub struct UnusedMacroUse;
22292229

22302230
#[derive(LintDiagnostic)]
2231-
#[diag(lint_private_extern_crate_reexport)]
2231+
#[diag(lint_private_extern_crate_reexport, code = E0365)]
22322232
pub struct PrivateExternCrateReexport {
22332233
pub ident: Ident,
22342234
}

compiler/rustc_metadata/messages.ftl

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ metadata_found_staticlib =
9191
found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}
9292
.help = please recompile that crate using --crate-type lib
9393
94-
metadata_framework_only_windows =
95-
link kind `raw-dylib` is only supported on Windows targets
96-
9794
metadata_global_alloc_required =
9895
no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
9996
@@ -233,6 +230,9 @@ metadata_profiler_builtins_needs_core =
233230
metadata_raw_dylib_no_nul =
234231
link name must not contain NUL characters if link kind is `raw-dylib`
235232
233+
metadata_raw_dylib_only_windows =
234+
link kind `raw-dylib` is only supported on Windows targets
235+
236236
metadata_renaming_no_link =
237237
renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library
238238

compiler/rustc_metadata/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ pub struct LinkFrameworkApple {
142142
}
143143

144144
#[derive(Diagnostic)]
145-
#[diag(metadata_framework_only_windows, code = E0455)]
146-
pub struct FrameworkOnlyWindows {
145+
#[diag(metadata_raw_dylib_only_windows, code = E0455)]
146+
pub struct RawDylibOnlyWindows {
147147
#[primary_span]
148148
pub span: Span,
149149
}

compiler/rustc_metadata/src/native_libs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl<'tcx> Collector<'tcx> {
151151
}
152152
"raw-dylib" => {
153153
if !sess.target.is_like_windows {
154-
sess.dcx().emit_err(errors::FrameworkOnlyWindows { span });
154+
sess.dcx().emit_err(errors::RawDylibOnlyWindows { span });
155155
}
156156
NativeLibKind::RawDylib
157157
}

compiler/rustc_mir_build/messages.ftl

+11-12
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,12 @@ mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its
335335
mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items
336336
337337
mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe =
338-
borrow of layout constrained field with interior mutability is unsafe and requires unsafe block (error E0133)
338+
borrow of layout constrained field with interior mutability is unsafe and requires unsafe block
339339
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
340340
.label = borrow of layout constrained field with interior mutability
341341
342342
mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe =
343-
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
343+
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block
344344
.help = in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
345345
[1] feature
346346
*[count] features
@@ -355,48 +355,47 @@ mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe =
355355
.label = call to function with `#[target_feature]`
356356
357357
mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe =
358-
call to unsafe function `{$function}` is unsafe and requires unsafe block (error E0133)
358+
call to unsafe function `{$function}` is unsafe and requires unsafe block
359359
.note = consult the function's documentation for information on how to avoid undefined behavior
360360
.label = call to unsafe function
361361
362362
mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless =
363-
call to unsafe function is unsafe and requires unsafe block (error E0133)
363+
call to unsafe function is unsafe and requires unsafe block
364364
.note = consult the function's documentation for information on how to avoid undefined behavior
365365
.label = call to unsafe function
366366
367367
mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe =
368-
dereference of raw pointer is unsafe and requires unsafe block (error E0133)
368+
dereference of raw pointer is unsafe and requires unsafe block
369369
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
370370
.label = dereference of raw pointer
371371
372372
mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe =
373-
use of extern static is unsafe and requires unsafe block (error E0133)
373+
use of extern static is unsafe and requires unsafe block
374374
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
375375
.label = use of extern static
376376
377377
mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe =
378-
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe
379-
block (error E0133)
378+
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe block
380379
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
381380
.label = initializing type with `rustc_layout_scalar_valid_range` attr
382381
383382
mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe =
384-
use of inline assembly is unsafe and requires unsafe block (error E0133)
383+
use of inline assembly is unsafe and requires unsafe block
385384
.note = inline assembly is entirely unchecked and can cause undefined behavior
386385
.label = use of inline assembly
387386
388387
mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe =
389-
use of mutable static is unsafe and requires unsafe block (error E0133)
388+
use of mutable static is unsafe and requires unsafe block
390389
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
391390
.label = use of mutable static
392391
393392
mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe =
394-
mutation of layout constrained field is unsafe and requires unsafe block (error E0133)
393+
mutation of layout constrained field is unsafe and requires unsafe block
395394
.note = mutating layout constrained fields cannot statically be checked for valid values
396395
.label = mutation of layout constrained field
397396
398397
mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe =
399-
access to union field is unsafe and requires unsafe block (error E0133)
398+
access to union field is unsafe and requires unsafe block
400399
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
401400
.label = access to union field
402401

compiler/rustc_mir_build/src/errors.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct UnconditionalRecursion {
2121
}
2222

2323
#[derive(LintDiagnostic)]
24-
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe)]
24+
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe, code = E0133)]
2525
#[note]
2626
pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
2727
#[label]
@@ -32,7 +32,7 @@ pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
3232
}
3333

3434
#[derive(LintDiagnostic)]
35-
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless)]
35+
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless, code = E0133)]
3636
#[note]
3737
pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
3838
#[label]
@@ -42,7 +42,7 @@ pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
4242
}
4343

4444
#[derive(LintDiagnostic)]
45-
#[diag(mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe)]
45+
#[diag(mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe, code = E0133)]
4646
#[note]
4747
pub struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
4848
#[label]
@@ -52,7 +52,7 @@ pub struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
5252
}
5353

5454
#[derive(LintDiagnostic)]
55-
#[diag(mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe)]
55+
#[diag(mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe, code = E0133)]
5656
#[note]
5757
pub struct UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
5858
#[label]
@@ -62,7 +62,7 @@ pub struct UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
6262
}
6363

6464
#[derive(LintDiagnostic)]
65-
#[diag(mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe)]
65+
#[diag(mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe, code = E0133)]
6666
#[note]
6767
pub struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
6868
#[label]
@@ -72,7 +72,7 @@ pub struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
7272
}
7373

7474
#[derive(LintDiagnostic)]
75-
#[diag(mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe)]
75+
#[diag(mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe, code = E0133)]
7676
#[note]
7777
pub struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
7878
#[label]
@@ -82,7 +82,7 @@ pub struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
8282
}
8383

8484
#[derive(LintDiagnostic)]
85-
#[diag(mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe)]
85+
#[diag(mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe, code = E0133)]
8686
#[note]
8787
pub struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
8888
#[label]
@@ -92,7 +92,7 @@ pub struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
9292
}
9393

9494
#[derive(LintDiagnostic)]
95-
#[diag(mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe)]
95+
#[diag(mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe, code = E0133)]
9696
#[note]
9797
pub struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
9898
#[label]
@@ -102,7 +102,10 @@ pub struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
102102
}
103103

104104
#[derive(LintDiagnostic)]
105-
#[diag(mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe)]
105+
#[diag(
106+
mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe,
107+
code = E0133
108+
)]
106109
#[note]
107110
pub struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
108111
#[label]
@@ -112,7 +115,10 @@ pub struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
112115
}
113116

114117
#[derive(LintDiagnostic)]
115-
#[diag(mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe)]
118+
#[diag(
119+
mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe,
120+
code = E0133,
121+
)]
116122
pub struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
117123
#[label]
118124
pub span: Span,
@@ -121,7 +127,7 @@ pub struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
121127
}
122128

123129
#[derive(LintDiagnostic)]
124-
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe)]
130+
#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe, code = E0133)]
125131
#[help]
126132
pub struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
127133
#[label]

src/tools/run-make-support/src/cc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ impl Cc {
4545
self
4646
}
4747

48+
/// Adds directories to the list that the linker searches for libraries.
49+
/// Equivalent to `-L`.
50+
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
51+
self.cmd.arg("-L");
52+
self.cmd.arg(path.as_ref());
53+
self
54+
}
55+
4856
/// Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler. This assumes that the executable
4957
/// is under `$TMPDIR`.
5058
pub fn out_exe(&mut self, name: &str) -> &mut Self {

src/tools/run-make-support/src/rustc.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,20 @@ impl Rustc {
156156
self
157157
}
158158

159-
/// Add a directory to the library search path. Equivalent to `-L`` in rustc.
159+
/// Add a directory to the library search path. Equivalent to `-L` in rustc.
160160
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
161161
self.cmd.arg("-L");
162162
self.cmd.arg(path.as_ref());
163163
self
164164
}
165165

166+
/// Override the system root. Equivalent to `--sysroot` in rustc.
167+
pub fn sysroot<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
168+
self.cmd.arg("--sysroot");
169+
self.cmd.arg(path.as_ref());
170+
self
171+
}
172+
166173
/// Specify the edition year.
167174
pub fn edition(&mut self, edition: &str) -> &mut Self {
168175
self.cmd.arg("--edition");

0 commit comments

Comments
 (0)