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

Commit bdef683

Browse files
committed
Auto merge of rust-lang#126446 - workingjubilee:rollup-esdbgdw, r=workingjubilee
Rollup of 8 pull requests Successful merges: - rust-lang#121216 (Always emit `native-static-libs` note, even if it is empty) - rust-lang#123726 (Clarify `Command::new` behavior for programs with arguments) - rust-lang#125722 (Indicate in `non_local_defs` lint that the macro needs to change) - rust-lang#126088 ([1/2] clean-up / general improvements) - rust-lang#126390 (Fix wording in {checked_}next_power_of_two) - rust-lang#126392 (Small style improvement in `gvn.rs`) - rust-lang#126402 (Fix wrong `assert_unsafe_precondition` message for `core::ptr::copy`) - rust-lang#126445 (Remove failing GUI test to stop blocking CI until it is fixed) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f158600 + b7c8b09 commit bdef683

File tree

40 files changed

+209
-249
lines changed

40 files changed

+209
-249
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,17 +1561,13 @@ fn print_native_static_libs(
15611561
match out {
15621562
OutFileName::Real(path) => {
15631563
out.overwrite(&lib_args.join(" "), sess);
1564-
if !lib_args.is_empty() {
1565-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
1566-
}
1564+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
15671565
}
15681566
OutFileName::Stdout => {
1569-
if !lib_args.is_empty() {
1570-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1571-
// Prefix for greppability
1572-
// Note: This must not be translated as tools are allowed to depend on this exact string.
1573-
sess.dcx().note(format!("native-static-libs: {}", &lib_args.join(" ")));
1574-
}
1567+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1568+
// Prefix for greppability
1569+
// Note: This must not be translated as tools are allowed to depend on this exact string.
1570+
sess.dcx().note(format!("native-static-libs: {}", &lib_args.join(" ")));
15751571
}
15761572
}
15771573
}

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks sho
550550
.bounds = `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
551551
.exception = items in an anonymous const item (`const _: () = {"{"} ... {"}"}`) are treated as in the same scope as the anonymous const's declaration
552552
.const_anon = use a const-anon item to suppress this lint
553+
.macro_to_change = the {$macro_kind} `{$macro_to_change}` defines the non-local `impl`, and may need to be changed
553554
554555
lint_non_local_definitions_impl_move_help =
555556
move the `impl` block outside of this {$body_kind_descr} {$depth ->

compiler/rustc_lint/src/lints.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,7 @@ pub enum NonLocalDefinitionsDiag {
13621362
has_trait: bool,
13631363
self_ty_str: String,
13641364
of_trait_str: Option<String>,
1365+
macro_to_change: Option<(String, &'static str)>,
13651366
},
13661367
MacroRules {
13671368
depth: u32,
@@ -1387,6 +1388,7 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
13871388
has_trait,
13881389
self_ty_str,
13891390
of_trait_str,
1391+
macro_to_change,
13901392
} => {
13911393
diag.primary_message(fluent::lint_non_local_definitions_impl);
13921394
diag.arg("depth", depth);
@@ -1397,6 +1399,15 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
13971399
diag.arg("of_trait_str", of_trait_str);
13981400
}
13991401

1402+
if let Some((macro_to_change, macro_kind)) = macro_to_change {
1403+
diag.arg("macro_to_change", macro_to_change);
1404+
diag.arg("macro_kind", macro_kind);
1405+
diag.note(fluent::lint_macro_to_change);
1406+
}
1407+
if let Some(cargo_update) = cargo_update {
1408+
diag.subdiagnostic(&diag.dcx, cargo_update);
1409+
}
1410+
14001411
if has_trait {
14011412
diag.note(fluent::lint_bounds);
14021413
diag.note(fluent::lint_with_trait);
@@ -1422,9 +1433,6 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
14221433
);
14231434
}
14241435

1425-
if let Some(cargo_update) = cargo_update {
1426-
diag.subdiagnostic(&diag.dcx, cargo_update);
1427-
}
14281436
if let Some(const_anon) = const_anon {
14291437
diag.note(fluent::lint_exception);
14301438
if let Some(const_anon) = const_anon {

compiler/rustc_lint/src/non_local_def.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
258258
Some((cx.tcx.def_span(parent), may_move))
259259
};
260260

261+
let macro_to_change =
262+
if let ExpnKind::Macro(kind, name) = item.span.ctxt().outer_expn_data().kind {
263+
Some((name.to_string(), kind.descr()))
264+
} else {
265+
None
266+
};
267+
261268
cx.emit_span_lint(
262269
NON_LOCAL_DEFINITIONS,
263270
ms,
@@ -274,6 +281,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
274281
move_to,
275282
may_remove,
276283
has_trait: impl_.of_trait.is_some(),
284+
macro_to_change,
277285
},
278286
)
279287
}

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
330330
let is_sized = !self.feature_unsized_locals
331331
|| self.local_decls[local].ty.is_sized(self.tcx, self.param_env);
332332
if is_sized {
333-
self.rev_locals.ensure_contains_elem(value, SmallVec::new);
334-
self.rev_locals[value].push(local);
333+
self.rev_locals.ensure_contains_elem(value, SmallVec::new).push(local);
335334
}
336335
}
337336

library/core/src/intrinsics.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,8 +3043,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
30433043
unsafe {
30443044
ub_checks::assert_unsafe_precondition!(
30453045
check_language_ub,
3046-
"ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null \
3047-
and the specified memory ranges do not overlap",
3046+
"ptr::copy requires that both pointer arguments are aligned and non-null",
30483047
(
30493048
src: *const () = src as *const (),
30503049
dst: *mut () = dst as *mut (),

library/core/src/num/nonzero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
10591059
unsafe { Self::new_unchecked(self.get().unchecked_add(other)) }
10601060
}
10611061

1062-
/// Returns the smallest power of two greater than or equal to n.
1062+
/// Returns the smallest power of two greater than or equal to `self`.
10631063
/// Checks for overflow and returns [`None`]
10641064
/// if the next power of two is greater than the type’s maximum value.
10651065
/// As a consequence, the result cannot wrap to zero.

library/core/src/num/uint_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ macro_rules! uint_impl {
28302830
///
28312831
/// When return value overflows (i.e., `self > (1 << (N-1))` for type
28322832
/// `uN`), it panics in debug mode and the return value is wrapped to 0 in
2833-
/// release mode (the only situation in which method can return 0).
2833+
/// release mode (the only situation in which this method can return 0).
28342834
///
28352835
/// # Examples
28362836
///
@@ -2851,7 +2851,7 @@ macro_rules! uint_impl {
28512851
self.one_less_than_next_power_of_two() + 1
28522852
}
28532853

2854-
/// Returns the smallest power of two greater than or equal to `n`. If
2854+
/// Returns the smallest power of two greater than or equal to `self`. If
28552855
/// the next power of two is greater than the type's maximum value,
28562856
/// `None` is returned, otherwise the power of two is wrapped in `Some`.
28572857
///

library/std/src/process.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,25 @@ impl Command {
629629
/// .spawn()
630630
/// .expect("sh command failed to start");
631631
/// ```
632+
///
633+
/// # Caveats
634+
///
635+
/// [`Command::new`] is only intended to accept the path of the program. If you pass a program
636+
/// path along with arguments like `Command::new("ls -l").spawn()`, it will try to search for
637+
/// `ls -l` literally. The arguments need to be passed separately, such as via [`arg`] or
638+
/// [`args`].
639+
///
640+
/// ```no_run
641+
/// use std::process::Command;
642+
///
643+
/// Command::new("ls")
644+
/// .arg("-l") // arg passed separately
645+
/// .spawn()
646+
/// .expect("ls command failed to start");
647+
/// ```
648+
///
649+
/// [`arg`]: Self::arg
650+
/// [`args`]: Self::args
632651
#[stable(feature = "process", since = "1.0.0")]
633652
pub fn new<S: AsRef<OsStr>>(program: S) -> Command {
634653
Command { inner: imp::Command::new(program.as_ref()) }

src/bootstrap/src/core/build_steps/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn get_modified_rs_files(build: &Builder<'_>) -> Result<Option<Vec<String>>, Str
9393
return Ok(None);
9494
}
9595

96-
get_git_modified_files(&build.config.git_config(), Some(&build.config.src), &vec!["rs"])
96+
get_git_modified_files(&build.config.git_config(), Some(&build.config.src), &["rs"])
9797
}
9898

9999
#[derive(serde_derive::Deserialize)]

0 commit comments

Comments
 (0)