Skip to content

Commit 2f0ad2a

Browse files
committed
Auto merge of rust-lang#136070 - matthiaskrgr:rollup-b5enbuz, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#134300 (remove long-deprecated no-op attributes no_start and crate_id) - rust-lang#134373 (Improve and expand documentation of pipes) - rust-lang#135934 (Include missing item in the 1.81 release notes) - rust-lang#136005 (ports last few library files to new intrinsic style) - rust-lang#136016 (Improve check-cfg expected names diagnostic) - rust-lang#136039 (docs: fix typo in std::pin overview) - rust-lang#136056 (Fix typo in const stability error message) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6fb0358 + 08c4d63 commit 2f0ad2a

Some content is hidden

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

45 files changed

+1277
-962
lines changed

Diff for: RELEASES.md

+1
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ Libraries
573573
- [Replace sort implementations with stable `driftsort` and unstable `ipnsort`.](https://github.com/rust-lang/rust/pull/124032/) All `slice::sort*` and `slice::select_nth*` methods are expected to see significant performance improvements. See the [research project](https://github.com/Voultapher/sort-research-rs) for more details.
574574
- [Document behavior of `create_dir_all` with respect to empty paths.](https://github.com/rust-lang/rust/pull/125112/)
575575
- [Fix interleaved output in the default panic hook when multiple threads panic simultaneously.](https://github.com/rust-lang/rust/pull/127397/)
576+
- Fix `Command`'s batch files argument escaping not working when file name has trailing whitespace or periods (CVE-2024-43402).
576577

577578
<a id="1.81.0-Stabilized-APIs"></a>
578579

Diff for: compiler/rustc_const_eval/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ const_eval_unsized_local = unsized locals are not supported
416416
const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
417417
const_eval_unstable_in_stable_exposed =
418418
const function that might be (indirectly) exposed to stable cannot use `#[feature({$gate})]`
419-
.is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
419+
.is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
420420
.unstable_sugg = if the {$is_function_call2 ->
421421
[true] caller
422422
*[false] function

Diff for: compiler/rustc_feature/src/builtin_attrs.rs

-6
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
408408
crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), DuplicatesOk,
409409
EncodeCrossCrate::No,
410410
),
411-
// crate_id is deprecated
412-
ungated!(
413-
crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing,
414-
EncodeCrossCrate::No,
415-
),
416411

417412
// ABI, linking, symbols, and FFI
418413
ungated!(
@@ -448,7 +443,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
448443
),
449444

450445
// Entry point:
451-
ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
452446
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
453447

454448
// Modules, prelude, and resolution:

Diff for: compiler/rustc_lint/messages.ftl

-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ lint_builtin_const_no_mangle = const items should never be `#[no_mangle]`
6969
7070
lint_builtin_decl_unsafe_fn = declaration of an `unsafe` function
7171
lint_builtin_decl_unsafe_method = declaration of an `unsafe` method
72-
lint_builtin_deprecated_attr_default_suggestion = remove this attribute
7372
7473
lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
7574
.msg_suggestion = {$msg}
7675
.default_suggestion = remove this attribute
77-
lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used
7876
lint_builtin_deref_nullptr = dereferencing a null pointer
7977
.label = this code causes undefined behavior when executed
8078

Diff for: compiler/rustc_lint/src/builtin.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_abi::BackendRepr;
2020
use rustc_ast::tokenstream::{TokenStream, TokenTree};
2121
use rustc_ast::visit::{FnCtxt, FnKind};
2222
use rustc_ast::{self as ast, *};
23-
use rustc_ast_pretty::pprust::{self, expr_to_string};
23+
use rustc_ast_pretty::pprust::expr_to_string;
2424
use rustc_errors::{Applicability, LintDiagnostic};
2525
use rustc_feature::{AttributeGate, BuiltinAttribute, GateIssue, Stability, deprecated_attributes};
2626
use rustc_hir as hir;
@@ -49,7 +49,7 @@ use rustc_trait_selection::traits::{self};
4949
use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
5050
use crate::lints::{
5151
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
52-
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
52+
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDerefNullptr,
5353
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
5454
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
5555
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
@@ -848,12 +848,6 @@ impl EarlyLintPass for DeprecatedAttr {
848848
return;
849849
}
850850
}
851-
if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
852-
cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed {
853-
name: pprust::path_to_string(&attr.get_normal_item().path),
854-
suggestion: attr.span,
855-
});
856-
}
857851
}
858852
}
859853

Diff for: compiler/rustc_lint/src/early/diagnostics/check_cfg.rs

+25-4
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,35 @@ use crate::lints;
1010

1111
const MAX_CHECK_CFG_NAMES_OR_VALUES: usize = 35;
1212

13+
enum FilterWellKnownNames {
14+
Yes,
15+
No,
16+
}
17+
1318
fn sort_and_truncate_possibilities(
1419
sess: &Session,
1520
mut possibilities: Vec<Symbol>,
21+
filter_well_known_names: FilterWellKnownNames,
1622
) -> (Vec<Symbol>, usize) {
23+
let possibilities_len = possibilities.len();
24+
1725
let n_possibilities = if sess.opts.unstable_opts.check_cfg_all_expected {
1826
possibilities.len()
1927
} else {
28+
match filter_well_known_names {
29+
FilterWellKnownNames::Yes => {
30+
possibilities.retain(|cfg_name| {
31+
!sess.psess.check_config.well_known_names.contains(cfg_name)
32+
});
33+
}
34+
FilterWellKnownNames::No => {}
35+
};
2036
std::cmp::min(possibilities.len(), MAX_CHECK_CFG_NAMES_OR_VALUES)
2137
};
2238

2339
possibilities.sort_by(|s1, s2| s1.as_str().cmp(s2.as_str()));
2440

25-
let and_more = possibilities.len().saturating_sub(n_possibilities);
41+
let and_more = possibilities_len.saturating_sub(n_possibilities);
2642
possibilities.truncate(n_possibilities);
2743
(possibilities, and_more)
2844
}
@@ -198,8 +214,10 @@ pub(super) fn unexpected_cfg_name(
198214
} else {
199215
vec![]
200216
};
217+
218+
let (possibilities, and_more) =
219+
sort_and_truncate_possibilities(sess, possibilities, FilterWellKnownNames::Yes);
201220
let expected_names = if !possibilities.is_empty() {
202-
let (possibilities, and_more) = sort_and_truncate_possibilities(sess, possibilities);
203221
let possibilities: Vec<_> =
204222
possibilities.into_iter().map(|s| Ident::new(s, name_span)).collect();
205223
Some(lints::unexpected_cfg_name::ExpectedNames {
@@ -269,8 +287,11 @@ pub(super) fn unexpected_cfg_value(
269287
// for names as the possibilities could be very long
270288
let code_sugg = if !possibilities.is_empty() {
271289
let expected_values = {
272-
let (possibilities, and_more) =
273-
sort_and_truncate_possibilities(sess, possibilities.clone());
290+
let (possibilities, and_more) = sort_and_truncate_possibilities(
291+
sess,
292+
possibilities.clone(),
293+
FilterWellKnownNames::No,
294+
);
274295
lints::unexpected_cfg_value::ExpectedValues {
275296
name,
276297
have_none_possibility,

Diff for: compiler/rustc_lint/src/lints.rs

-13
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,6 @@ pub(crate) enum BuiltinDeprecatedAttrLinkSuggestion<'a> {
177177
},
178178
}
179179

180-
#[derive(LintDiagnostic)]
181-
#[diag(lint_builtin_deprecated_attr_used)]
182-
pub(crate) struct BuiltinDeprecatedAttrUsed {
183-
pub name: String,
184-
#[suggestion(
185-
lint_builtin_deprecated_attr_default_suggestion,
186-
style = "short",
187-
code = "",
188-
applicability = "machine-applicable"
189-
)]
190-
pub suggestion: Span,
191-
}
192-
193180
#[derive(LintDiagnostic)]
194181
#[diag(lint_builtin_unused_doc_comment)]
195182
pub(crate) struct BuiltinUnusedDocComment<'a> {

Diff for: compiler/rustc_span/src/symbol.rs

-2
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ symbols! {
707707
coverage,
708708
coverage_attribute,
709709
cr,
710-
crate_id,
711710
crate_in_paths,
712711
crate_local,
713712
crate_name,
@@ -1390,7 +1389,6 @@ symbols! {
13901389
no_mangle,
13911390
no_sanitize,
13921391
no_stack_check,
1393-
no_start,
13941392
no_std,
13951393
nomem,
13961394
non_ascii_idents,

Diff for: library/core/src/ffi/va_list.rs

+22-12
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,28 @@ impl<'f> Drop for VaListImpl<'f> {
302302
}
303303
}
304304

305-
extern "rust-intrinsic" {
306-
/// Destroy the arglist `ap` after initialization with `va_start` or
307-
/// `va_copy`.
308-
#[rustc_nounwind]
309-
fn va_end(ap: &mut VaListImpl<'_>);
305+
/// Destroy the arglist `ap` after initialization with `va_start` or
306+
/// `va_copy`.
307+
#[rustc_intrinsic]
308+
#[rustc_intrinsic_must_be_overridden]
309+
#[rustc_nounwind]
310+
unsafe fn va_end(_ap: &mut VaListImpl<'_>) {
311+
unreachable!()
312+
}
310313

311-
/// Copies the current location of arglist `src` to the arglist `dst`.
312-
#[rustc_nounwind]
313-
fn va_copy<'f>(dest: *mut VaListImpl<'f>, src: &VaListImpl<'f>);
314+
/// Copies the current location of arglist `src` to the arglist `dst`.
315+
#[rustc_intrinsic]
316+
#[rustc_intrinsic_must_be_overridden]
317+
#[rustc_nounwind]
318+
unsafe fn va_copy<'f>(_dest: *mut VaListImpl<'f>, _src: &VaListImpl<'f>) {
319+
unreachable!()
320+
}
314321

315-
/// Loads an argument of type `T` from the `va_list` `ap` and increment the
316-
/// argument `ap` points to.
317-
#[rustc_nounwind]
318-
fn va_arg<T: sealed_trait::VaArgSafe>(ap: &mut VaListImpl<'_>) -> T;
322+
/// Loads an argument of type `T` from the `va_list` `ap` and increment the
323+
/// argument `ap` points to.
324+
#[rustc_intrinsic]
325+
#[rustc_intrinsic_must_be_overridden]
326+
#[rustc_nounwind]
327+
unsafe fn va_arg<T: sealed_trait::VaArgSafe>(_ap: &mut VaListImpl<'_>) -> T {
328+
unreachable!()
319329
}

0 commit comments

Comments
 (0)