Skip to content

Commit 2fce229

Browse files
committed
Auto merge of #110924 - matthiaskrgr:rollup-jvznpq2, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #110766 (More core::fmt::rt cleanup.) - #110873 (Migrate trivially translatable `rustc_parse` diagnostics) - #110904 (rustdoc: rebind bound vars to type-outlives predicates) - #110913 (Add some missing built-in lints) - #110918 (`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied) - #110920 (Fix unavailable url) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 033aa09 + dda1494 commit 2fce229

37 files changed

+898
-638
lines changed

compiler/rustc_ast/src/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,7 @@ pub enum ItemKind {
29762976
}
29772977

29782978
impl ItemKind {
2979-
pub fn article(&self) -> &str {
2979+
pub fn article(&self) -> &'static str {
29802980
use ItemKind::*;
29812981
match self {
29822982
Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..)
@@ -2985,7 +2985,7 @@ impl ItemKind {
29852985
}
29862986
}
29872987

2988-
pub fn descr(&self) -> &str {
2988+
pub fn descr(&self) -> &'static str {
29892989
match self {
29902990
ItemKind::ExternCrate(..) => "extern crate",
29912991
ItemKind::Use(..) => "`use` import",

compiler/rustc_ast_lowering/src/format.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ enum ArgumentType {
186186
/// Generates:
187187
///
188188
/// ```text
189-
/// <core::fmt::ArgumentV1>::new_…(arg)
189+
/// <core::fmt::Argument>::new_…(arg)
190190
/// ```
191191
fn make_argument<'hir>(
192192
ctx: &mut LoweringContext<'_, 'hir>,
@@ -327,7 +327,7 @@ fn make_format_spec<'hir>(
327327
None => sym::Unknown,
328328
},
329329
);
330-
// This needs to match `FlagV1` in library/core/src/fmt/mod.rs.
330+
// This needs to match `Flag` in library/core/src/fmt/rt.rs.
331331
let flags: u32 = ((sign == Some(FormatSign::Plus)) as u32)
332332
| ((sign == Some(FormatSign::Minus)) as u32) << 1
333333
| (alternate as u32) << 2
@@ -438,7 +438,7 @@ fn expand_format_args<'hir>(
438438
// If the args array contains exactly all the original arguments once,
439439
// in order, we can use a simple array instead of a `match` construction.
440440
// However, if there's a yield point in any argument except the first one,
441-
// we don't do this, because an ArgumentV1 cannot be kept across yield points.
441+
// we don't do this, because an Argument cannot be kept across yield points.
442442
//
443443
// This is an optimization, speeding up compilation about 1-2% in some cases.
444444
// See https://github.com/rust-lang/rust/pull/106770#issuecomment-1380790609
@@ -449,9 +449,9 @@ fn expand_format_args<'hir>(
449449
let args = if use_simple_array {
450450
// Generate:
451451
// &[
452-
// <core::fmt::ArgumentV1>::new_display(&arg0),
453-
// <core::fmt::ArgumentV1>::new_lower_hex(&arg1),
454-
// <core::fmt::ArgumentV1>::new_debug(&arg2),
452+
// <core::fmt::Argument>::new_display(&arg0),
453+
// <core::fmt::Argument>::new_lower_hex(&arg1),
454+
// <core::fmt::Argument>::new_debug(&arg2),
455455
// …
456456
// ]
457457
let elements: Vec<_> = arguments
@@ -477,9 +477,9 @@ fn expand_format_args<'hir>(
477477
// Generate:
478478
// &match (&arg0, &arg1, &…) {
479479
// args => [
480-
// <core::fmt::ArgumentV1>::new_display(args.0),
481-
// <core::fmt::ArgumentV1>::new_lower_hex(args.1),
482-
// <core::fmt::ArgumentV1>::new_debug(args.0),
480+
// <core::fmt::Argument>::new_display(args.0),
481+
// <core::fmt::Argument>::new_lower_hex(args.1),
482+
// <core::fmt::Argument>::new_debug(args.0),
483483
// …
484484
// ]
485485
// }

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
296296
diag_trait(&mut err, self_ty, tcx.require_lang_item(LangItem::Deref, Some(span)));
297297
err
298298
}
299-
_ if tcx.opt_parent(callee) == tcx.get_diagnostic_item(sym::ArgumentV1Methods) => ccx
299+
_ if tcx.opt_parent(callee) == tcx.get_diagnostic_item(sym::ArgumentMethods) => ccx
300300
.tcx
301301
.sess
302302
.create_err(errors::NonConstFmtMacroCall { span, kind: ccx.const_kind() }),

compiler/rustc_lint_defs/src/builtin.rs

+93-88
Original file line numberDiff line numberDiff line change
@@ -3273,110 +3273,115 @@ declare_lint_pass! {
32733273
/// Does nothing as a lint pass, but registers some `Lint`s
32743274
/// that are used by other parts of the compiler.
32753275
HardwiredLints => [
3276-
FORBIDDEN_LINT_GROUPS,
3277-
ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
3276+
// tidy-alphabetical-start
3277+
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
3278+
AMBIGUOUS_ASSOCIATED_ITEMS,
3279+
AMBIGUOUS_GLOB_REEXPORTS,
32783280
ARITHMETIC_OVERFLOW,
3279-
UNCONDITIONAL_PANIC,
3280-
UNUSED_IMPORTS,
3281-
UNUSED_EXTERN_CRATES,
3282-
UNUSED_CRATE_DEPENDENCIES,
3283-
UNUSED_QUALIFICATIONS,
3284-
UNKNOWN_LINTS,
3285-
UNFULFILLED_LINT_EXPECTATIONS,
3286-
UNUSED_VARIABLES,
3287-
UNUSED_ASSIGNMENTS,
3288-
DEAD_CODE,
3289-
UNREACHABLE_CODE,
3290-
UNREACHABLE_PATTERNS,
3291-
OVERLAPPING_RANGE_ENDPOINTS,
3281+
ASM_SUB_REGISTER,
3282+
BAD_ASM_STYLE,
3283+
BARE_TRAIT_OBJECTS,
32923284
BINDINGS_WITH_VARIANT_NAME,
3293-
UNUSED_MACROS,
3294-
UNUSED_MACRO_RULES,
3295-
WARNINGS,
3296-
UNUSED_FEATURES,
3297-
STABLE_FEATURES,
3298-
UNKNOWN_CRATE_TYPES,
3299-
TRIVIAL_CASTS,
3300-
TRIVIAL_NUMERIC_CASTS,
3301-
PRIVATE_IN_PUBLIC,
3302-
EXPORTED_PRIVATE_DEPENDENCIES,
3303-
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
3304-
INVALID_TYPE_PARAM_DEFAULT,
3305-
RENAMED_AND_REMOVED_LINTS,
3306-
CONST_ITEM_MUTATION,
3307-
PATTERNS_IN_FNS_WITHOUT_BODY,
3308-
MISSING_FRAGMENT_SPECIFIER,
3309-
LATE_BOUND_LIFETIME_ARGUMENTS,
3310-
ORDER_DEPENDENT_TRAIT_OBJECTS,
3285+
BREAK_WITH_LABEL_AND_LOOP,
3286+
BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE,
3287+
CENUM_IMPL_DROP_CAST,
33113288
COHERENCE_LEAK_CHECK,
3289+
CONFLICTING_REPR_HINTS,
3290+
CONST_EVALUATABLE_UNCHECKED,
3291+
CONST_ITEM_MUTATION,
3292+
DEAD_CODE,
33123293
DEPRECATED,
3313-
UNUSED_UNSAFE,
3314-
UNUSED_MUT,
3315-
UNCONDITIONAL_RECURSION,
3316-
SINGLE_USE_LIFETIMES,
3317-
UNUSED_LIFETIMES,
3318-
UNUSED_LABELS,
3319-
TYVAR_BEHIND_RAW_POINTER,
3294+
DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
3295+
DEPRECATED_IN_FUTURE,
3296+
DEPRECATED_WHERE_CLAUSE_LOCATION,
3297+
DUPLICATE_MACRO_ATTRIBUTES,
33203298
ELIDED_LIFETIMES_IN_PATHS,
3321-
BARE_TRAIT_OBJECTS,
3322-
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
3323-
UNSTABLE_NAME_COLLISIONS,
3324-
IRREFUTABLE_LET_PATTERNS,
3325-
WHERE_CLAUSES_OBJECT_SAFETY,
3326-
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
3327-
MACRO_USE_EXTERN_CRATE,
3328-
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
3299+
EXPORTED_PRIVATE_DEPENDENCIES,
3300+
FFI_UNWIND_CALLS,
3301+
FORBIDDEN_LINT_GROUPS,
3302+
FUNCTION_ITEM_REFERENCES,
3303+
FUZZY_PROVENANCE_CASTS,
33293304
ILL_FORMED_ATTRIBUTE_INPUT,
3330-
CONFLICTING_REPR_HINTS,
3331-
META_VARIABLE_MISUSE,
3332-
DEPRECATED_IN_FUTURE,
3333-
AMBIGUOUS_ASSOCIATED_ITEMS,
3334-
INDIRECT_STRUCTURAL_MATCH,
3335-
POINTER_STRUCTURAL_MATCH,
3336-
NONTRIVIAL_STRUCTURAL_MATCH,
3337-
SOFT_UNSTABLE,
3338-
UNSTABLE_SYNTAX_PRE_EXPANSION,
3339-
INLINE_NO_SANITIZE,
3340-
BAD_ASM_STYLE,
3341-
ASM_SUB_REGISTER,
3342-
UNSAFE_OP_IN_UNSAFE_FN,
3305+
ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
3306+
IMPLIED_BOUNDS_ENTAILMENT,
33433307
INCOMPLETE_INCLUDE,
3344-
CENUM_IMPL_DROP_CAST,
3345-
FUZZY_PROVENANCE_CASTS,
3346-
LOSSY_PROVENANCE_CASTS,
3347-
CONST_EVALUATABLE_UNCHECKED,
3308+
INDIRECT_STRUCTURAL_MATCH,
33483309
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
3349-
MUST_NOT_SUSPEND,
3350-
UNINHABITED_STATIC,
3351-
FUNCTION_ITEM_REFERENCES,
3352-
USELESS_DEPRECATED,
3353-
MISSING_ABI,
3310+
INLINE_NO_SANITIZE,
3311+
INVALID_ALIGNMENT,
33543312
INVALID_DOC_ATTRIBUTES,
3355-
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
3356-
RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
3313+
INVALID_MACRO_EXPORT_ARGUMENTS,
3314+
INVALID_TYPE_PARAM_DEFAULT,
3315+
IRREFUTABLE_LET_PATTERNS,
3316+
LARGE_ASSIGNMENTS,
3317+
LATE_BOUND_LIFETIME_ARGUMENTS,
33573318
LEGACY_DERIVE_HELPERS,
3319+
LOSSY_PROVENANCE_CASTS,
3320+
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
3321+
MACRO_USE_EXTERN_CRATE,
3322+
META_VARIABLE_MISUSE,
3323+
MISSING_ABI,
3324+
MISSING_FRAGMENT_SPECIFIER,
3325+
MUST_NOT_SUSPEND,
3326+
NAMED_ARGUMENTS_USED_POSITIONALLY,
3327+
NON_EXHAUSTIVE_OMITTED_PATTERNS,
3328+
NONTRIVIAL_STRUCTURAL_MATCH,
3329+
ORDER_DEPENDENT_TRAIT_OBJECTS,
3330+
OVERLAPPING_RANGE_ENDPOINTS,
3331+
PATTERNS_IN_FNS_WITHOUT_BODY,
3332+
POINTER_STRUCTURAL_MATCH,
3333+
PRIVATE_IN_PUBLIC,
33583334
PROC_MACRO_BACK_COMPAT,
3335+
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
3336+
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
3337+
RENAMED_AND_REMOVED_LINTS,
3338+
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
3339+
RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
33593340
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
3360-
LARGE_ASSIGNMENTS,
3361-
RUST_2021_PRELUDE_COLLISIONS,
33623341
RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
3342+
RUST_2021_PRELUDE_COLLISIONS,
3343+
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
3344+
SINGLE_USE_LIFETIMES,
3345+
SOFT_UNSTABLE,
3346+
STABLE_FEATURES,
3347+
SUSPICIOUS_AUTO_TRAIT_IMPLS,
3348+
TEST_UNSTABLE_LINT,
3349+
TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
3350+
TRIVIAL_CASTS,
3351+
TRIVIAL_NUMERIC_CASTS,
3352+
TYVAR_BEHIND_RAW_POINTER,
3353+
UNCONDITIONAL_PANIC,
3354+
UNCONDITIONAL_RECURSION,
3355+
UNDEFINED_NAKED_FUNCTION_ABI,
3356+
UNFULFILLED_LINT_EXPECTATIONS,
3357+
UNINHABITED_STATIC,
3358+
UNKNOWN_CRATE_TYPES,
3359+
UNKNOWN_LINTS,
3360+
UNREACHABLE_CODE,
3361+
UNREACHABLE_PATTERNS,
3362+
UNSAFE_OP_IN_UNSAFE_FN,
3363+
UNSTABLE_NAME_COLLISIONS,
3364+
UNSTABLE_SYNTAX_PRE_EXPANSION,
33633365
UNSUPPORTED_CALLING_CONVENTIONS,
3364-
BREAK_WITH_LABEL_AND_LOOP,
3366+
UNUSED_ASSIGNMENTS,
33653367
UNUSED_ATTRIBUTES,
3368+
UNUSED_CRATE_DEPENDENCIES,
3369+
UNUSED_EXTERN_CRATES,
3370+
UNUSED_FEATURES,
3371+
UNUSED_IMPORTS,
3372+
UNUSED_LABELS,
3373+
UNUSED_LIFETIMES,
3374+
UNUSED_MACRO_RULES,
3375+
UNUSED_MACROS,
3376+
UNUSED_MUT,
3377+
UNUSED_QUALIFICATIONS,
33663378
UNUSED_TUPLE_STRUCT_FIELDS,
3367-
NON_EXHAUSTIVE_OMITTED_PATTERNS,
3368-
TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
3369-
DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
3370-
DUPLICATE_MACRO_ATTRIBUTES,
3371-
SUSPICIOUS_AUTO_TRAIT_IMPLS,
3372-
DEPRECATED_WHERE_CLAUSE_LOCATION,
3373-
TEST_UNSTABLE_LINT,
3374-
FFI_UNWIND_CALLS,
3375-
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
3376-
NAMED_ARGUMENTS_USED_POSITIONALLY,
3377-
IMPLIED_BOUNDS_ENTAILMENT,
3378-
BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE,
3379-
AMBIGUOUS_GLOB_REEXPORTS,
3379+
UNUSED_UNSAFE,
3380+
UNUSED_VARIABLES,
3381+
USELESS_DEPRECATED,
3382+
WARNINGS,
3383+
WHERE_CLAUSES_OBJECT_SAFETY,
3384+
// tidy-alphabetical-end
33803385
]
33813386
}
33823387

compiler/rustc_parse/messages.ftl

+72
Original file line numberDiff line numberDiff line change
@@ -772,3 +772,75 @@ parse_const_bounds_missing_tilde = const bounds must start with `~`
772772
.suggestion = add `~`
773773
774774
parse_underscore_literal_suffix = underscore literal suffix is not allowed
775+
776+
parse_expect_label_found_ident = expected a label, found an identifier
777+
.suggestion = labels start with a tick
778+
779+
parse_inappropriate_default = {$article} {$descr} cannot be `default`
780+
.label = `default` because of this
781+
.note = only associated `fn`, `const`, and `type` items can be `default`
782+
783+
parse_recover_import_as_use = expected item, found {$token_name}
784+
.suggestion = items are imported using the `use` keyword
785+
786+
parse_single_colon_import_path = expected `::`, found `:`
787+
.suggestion = use double colon
788+
.note = import paths are delimited using `::`
789+
790+
parse_bad_item_kind = {$descr} is not supported in {$ctx}
791+
.help = consider moving the {$descr} out to a nearby module scope
792+
793+
parse_single_colon_struct_type = found single colon in a struct field type path
794+
.suggestion = write a path separator here
795+
796+
parse_equals_struct_default = default values on `struct` fields aren't supported
797+
.suggestion = remove this unsupported default value
798+
799+
parse_macro_rules_missing_bang = expected `!` after `macro_rules`
800+
.suggestion = add a `!`
801+
802+
parse_macro_name_remove_bang = macro names aren't followed by a `!`
803+
.suggestion = remove the `!`
804+
805+
parse_macro_rules_visibility = can't qualify macro_rules invocation with `{$vis}`
806+
.suggestion = try exporting the macro
807+
808+
parse_macro_invocation_visibility = can't qualify macro invocation with `pub`
809+
.suggestion = remove the visibility
810+
.help = try adjusting the macro to put `{$vis}` inside the invocation
811+
812+
parse_nested_adt = `{$kw_str}` definition cannot be nested inside `{$keyword}`
813+
.suggestion = consider creating a new `{$kw_str}` definition instead of nesting
814+
815+
parse_function_body_equals_expr = function body cannot be `= expression;`
816+
.suggestion = surround the expression with `{"{"}` and `{"}"}` instead of `=` and `;`
817+
818+
parse_box_not_pat = expected pattern, found {$descr}
819+
.note = `box` is a reserved keyword
820+
.suggestion = escape `box` to use it as an identifier
821+
822+
parse_unmatched_angle = unmatched angle {$plural ->
823+
[true] brackets
824+
*[false] bracket
825+
}
826+
.suggestion = remove extra angle {$plural ->
827+
[true] brackets
828+
*[false] bracket
829+
}
830+
831+
parse_missing_plus_in_bounds = expected `+` between lifetime and {$sym}
832+
.suggestion = add `+`
833+
834+
parse_incorrect_braces_trait_bounds = incorrect braces around trait bounds
835+
.suggestion = remove the parentheses
836+
837+
parse_kw_bad_case = keyword `{$kw}` is written in the wrong case
838+
.suggestion = write it in the correct case
839+
840+
parse_meta_bad_delim = wrong meta list delimiters
841+
parse_cfg_attr_bad_delim = wrong `cfg_attr` delimiters
842+
parse_meta_bad_delim_suggestion = the delimiters should be `(` and `)`
843+
844+
parse_malformed_cfg_attr = malformed `cfg_attr` attribute input
845+
.suggestion = missing condition and attribute
846+
.note = for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>

0 commit comments

Comments
 (0)