| author | bors <bors@rust-lang.org> 2024-08-29 20:45:00 UTC |
| committer | bors <bors@rust-lang.org> 2024-08-29 20:45:00 UTC |
| log | 0d634185dfddefe09047881175f35c65d68dcff1 |
| tree | c85fc78596b0d89063efefc1e1f3437e51c7e15e |
| parent | 784d444733d65c3d305ce5edcbb41e3d0d0aee2e |
| parent | 9c7ae1d4d88b5212eabff72441b7d316e52df164 |
Rollup of 7 pull requests
Successful merges:
- #123940 (debug-fmt-detail option)
- #128166 (Improved `checked_isqrt` and `isqrt` methods)
- #128970 (Add `-Zlint-llvm-ir`)
- #129316 (riscv64imac: allow shadow call stack sanitizer)
- #129690 (Add `needs-unwind` compiletest directive to `libtest-thread-limit` and replace some `Path` with `path` in `run-make`)
- #129732 (Add `unreachable_pub`, round 3)
- #129743 (Fix rustdoc clippy lints)
r? `@ghost`
`@rustbot` modify labels: rollup141 files changed, 1587 insertions(+), 644 deletions(-)
compiler/rustc_ast_lowering/src/format.rs+6-2| ... | ... | @@ -4,9 +4,10 @@ use std::borrow::Cow; |
| 4 | 4 | use rustc_ast::visit::Visitor; |
| 5 | 5 | use rustc_ast::*; |
| 6 | 6 | use rustc_data_structures::fx::FxIndexMap; |
| 7 | use rustc_hir as hir; | |
| 8 | use rustc_session::config::FmtDebug; | |
| 7 | 9 | use rustc_span::symbol::{kw, Ident}; |
| 8 | 10 | use rustc_span::{sym, Span, Symbol}; |
| 9 | use {rustc_ast as ast, rustc_hir as hir}; | |
| 10 | 11 | |
| 11 | 12 | use super::LoweringContext; |
| 12 | 13 | |
| ... | ... | @@ -243,7 +244,10 @@ fn make_argument<'hir>( |
| 243 | 244 | hir::LangItem::FormatArgument, |
| 244 | 245 | match ty { |
| 245 | 246 | Format(Display) => sym::new_display, |
| 246 | Format(Debug) => sym::new_debug, | |
| 247 | Format(Debug) => match ctx.tcx.sess.opts.unstable_opts.fmt_debug { | |
| 248 | FmtDebug::Full | FmtDebug::Shallow => sym::new_debug, | |
| 249 | FmtDebug::None => sym::new_debug_noop, | |
| 250 | }, | |
| 247 | 251 | Format(LowerExp) => sym::new_lower_exp, |
| 248 | 252 | Format(UpperExp) => sym::new_upper_exp, |
| 249 | 253 | Format(Octal) => sym::new_octal, |
compiler/rustc_builtin_macros/src/deriving/debug.rs+13| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use rustc_ast::{self as ast, EnumDef, MetaItem}; |
| 2 | 2 | use rustc_expand::base::{Annotatable, ExtCtxt}; |
| 3 | use rustc_session::config::FmtDebug; | |
| 3 | 4 | use rustc_span::symbol::{sym, Ident, Symbol}; |
| 4 | 5 | use rustc_span::Span; |
| 5 | 6 | use thin_vec::{thin_vec, ThinVec}; |
| ... | ... | @@ -49,6 +50,11 @@ fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> |
| 49 | 50 | // We want to make sure we have the ctxt set so that we can use unstable methods |
| 50 | 51 | let span = cx.with_def_site_ctxt(span); |
| 51 | 52 | |
| 53 | let fmt_detail = cx.sess.opts.unstable_opts.fmt_debug; | |
| 54 | if fmt_detail == FmtDebug::None { | |
| 55 | return BlockOrExpr::new_expr(cx.expr_ok(span, cx.expr_tuple(span, ThinVec::new()))); | |
| 56 | } | |
| 57 | ||
| 52 | 58 | let (ident, vdata, fields) = match substr.fields { |
| 53 | 59 | Struct(vdata, fields) => (substr.type_ident, *vdata, fields), |
| 54 | 60 | EnumMatching(_, v, fields) => (v.ident, &v.data, fields), |
| ... | ... | @@ -61,6 +67,13 @@ fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> |
| 61 | 67 | let name = cx.expr_str(span, ident.name); |
| 62 | 68 | let fmt = substr.nonselflike_args[0].clone(); |
| 63 | 69 | |
| 70 | // Fieldless enums have been special-cased earlier | |
| 71 | if fmt_detail == FmtDebug::Shallow { | |
| 72 | let fn_path_write_str = cx.std_path(&[sym::fmt, sym::Formatter, sym::write_str]); | |
| 73 | let expr = cx.expr_call_global(span, fn_path_write_str, thin_vec![fmt, name]); | |
| 74 | return BlockOrExpr::new_expr(expr); | |
| 75 | } | |
| 76 | ||
| 64 | 77 | // Struct and tuples are similar enough that we use the same code for both, |
| 65 | 78 | // with some extra pieces for structs due to the field names. |
| 66 | 79 | let (is_struct, args_per_field) = match vdata { |
compiler/rustc_codegen_llvm/src/back/write.rs+1| ... | ... | @@ -571,6 +571,7 @@ pub(crate) unsafe fn llvm_optimize( |
| 571 | 571 | cgcx.opts.cg.linker_plugin_lto.enabled(), |
| 572 | 572 | config.no_prepopulate_passes, |
| 573 | 573 | config.verify_llvm_ir, |
| 574 | config.lint_llvm_ir, | |
| 574 | 575 | using_thin_buffers, |
| 575 | 576 | config.merge_functions, |
| 576 | 577 | unroll_loops, |
compiler/rustc_codegen_llvm/src/llvm/ffi.rs+1| ... | ... | @@ -2225,6 +2225,7 @@ unsafe extern "C" { |
| 2225 | 2225 | IsLinkerPluginLTO: bool, |
| 2226 | 2226 | NoPrepopulatePasses: bool, |
| 2227 | 2227 | VerifyIR: bool, |
| 2228 | LintIR: bool, | |
| 2228 | 2229 | UseThinLTOBuffers: bool, |
| 2229 | 2230 | MergeFunctions: bool, |
| 2230 | 2231 | UnrollLoops: bool, |
compiler/rustc_codegen_ssa/src/back/write.rs+2| ... | ... | @@ -112,6 +112,7 @@ pub struct ModuleConfig { |
| 112 | 112 | // Miscellaneous flags. These are mostly copied from command-line |
| 113 | 113 | // options. |
| 114 | 114 | pub verify_llvm_ir: bool, |
| 115 | pub lint_llvm_ir: bool, | |
| 115 | 116 | pub no_prepopulate_passes: bool, |
| 116 | 117 | pub no_builtins: bool, |
| 117 | 118 | pub time_module: bool, |
| ... | ... | @@ -237,6 +238,7 @@ impl ModuleConfig { |
| 237 | 238 | bc_cmdline: sess.target.bitcode_llvm_cmdline.to_string(), |
| 238 | 239 | |
| 239 | 240 | verify_llvm_ir: sess.verify_llvm_ir(), |
| 241 | lint_llvm_ir: sess.opts.unstable_opts.lint_llvm_ir, | |
| 240 | 242 | no_prepopulate_passes: sess.opts.cg.no_prepopulate_passes, |
| 241 | 243 | no_builtins: no_builtins || sess.target.no_builtins, |
| 242 | 244 |
compiler/rustc_feature/src/builtin_attrs.rs+2| ... | ... | @@ -37,6 +37,8 @@ const GATED_CFGS: &[GatedCfg] = &[ |
| 37 | 37 | (sym::relocation_model, sym::cfg_relocation_model, cfg_fn!(cfg_relocation_model)), |
| 38 | 38 | (sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, cfg_fn!(cfg_sanitizer_cfi)), |
| 39 | 39 | (sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, cfg_fn!(cfg_sanitizer_cfi)), |
| 40 | // this is consistent with naming of the compiler flag it's for | |
| 41 | (sym::fmt_debug, sym::fmt_debug, cfg_fn!(fmt_debug)), | |
| 40 | 42 | ]; |
| 41 | 43 | |
| 42 | 44 | /// Find a gated cfg determined by the `pred`icate which is given the cfg's name. |
compiler/rustc_feature/src/unstable.rs+2| ... | ... | @@ -471,6 +471,8 @@ declare_features! ( |
| 471 | 471 | (unstable, ffi_const, "1.45.0", Some(58328)), |
| 472 | 472 | /// Allows the use of `#[ffi_pure]` on foreign functions. |
| 473 | 473 | (unstable, ffi_pure, "1.45.0", Some(58329)), |
| 474 | /// Controlling the behavior of fmt::Debug | |
| 475 | (unstable, fmt_debug, "CURRENT_RUSTC_VERSION", Some(129709)), | |
| 474 | 476 | /// Allows using `#[repr(align(...))]` on function items |
| 475 | 477 | (unstable, fn_align, "1.53.0", Some(82232)), |
| 476 | 478 | /// Support delegating implementation of functions to other already implemented functions. |
compiler/rustc_interface/src/tests.rs+7-5| ... | ... | @@ -10,11 +10,11 @@ use rustc_errors::{registry, ColorConfig}; |
| 10 | 10 | use rustc_session::config::{ |
| 11 | 11 | build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg, |
| 12 | 12 | CollapseMacroDebuginfo, CoverageLevel, CoverageOptions, DebugInfo, DumpMonoStatsFormat, |
| 13 | ErrorOutputType, ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold, | |
| 14 | Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail, | |
| 15 | LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, | |
| 16 | PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, | |
| 17 | SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, | |
| 13 | ErrorOutputType, ExternEntry, ExternLocation, Externs, FmtDebug, FunctionReturn, | |
| 14 | InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, | |
| 15 | LinkerPluginLto, LocationDetail, LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, | |
| 16 | OutputType, OutputTypes, PAuthKey, PacRet, Passes, PatchableFunctionEntry, Polonius, | |
| 17 | ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, | |
| 18 | 18 | }; |
| 19 | 19 | use rustc_session::lint::Level; |
| 20 | 20 | use rustc_session::search_paths::SearchPath; |
| ... | ... | @@ -780,6 +780,7 @@ fn test_unstable_options_tracking_hash() { |
| 780 | 780 | tracked!(fewer_names, Some(true)); |
| 781 | 781 | tracked!(fixed_x18, true); |
| 782 | 782 | tracked!(flatten_format_args, false); |
| 783 | tracked!(fmt_debug, FmtDebug::Shallow); | |
| 783 | 784 | tracked!(force_unstable_if_unmarked, true); |
| 784 | 785 | tracked!(fuel, Some(("abc".to_string(), 99))); |
| 785 | 786 | tracked!(function_return, FunctionReturn::ThunkExtern); |
| ... | ... | @@ -794,6 +795,7 @@ fn test_unstable_options_tracking_hash() { |
| 794 | 795 | tracked!(instrument_xray, Some(InstrumentXRay::default())); |
| 795 | 796 | tracked!(link_directives, false); |
| 796 | 797 | tracked!(link_only, true); |
| 798 | tracked!(lint_llvm_ir, true); | |
| 797 | 799 | tracked!(llvm_module_flag, vec![("bar".to_string(), 123, "max".to_string())]); |
| 798 | 800 | tracked!(llvm_plugins, vec![String::from("plugin_name")]); |
| 799 | 801 | tracked!(location_detail, LocationDetail { file: true, line: false, column: false }); |
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp+8-1| ... | ... | @@ -713,7 +713,7 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 713 | 713 | LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef, |
| 714 | 714 | LLVMRustPassBuilderOptLevel OptLevelRust, LLVMRustOptStage OptStage, |
| 715 | 715 | bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR, |
| 716 | bool UseThinLTOBuffers, bool MergeFunctions, bool UnrollLoops, | |
| 716 | bool LintIR, bool UseThinLTOBuffers, bool MergeFunctions, bool UnrollLoops, | |
| 717 | 717 | bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls, |
| 718 | 718 | bool EmitLifetimeMarkers, LLVMRustSanitizerOptions *SanitizerOptions, |
| 719 | 719 | const char *PGOGenPath, const char *PGOUsePath, bool InstrumentCoverage, |
| ... | ... | @@ -842,6 +842,13 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 842 | 842 | }); |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | if (LintIR) { | |
| 846 | PipelineStartEPCallbacks.push_back( | |
| 847 | [](ModulePassManager &MPM, OptimizationLevel Level) { | |
| 848 | MPM.addPass(createModuleToFunctionPassAdaptor(LintPass())); | |
| 849 | }); | |
| 850 | } | |
| 851 | ||
| 845 | 852 | if (InstrumentGCOV) { |
| 846 | 853 | PipelineStartEPCallbacks.push_back( |
| 847 | 854 | [](ModulePassManager &MPM, OptimizationLevel Level) { |
compiler/rustc_macros/src/diagnostics/mod.rs+3-3| ... | ... | @@ -55,7 +55,7 @@ use synstructure::Structure; |
| 55 | 55 | /// |
| 56 | 56 | /// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`: |
| 57 | 57 | /// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html> |
| 58 | pub fn diagnostic_derive(mut s: Structure<'_>) -> TokenStream { | |
| 58 | pub(super) fn diagnostic_derive(mut s: Structure<'_>) -> TokenStream { | |
| 59 | 59 | s.underscore_const(true); |
| 60 | 60 | DiagnosticDerive::new(s).into_tokens() |
| 61 | 61 | } |
| ... | ... | @@ -102,7 +102,7 @@ pub fn diagnostic_derive(mut s: Structure<'_>) -> TokenStream { |
| 102 | 102 | /// |
| 103 | 103 | /// See rustc dev guide for more examples on using the `#[derive(LintDiagnostic)]`: |
| 104 | 104 | /// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html#reference> |
| 105 | pub fn lint_diagnostic_derive(mut s: Structure<'_>) -> TokenStream { | |
| 105 | pub(super) fn lint_diagnostic_derive(mut s: Structure<'_>) -> TokenStream { | |
| 106 | 106 | s.underscore_const(true); |
| 107 | 107 | LintDiagnosticDerive::new(s).into_tokens() |
| 108 | 108 | } |
| ... | ... | @@ -153,7 +153,7 @@ pub fn lint_diagnostic_derive(mut s: Structure<'_>) -> TokenStream { |
| 153 | 153 | /// |
| 154 | 154 | /// diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident }); |
| 155 | 155 | /// ``` |
| 156 | pub fn subdiagnostic_derive(mut s: Structure<'_>) -> TokenStream { | |
| 156 | pub(super) fn subdiagnostic_derive(mut s: Structure<'_>) -> TokenStream { | |
| 157 | 157 | s.underscore_const(true); |
| 158 | 158 | SubdiagnosticDerive::new().into_tokens(s) |
| 159 | 159 | } |
compiler/rustc_macros/src/lib.rs+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | #![feature(proc_macro_diagnostic)] |
| 7 | 7 | #![feature(proc_macro_span)] |
| 8 | 8 | #![feature(proc_macro_tracked_env)] |
| 9 | #![warn(unreachable_pub)] | |
| 9 | 10 | // tidy-alphabetical-end |
| 10 | 11 | |
| 11 | 12 | use proc_macro::TokenStream; |
compiler/rustc_macros/src/lift.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use quote::quote; |
| 2 | 2 | use syn::parse_quote; |
| 3 | 3 | |
| 4 | pub fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 4 | pub(super) fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 5 | 5 | s.add_bounds(synstructure::AddBounds::Generics); |
| 6 | 6 | s.bind_with(|_| synstructure::BindStyle::Move); |
| 7 | 7 | s.underscore_const(true); |
compiler/rustc_macros/src/query.rs+1-1| ... | ... | @@ -307,7 +307,7 @@ fn add_query_desc_cached_impl( |
| 307 | 307 | }); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | pub fn rustc_queries(input: TokenStream) -> TokenStream { | |
| 310 | pub(super) fn rustc_queries(input: TokenStream) -> TokenStream { | |
| 311 | 311 | let queries = parse_macro_input!(input as List<Query>); |
| 312 | 312 | |
| 313 | 313 | let mut query_stream = quote! {}; |
compiler/rustc_macros/src/serialize.rs+20-8| ... | ... | @@ -3,7 +3,9 @@ use quote::{quote, quote_spanned}; |
| 3 | 3 | use syn::parse_quote; |
| 4 | 4 | use syn::spanned::Spanned; |
| 5 | 5 | |
| 6 | pub fn type_decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 6 | pub(super) fn type_decodable_derive( | |
| 7 | mut s: synstructure::Structure<'_>, | |
| 8 | ) -> proc_macro2::TokenStream { | |
| 7 | 9 | let decoder_ty = quote! { __D }; |
| 8 | 10 | let bound = if s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") { |
| 9 | 11 | quote! { <I = ::rustc_middle::ty::TyCtxt<'tcx>> } |
| ... | ... | @@ -20,7 +22,9 @@ pub fn type_decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2: |
| 20 | 22 | decodable_body(s, decoder_ty) |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | pub fn meta_decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 25 | pub(super) fn meta_decodable_derive( | |
| 26 | mut s: synstructure::Structure<'_>, | |
| 27 | ) -> proc_macro2::TokenStream { | |
| 24 | 28 | if !s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") { |
| 25 | 29 | s.add_impl_generic(parse_quote! { 'tcx }); |
| 26 | 30 | } |
| ... | ... | @@ -32,7 +36,7 @@ pub fn meta_decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2: |
| 32 | 36 | decodable_body(s, decoder_ty) |
| 33 | 37 | } |
| 34 | 38 | |
| 35 | pub fn decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 39 | pub(super) fn decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 36 | 40 | let decoder_ty = quote! { __D }; |
| 37 | 41 | s.add_impl_generic(parse_quote! { #decoder_ty: ::rustc_span::SpanDecoder }); |
| 38 | 42 | s.add_bounds(synstructure::AddBounds::Generics); |
| ... | ... | @@ -41,7 +45,9 @@ pub fn decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::Toke |
| 41 | 45 | decodable_body(s, decoder_ty) |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | pub fn decodable_generic_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 48 | pub(super) fn decodable_generic_derive( | |
| 49 | mut s: synstructure::Structure<'_>, | |
| 50 | ) -> proc_macro2::TokenStream { | |
| 45 | 51 | let decoder_ty = quote! { __D }; |
| 46 | 52 | s.add_impl_generic(parse_quote! { #decoder_ty: ::rustc_serialize::Decoder }); |
| 47 | 53 | s.add_bounds(synstructure::AddBounds::Generics); |
| ... | ... | @@ -123,7 +129,9 @@ fn decode_field(field: &syn::Field) -> proc_macro2::TokenStream { |
| 123 | 129 | quote_spanned! { field_span=> #decode_inner_method(#__decoder) } |
| 124 | 130 | } |
| 125 | 131 | |
| 126 | pub fn type_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 132 | pub(super) fn type_encodable_derive( | |
| 133 | mut s: synstructure::Structure<'_>, | |
| 134 | ) -> proc_macro2::TokenStream { | |
| 127 | 135 | let bound = if s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") { |
| 128 | 136 | quote! { <I = ::rustc_middle::ty::TyCtxt<'tcx>> } |
| 129 | 137 | } else if s.ast().generics.type_params().any(|ty| ty.ident == "I") { |
| ... | ... | @@ -140,7 +148,9 @@ pub fn type_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2: |
| 140 | 148 | encodable_body(s, encoder_ty, false) |
| 141 | 149 | } |
| 142 | 150 | |
| 143 | pub fn meta_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 151 | pub(super) fn meta_encodable_derive( | |
| 152 | mut s: synstructure::Structure<'_>, | |
| 153 | ) -> proc_macro2::TokenStream { | |
| 144 | 154 | if !s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") { |
| 145 | 155 | s.add_impl_generic(parse_quote! { 'tcx }); |
| 146 | 156 | } |
| ... | ... | @@ -152,7 +162,7 @@ pub fn meta_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2: |
| 152 | 162 | encodable_body(s, encoder_ty, true) |
| 153 | 163 | } |
| 154 | 164 | |
| 155 | pub fn encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 165 | pub(super) fn encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 156 | 166 | let encoder_ty = quote! { __E }; |
| 157 | 167 | s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_span::SpanEncoder }); |
| 158 | 168 | s.add_bounds(synstructure::AddBounds::Generics); |
| ... | ... | @@ -161,7 +171,9 @@ pub fn encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::Toke |
| 161 | 171 | encodable_body(s, encoder_ty, false) |
| 162 | 172 | } |
| 163 | 173 | |
| 164 | pub fn encodable_generic_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 174 | pub(super) fn encodable_generic_derive( | |
| 175 | mut s: synstructure::Structure<'_>, | |
| 176 | ) -> proc_macro2::TokenStream { | |
| 165 | 177 | let encoder_ty = quote! { __E }; |
| 166 | 178 | s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_serialize::Encoder }); |
| 167 | 179 | s.add_bounds(synstructure::AddBounds::Generics); |
compiler/rustc_macros/src/symbols.rs+1-1| ... | ... | @@ -131,7 +131,7 @@ impl Errors { |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | pub fn symbols(input: TokenStream) -> TokenStream { | |
| 134 | pub(super) fn symbols(input: TokenStream) -> TokenStream { | |
| 135 | 135 | let (mut output, errors) = symbols_with_errors(input); |
| 136 | 136 | |
| 137 | 137 | // If we generated any errors, then report them as compiler_error!() macro calls. |
compiler/rustc_macros/src/type_foldable.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use quote::{quote, ToTokens}; |
| 2 | 2 | use syn::parse_quote; |
| 3 | 3 | |
| 4 | pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 4 | pub(super) fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 5 | 5 | if let syn::Data::Union(_) = s.ast().data { |
| 6 | 6 | panic!("cannot derive on union") |
| 7 | 7 | } |
compiler/rustc_macros/src/type_visitable.rs+3-1| ... | ... | @@ -1,7 +1,9 @@ |
| 1 | 1 | use quote::quote; |
| 2 | 2 | use syn::parse_quote; |
| 3 | 3 | |
| 4 | pub fn type_visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { | |
| 4 | pub(super) fn type_visitable_derive( | |
| 5 | mut s: synstructure::Structure<'_>, | |
| 6 | ) -> proc_macro2::TokenStream { | |
| 5 | 7 | if let syn::Data::Union(_) = s.ast().data { |
| 6 | 8 | panic!("cannot derive on union") |
| 7 | 9 | } |
compiler/rustc_metadata/src/lib.rs+1| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #![feature(proc_macro_internals)] |
| 17 | 17 | #![feature(rustdoc_internals)] |
| 18 | 18 | #![feature(trusted_len)] |
| 19 | #![warn(unreachable_pub)] | |
| 19 | 20 | // tidy-alphabetical-end |
| 20 | 21 | |
| 21 | 22 | extern crate proc_macro; |
compiler/rustc_metadata/src/rmeta/decoder.rs+5-5| ... | ... | @@ -56,13 +56,13 @@ impl std::ops::Deref for MetadataBlob { |
| 56 | 56 | |
| 57 | 57 | impl MetadataBlob { |
| 58 | 58 | /// Runs the [`MemDecoder`] validation and if it passes, constructs a new [`MetadataBlob`]. |
| 59 | pub fn new(slice: OwnedSlice) -> Result<Self, ()> { | |
| 59 | pub(crate) fn new(slice: OwnedSlice) -> Result<Self, ()> { | |
| 60 | 60 | if MemDecoder::new(&slice, 0).is_ok() { Ok(Self(slice)) } else { Err(()) } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /// Since this has passed the validation of [`MetadataBlob::new`], this returns bytes which are |
| 64 | 64 | /// known to pass the [`MemDecoder`] validation. |
| 65 | pub fn bytes(&self) -> &OwnedSlice { | |
| 65 | pub(crate) fn bytes(&self) -> &OwnedSlice { | |
| 66 | 66 | &self.0 |
| 67 | 67 | } |
| 68 | 68 | } |
| ... | ... | @@ -332,12 +332,12 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | #[inline] |
| 335 | pub fn blob(&self) -> &'a MetadataBlob { | |
| 335 | pub(crate) fn blob(&self) -> &'a MetadataBlob { | |
| 336 | 336 | self.blob |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | #[inline] |
| 340 | pub fn cdata(&self) -> CrateMetadataRef<'a> { | |
| 340 | fn cdata(&self) -> CrateMetadataRef<'a> { | |
| 341 | 341 | debug_assert!(self.cdata.is_some(), "missing CrateMetadata in DecodeContext"); |
| 342 | 342 | self.cdata.unwrap() |
| 343 | 343 | } |
| ... | ... | @@ -377,7 +377,7 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | #[inline] |
| 380 | pub fn read_raw_bytes(&mut self, len: usize) -> &[u8] { | |
| 380 | fn read_raw_bytes(&mut self, len: usize) -> &[u8] { | |
| 381 | 381 | self.opaque.read_raw_bytes(len) |
| 382 | 382 | } |
| 383 | 383 | } |
compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs+1-1| ... | ... | @@ -17,7 +17,7 @@ parameterized_over_tcx! { |
| 17 | 17 | |
| 18 | 18 | impl DefPathHashMapRef<'_> { |
| 19 | 19 | #[inline] |
| 20 | pub fn def_path_hash_to_def_index(&self, def_path_hash: &DefPathHash) -> DefIndex { | |
| 20 | pub(crate) fn def_path_hash_to_def_index(&self, def_path_hash: &DefPathHash) -> DefIndex { | |
| 21 | 21 | match *self { |
| 22 | 22 | DefPathHashMapRef::OwnedFromMetadata(ref map) => { |
| 23 | 23 | map.get(&def_path_hash.local_hash()).unwrap() |
compiler/rustc_metadata/src/rmeta/encoder.rs+1-1| ... | ... | @@ -2309,7 +2309,7 @@ fn encode_root_position(mut file: &File, pos: usize) -> Result<(), std::io::Erro |
| 2309 | 2309 | Ok(()) |
| 2310 | 2310 | } |
| 2311 | 2311 | |
| 2312 | pub fn provide(providers: &mut Providers) { | |
| 2312 | pub(crate) fn provide(providers: &mut Providers) { | |
| 2313 | 2313 | *providers = Providers { |
| 2314 | 2314 | doc_link_resolutions: |tcx, def_id| { |
| 2315 | 2315 | tcx.resolutions(()) |
compiler/rustc_middle/src/dep_graph/dep_node.rs+3-2| ... | ... | @@ -61,8 +61,9 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalModDefId, ModDefId, LO |
| 61 | 61 | use rustc_hir::definitions::DefPathHash; |
| 62 | 62 | use rustc_hir::{HirId, ItemLocalId, OwnerId}; |
| 63 | 63 | pub use rustc_query_system::dep_graph::dep_node::DepKind; |
| 64 | pub use rustc_query_system::dep_graph::DepNode; | |
| 64 | 65 | use rustc_query_system::dep_graph::FingerprintStyle; |
| 65 | pub use rustc_query_system::dep_graph::{DepContext, DepNode, DepNodeParams}; | |
| 66 | pub(crate) use rustc_query_system::dep_graph::{DepContext, DepNodeParams}; | |
| 66 | 67 | use rustc_span::symbol::Symbol; |
| 67 | 68 | |
| 68 | 69 | use crate::mir::mono::MonoItem; |
| ... | ... | @@ -101,7 +102,7 @@ macro_rules! define_dep_nodes { |
| 101 | 102 | |
| 102 | 103 | // This checks that the discriminants of the variants have been assigned consecutively |
| 103 | 104 | // from 0 so that they can be used as a dense index. |
| 104 | pub const DEP_KIND_VARIANTS: u16 = { | |
| 105 | pub(crate) const DEP_KIND_VARIANTS: u16 = { | |
| 105 | 106 | let deps = &[$(dep_kinds::$variant,)*]; |
| 106 | 107 | let mut i = 0; |
| 107 | 108 | while i < deps.len() { |
compiler/rustc_middle/src/lib.rs+1| ... | ... | @@ -62,6 +62,7 @@ |
| 62 | 62 | #![feature(try_blocks)] |
| 63 | 63 | #![feature(type_alias_impl_trait)] |
| 64 | 64 | #![feature(yeet_expr)] |
| 65 | #![warn(unreachable_pub)] | |
| 65 | 66 | // tidy-alphabetical-end |
| 66 | 67 | |
| 67 | 68 | #[cfg(test)] |
compiler/rustc_middle/src/mir/basic_blocks.rs+2-2| ... | ... | @@ -18,9 +18,9 @@ pub struct BasicBlocks<'tcx> { |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Typically 95%+ of basic blocks have 4 or fewer predecessors. |
| 21 | pub type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>; | |
| 21 | type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>; | |
| 22 | 22 | |
| 23 | pub type SwitchSources = FxHashMap<(BasicBlock, BasicBlock), SmallVec<[Option<u128>; 1]>>; | |
| 23 | type SwitchSources = FxHashMap<(BasicBlock, BasicBlock), SmallVec<[Option<u128>; 1]>>; | |
| 24 | 24 | |
| 25 | 25 | #[derive(Clone, Default, Debug)] |
| 26 | 26 | struct Cache { |
compiler/rustc_middle/src/mir/generic_graph.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ use gsgdt::{Edge, Graph, Node, NodeStyle}; |
| 2 | 2 | use rustc_middle::mir::*; |
| 3 | 3 | |
| 4 | 4 | /// Convert an MIR function into a gsgdt Graph |
| 5 | pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph { | |
| 5 | pub(crate) fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph { | |
| 6 | 6 | let def_id = body.source.def_id(); |
| 7 | 7 | let def_name = graphviz_safe_def_name(def_id); |
| 8 | 8 | let graph_name = format!("Mir_{def_name}"); |
compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs+1-1| ... | ... | @@ -243,7 +243,7 @@ impl hash::Hash for InitMaskMaterialized { |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | impl InitMaskMaterialized { |
| 246 | pub const BLOCK_SIZE: u64 = 64; | |
| 246 | const BLOCK_SIZE: u64 = 64; | |
| 247 | 247 | |
| 248 | 248 | fn new(size: Size, state: bool) -> Self { |
| 249 | 249 | let mut m = InitMaskMaterialized { blocks: vec![] }; |
compiler/rustc_middle/src/mir/mono.rs+1-1| ... | ... | @@ -396,7 +396,7 @@ impl<'tcx> CodegenUnit<'tcx> { |
| 396 | 396 | // The codegen tests rely on items being process in the same order as |
| 397 | 397 | // they appear in the file, so for local items, we sort by node_id first |
| 398 | 398 | #[derive(PartialEq, Eq, PartialOrd, Ord)] |
| 399 | pub struct ItemSortKey<'tcx>(Option<usize>, SymbolName<'tcx>); | |
| 399 | struct ItemSortKey<'tcx>(Option<usize>, SymbolName<'tcx>); | |
| 400 | 400 | |
| 401 | 401 | fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey<'tcx> { |
| 402 | 402 | ItemSortKey( |
compiler/rustc_middle/src/ty/context.rs+1-1| ... | ... | @@ -2190,7 +2190,7 @@ macro_rules! sty_debug_print { |
| 2190 | 2190 | all_infer: usize, |
| 2191 | 2191 | } |
| 2192 | 2192 | |
| 2193 | pub fn go(fmt: &mut std::fmt::Formatter<'_>, tcx: TyCtxt<'_>) -> std::fmt::Result { | |
| 2193 | pub(crate) fn go(fmt: &mut std::fmt::Formatter<'_>, tcx: TyCtxt<'_>) -> std::fmt::Result { | |
| 2194 | 2194 | let mut total = DebugStat { |
| 2195 | 2195 | total: 0, |
| 2196 | 2196 | lt_infer: 0, |
compiler/rustc_mir_build/src/check_unsafety.rs+1-1| ... | ... | @@ -1027,7 +1027,7 @@ impl UnsafeOpKind { |
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | pub fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) { | |
| 1030 | pub(crate) fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) { | |
| 1031 | 1031 | // Closures and inline consts are handled by their owner, if it has a body |
| 1032 | 1032 | // Also, don't safety check custom MIR |
| 1033 | 1033 | if tcx.is_typeck_child(def.to_def_id()) || tcx.has_attr(def, sym::custom_mir) { |
compiler/rustc_mir_build/src/lib.rs+1| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | #![feature(if_let_guard)] |
| 9 | 9 | #![feature(let_chains)] |
| 10 | 10 | #![feature(try_blocks)] |
| 11 | #![warn(unreachable_pub)] | |
| 11 | 12 | // tidy-alphabetical-end |
| 12 | 13 | |
| 13 | 14 | mod build; |
compiler/rustc_mir_dataflow/src/framework/engine.rs+1-1| ... | ... | @@ -24,7 +24,7 @@ use crate::errors::{ |
| 24 | 24 | }; |
| 25 | 25 | use crate::framework::BitSetExt; |
| 26 | 26 | |
| 27 | pub type EntrySets<'tcx, A> = IndexVec<BasicBlock, <A as AnalysisDomain<'tcx>>::Domain>; | |
| 27 | type EntrySets<'tcx, A> = IndexVec<BasicBlock, <A as AnalysisDomain<'tcx>>::Domain>; | |
| 28 | 28 | |
| 29 | 29 | /// A dataflow analysis that has converged to fixpoint. |
| 30 | 30 | #[derive(Clone)] |
compiler/rustc_mir_dataflow/src/framework/mod.rs+2-2| ... | ... | @@ -510,7 +510,7 @@ impl<T: Idx> GenKill<T> for lattice::Dual<BitSet<T>> { |
| 510 | 510 | |
| 511 | 511 | // NOTE: DO NOT CHANGE VARIANT ORDER. The derived `Ord` impls rely on the current order. |
| 512 | 512 | #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] |
| 513 | pub enum Effect { | |
| 513 | enum Effect { | |
| 514 | 514 | /// The "before" effect (e.g., `apply_before_statement_effect`) for a statement (or |
| 515 | 515 | /// terminator). |
| 516 | 516 | Before, |
| ... | ... | @@ -520,7 +520,7 @@ pub enum Effect { |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | impl Effect { |
| 523 | pub const fn at_index(self, statement_index: usize) -> EffectIndex { | |
| 523 | const fn at_index(self, statement_index: usize) -> EffectIndex { | |
| 524 | 524 | EffectIndex { effect: self, statement_index } |
| 525 | 525 | } |
| 526 | 526 | } |
compiler/rustc_mir_dataflow/src/lib.rs+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | #![feature(exact_size_is_empty)] |
| 6 | 6 | #![feature(let_chains)] |
| 7 | 7 | #![feature(try_blocks)] |
| 8 | #![warn(unreachable_pub)] | |
| 8 | 9 | // tidy-alphabetical-end |
| 9 | 10 | |
| 10 | 11 | use rustc_middle::ty; |
compiler/rustc_mir_dataflow/src/move_paths/abs_domain.rs+4-4| ... | ... | @@ -15,12 +15,12 @@ use rustc_middle::mir::{Local, Operand, PlaceElem, ProjectionElem}; |
| 15 | 15 | use rustc_middle::ty::Ty; |
| 16 | 16 | |
| 17 | 17 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 18 | pub struct AbstractOperand; | |
| 18 | pub(crate) struct AbstractOperand; | |
| 19 | 19 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 20 | pub struct AbstractType; | |
| 21 | pub type AbstractElem = ProjectionElem<AbstractOperand, AbstractType>; | |
| 20 | pub(crate) struct AbstractType; | |
| 21 | pub(crate) type AbstractElem = ProjectionElem<AbstractOperand, AbstractType>; | |
| 22 | 22 | |
| 23 | pub trait Lift { | |
| 23 | pub(crate) trait Lift { | |
| 24 | 24 | type Abstract; |
| 25 | 25 | fn lift(&self) -> Self::Abstract; |
| 26 | 26 | } |
compiler/rustc_monomorphize/src/collector.rs+10-6| ... | ... | @@ -242,12 +242,12 @@ use tracing::{debug, instrument, trace}; |
| 242 | 242 | use crate::errors::{self, EncounteredErrorWhileInstantiating, NoOptimizedMir, RecursionLimit}; |
| 243 | 243 | |
| 244 | 244 | #[derive(PartialEq)] |
| 245 | pub enum MonoItemCollectionStrategy { | |
| 245 | pub(crate) enum MonoItemCollectionStrategy { | |
| 246 | 246 | Eager, |
| 247 | 247 | Lazy, |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | pub struct UsageMap<'tcx> { | |
| 250 | pub(crate) struct UsageMap<'tcx> { | |
| 251 | 251 | // Maps every mono item to the mono items used by it. |
| 252 | 252 | used_map: UnordMap<MonoItem<'tcx>, Vec<MonoItem<'tcx>>>, |
| 253 | 253 | |
| ... | ... | @@ -306,13 +306,17 @@ impl<'tcx> UsageMap<'tcx> { |
| 306 | 306 | assert!(self.used_map.insert(user_item, used_items).is_none()); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | pub fn get_user_items(&self, item: MonoItem<'tcx>) -> &[MonoItem<'tcx>] { | |
| 309 | pub(crate) fn get_user_items(&self, item: MonoItem<'tcx>) -> &[MonoItem<'tcx>] { | |
| 310 | 310 | self.user_map.get(&item).map(|items| items.as_slice()).unwrap_or(&[]) |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /// Internally iterate over all inlined items used by `item`. |
| 314 | pub fn for_each_inlined_used_item<F>(&self, tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>, mut f: F) | |
| 315 | where | |
| 314 | pub(crate) fn for_each_inlined_used_item<F>( | |
| 315 | &self, | |
| 316 | tcx: TyCtxt<'tcx>, | |
| 317 | item: MonoItem<'tcx>, | |
| 318 | mut f: F, | |
| 319 | ) where | |
| 316 | 320 | F: FnMut(MonoItem<'tcx>), |
| 317 | 321 | { |
| 318 | 322 | let used_items = self.used_map.get(&item).unwrap(); |
| ... | ... | @@ -1615,6 +1619,6 @@ pub(crate) fn collect_crate_mono_items<'tcx>( |
| 1615 | 1619 | (mono_items, state.usage_map.into_inner()) |
| 1616 | 1620 | } |
| 1617 | 1621 | |
| 1618 | pub fn provide(providers: &mut Providers) { | |
| 1622 | pub(crate) fn provide(providers: &mut Providers) { | |
| 1619 | 1623 | providers.hooks.should_codegen_locally = should_codegen_locally; |
| 1620 | 1624 | } |
compiler/rustc_monomorphize/src/errors.rs+9-9| ... | ... | @@ -8,7 +8,7 @@ use crate::fluent_generated as fluent; |
| 8 | 8 | |
| 9 | 9 | #[derive(Diagnostic)] |
| 10 | 10 | #[diag(monomorphize_recursion_limit)] |
| 11 | pub struct RecursionLimit { | |
| 11 | pub(crate) struct RecursionLimit { | |
| 12 | 12 | #[primary_span] |
| 13 | 13 | pub span: Span, |
| 14 | 14 | pub shrunk: String, |
| ... | ... | @@ -22,13 +22,13 @@ pub struct RecursionLimit { |
| 22 | 22 | |
| 23 | 23 | #[derive(Diagnostic)] |
| 24 | 24 | #[diag(monomorphize_no_optimized_mir)] |
| 25 | pub struct NoOptimizedMir { | |
| 25 | pub(crate) struct NoOptimizedMir { | |
| 26 | 26 | #[note] |
| 27 | 27 | pub span: Span, |
| 28 | 28 | pub crate_name: Symbol, |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | pub struct UnusedGenericParamsHint { | |
| 31 | pub(crate) struct UnusedGenericParamsHint { | |
| 32 | 32 | pub span: Span, |
| 33 | 33 | pub param_spans: Vec<Span>, |
| 34 | 34 | pub param_names: Vec<String>, |
| ... | ... | @@ -53,7 +53,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for UnusedGenericParamsHint { |
| 53 | 53 | #[derive(LintDiagnostic)] |
| 54 | 54 | #[diag(monomorphize_large_assignments)] |
| 55 | 55 | #[note] |
| 56 | pub struct LargeAssignmentsLint { | |
| 56 | pub(crate) struct LargeAssignmentsLint { | |
| 57 | 57 | #[label] |
| 58 | 58 | pub span: Span, |
| 59 | 59 | pub size: u64, |
| ... | ... | @@ -62,7 +62,7 @@ pub struct LargeAssignmentsLint { |
| 62 | 62 | |
| 63 | 63 | #[derive(Diagnostic)] |
| 64 | 64 | #[diag(monomorphize_symbol_already_defined)] |
| 65 | pub struct SymbolAlreadyDefined { | |
| 65 | pub(crate) struct SymbolAlreadyDefined { | |
| 66 | 66 | #[primary_span] |
| 67 | 67 | pub span: Option<Span>, |
| 68 | 68 | pub symbol: String, |
| ... | ... | @@ -70,13 +70,13 @@ pub struct SymbolAlreadyDefined { |
| 70 | 70 | |
| 71 | 71 | #[derive(Diagnostic)] |
| 72 | 72 | #[diag(monomorphize_couldnt_dump_mono_stats)] |
| 73 | pub struct CouldntDumpMonoStats { | |
| 73 | pub(crate) struct CouldntDumpMonoStats { | |
| 74 | 74 | pub error: String, |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | #[derive(Diagnostic)] |
| 78 | 78 | #[diag(monomorphize_encountered_error_while_instantiating)] |
| 79 | pub struct EncounteredErrorWhileInstantiating { | |
| 79 | pub(crate) struct EncounteredErrorWhileInstantiating { | |
| 80 | 80 | #[primary_span] |
| 81 | 81 | pub span: Span, |
| 82 | 82 | pub formatted_item: String, |
| ... | ... | @@ -85,10 +85,10 @@ pub struct EncounteredErrorWhileInstantiating { |
| 85 | 85 | #[derive(Diagnostic)] |
| 86 | 86 | #[diag(monomorphize_start_not_found)] |
| 87 | 87 | #[help] |
| 88 | pub struct StartNotFound; | |
| 88 | pub(crate) struct StartNotFound; | |
| 89 | 89 | |
| 90 | 90 | #[derive(Diagnostic)] |
| 91 | 91 | #[diag(monomorphize_unknown_cgu_collection_mode)] |
| 92 | pub struct UnknownCguCollectionMode<'a> { | |
| 92 | pub(crate) struct UnknownCguCollectionMode<'a> { | |
| 93 | 93 | pub mode: &'a str, |
| 94 | 94 | } |
compiler/rustc_monomorphize/src/lib.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | // tidy-alphabetical-start |
| 2 | 2 | #![feature(array_windows)] |
| 3 | #![warn(unreachable_pub)] | |
| 3 | 4 | // tidy-alphabetical-end |
| 4 | 5 | |
| 5 | 6 | use rustc_hir::lang_items::LangItem; |
compiler/rustc_monomorphize/src/partitioning.rs+1-1| ... | ... | @@ -1300,7 +1300,7 @@ fn dump_mono_items_stats<'tcx>( |
| 1300 | 1300 | Ok(()) |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | pub fn provide(providers: &mut Providers) { | |
| 1303 | pub(crate) fn provide(providers: &mut Providers) { | |
| 1304 | 1304 | providers.collect_and_partition_mono_items = collect_and_partition_mono_items; |
| 1305 | 1305 | |
| 1306 | 1306 | providers.is_codegened_item = |tcx, def_id| { |
compiler/rustc_monomorphize/src/polymorphize.rs+1-1| ... | ... | @@ -19,7 +19,7 @@ use tracing::{debug, instrument}; |
| 19 | 19 | use crate::errors::UnusedGenericParamsHint; |
| 20 | 20 | |
| 21 | 21 | /// Provide implementations of queries relating to polymorphization analysis. |
| 22 | pub fn provide(providers: &mut Providers) { | |
| 22 | pub(crate) fn provide(providers: &mut Providers) { | |
| 23 | 23 | providers.unused_generic_params = unused_generic_params; |
| 24 | 24 | } |
| 25 | 25 |
compiler/rustc_next_trait_solver/src/lib.rs+4| ... | ... | @@ -4,6 +4,10 @@ |
| 4 | 4 | //! but were uplifted in the process of making the new trait solver generic. |
| 5 | 5 | //! So if you got to this crate from the old solver, it's totally normal. |
| 6 | 6 | |
| 7 | // tidy-alphabetical-start | |
| 8 | #![warn(unreachable_pub)] | |
| 9 | // tidy-alphabetical-end | |
| 10 | ||
| 7 | 11 | pub mod canonicalizer; |
| 8 | 12 | pub mod coherence; |
| 9 | 13 | pub mod delegate; |
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs+3-3| ... | ... | @@ -92,7 +92,7 @@ where |
| 92 | 92 | #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] |
| 93 | 93 | #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] |
| 94 | 94 | // FIXME: This can be made crate-private once `EvalCtxt` also lives in this crate. |
| 95 | pub struct NestedGoals<I: Interner> { | |
| 95 | struct NestedGoals<I: Interner> { | |
| 96 | 96 | /// These normalizes-to goals are treated specially during the evaluation |
| 97 | 97 | /// loop. In each iteration we take the RHS of the projection, replace it with |
| 98 | 98 | /// a fresh inference variable, and only after evaluating that goal do we |
| ... | ... | @@ -109,11 +109,11 @@ pub struct NestedGoals<I: Interner> { |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | impl<I: Interner> NestedGoals<I> { |
| 112 | pub fn new() -> Self { | |
| 112 | fn new() -> Self { | |
| 113 | 113 | Self { normalizes_to_goals: Vec::new(), goals: Vec::new() } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | pub fn is_empty(&self) -> bool { | |
| 116 | fn is_empty(&self) -> bool { | |
| 117 | 117 | self.normalizes_to_goals.is_empty() && self.goals.is_empty() |
| 118 | 118 | } |
| 119 | 119 | } |
compiler/rustc_next_trait_solver/src/solve/inspect/build.rs+28-21| ... | ... | @@ -222,13 +222,13 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 222 | 222 | self.state.as_deref_mut() |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | pub fn take_and_enter_probe(&mut self) -> ProofTreeBuilder<D> { | |
| 225 | pub(crate) fn take_and_enter_probe(&mut self) -> ProofTreeBuilder<D> { | |
| 226 | 226 | let mut nested = ProofTreeBuilder { state: self.state.take(), _infcx: PhantomData }; |
| 227 | 227 | nested.enter_probe(); |
| 228 | 228 | nested |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | pub fn finalize(self) -> Option<inspect::GoalEvaluation<I>> { | |
| 231 | pub(crate) fn finalize(self) -> Option<inspect::GoalEvaluation<I>> { | |
| 232 | 232 | match *self.state? { |
| 233 | 233 | DebugSolver::GoalEvaluation(wip_goal_evaluation) => { |
| 234 | 234 | Some(wip_goal_evaluation.finalize()) |
| ... | ... | @@ -237,22 +237,22 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | pub fn new_maybe_root(generate_proof_tree: GenerateProofTree) -> ProofTreeBuilder<D> { | |
| 240 | pub(crate) fn new_maybe_root(generate_proof_tree: GenerateProofTree) -> ProofTreeBuilder<D> { | |
| 241 | 241 | match generate_proof_tree { |
| 242 | 242 | GenerateProofTree::No => ProofTreeBuilder::new_noop(), |
| 243 | 243 | GenerateProofTree::Yes => ProofTreeBuilder::new_root(), |
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | pub fn new_root() -> ProofTreeBuilder<D> { | |
| 247 | fn new_root() -> ProofTreeBuilder<D> { | |
| 248 | 248 | ProofTreeBuilder::new(DebugSolver::Root) |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | pub fn new_noop() -> ProofTreeBuilder<D> { | |
| 251 | fn new_noop() -> ProofTreeBuilder<D> { | |
| 252 | 252 | ProofTreeBuilder { state: None, _infcx: PhantomData } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | pub fn is_noop(&self) -> bool { | |
| 255 | pub(crate) fn is_noop(&self) -> bool { | |
| 256 | 256 | self.state.is_none() |
| 257 | 257 | } |
| 258 | 258 | |
| ... | ... | @@ -272,7 +272,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 272 | 272 | }) |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | pub fn new_canonical_goal_evaluation( | |
| 275 | pub(crate) fn new_canonical_goal_evaluation( | |
| 276 | 276 | &mut self, |
| 277 | 277 | goal: CanonicalInput<I>, |
| 278 | 278 | ) -> ProofTreeBuilder<D> { |
| ... | ... | @@ -284,7 +284,10 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 284 | 284 | }) |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | pub fn canonical_goal_evaluation(&mut self, canonical_goal_evaluation: ProofTreeBuilder<D>) { | |
| 287 | pub(crate) fn canonical_goal_evaluation( | |
| 288 | &mut self, | |
| 289 | canonical_goal_evaluation: ProofTreeBuilder<D>, | |
| 290 | ) { | |
| 288 | 291 | if let Some(this) = self.as_mut() { |
| 289 | 292 | match (this, *canonical_goal_evaluation.state.unwrap()) { |
| 290 | 293 | ( |
| ... | ... | @@ -299,7 +302,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 299 | 302 | } |
| 300 | 303 | } |
| 301 | 304 | |
| 302 | pub fn canonical_goal_evaluation_overflow(&mut self) { | |
| 305 | pub(crate) fn canonical_goal_evaluation_overflow(&mut self) { | |
| 303 | 306 | if let Some(this) = self.as_mut() { |
| 304 | 307 | match this { |
| 305 | 308 | DebugSolver::CanonicalGoalEvaluation(canonical_goal_evaluation) => { |
| ... | ... | @@ -310,7 +313,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 310 | 313 | } |
| 311 | 314 | } |
| 312 | 315 | |
| 313 | pub fn goal_evaluation(&mut self, goal_evaluation: ProofTreeBuilder<D>) { | |
| 316 | pub(crate) fn goal_evaluation(&mut self, goal_evaluation: ProofTreeBuilder<D>) { | |
| 314 | 317 | if let Some(this) = self.as_mut() { |
| 315 | 318 | match this { |
| 316 | 319 | DebugSolver::Root => *this = *goal_evaluation.state.unwrap(), |
| ... | ... | @@ -322,7 +325,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 322 | 325 | } |
| 323 | 326 | } |
| 324 | 327 | |
| 325 | pub fn new_goal_evaluation_step( | |
| 328 | pub(crate) fn new_goal_evaluation_step( | |
| 326 | 329 | &mut self, |
| 327 | 330 | var_values: ty::CanonicalVarValues<I>, |
| 328 | 331 | instantiated_goal: QueryInput<I, I::Predicate>, |
| ... | ... | @@ -340,7 +343,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 340 | 343 | }) |
| 341 | 344 | } |
| 342 | 345 | |
| 343 | pub fn goal_evaluation_step(&mut self, goal_evaluation_step: ProofTreeBuilder<D>) { | |
| 346 | pub(crate) fn goal_evaluation_step(&mut self, goal_evaluation_step: ProofTreeBuilder<D>) { | |
| 344 | 347 | if let Some(this) = self.as_mut() { |
| 345 | 348 | match (this, *goal_evaluation_step.state.unwrap()) { |
| 346 | 349 | ( |
| ... | ... | @@ -354,7 +357,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 354 | 357 | } |
| 355 | 358 | } |
| 356 | 359 | |
| 357 | pub fn add_var_value<T: Into<I::GenericArg>>(&mut self, arg: T) { | |
| 360 | pub(crate) fn add_var_value<T: Into<I::GenericArg>>(&mut self, arg: T) { | |
| 358 | 361 | match self.as_mut() { |
| 359 | 362 | None => {} |
| 360 | 363 | Some(DebugSolver::CanonicalGoalEvaluationStep(state)) => { |
| ... | ... | @@ -364,7 +367,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 364 | 367 | } |
| 365 | 368 | } |
| 366 | 369 | |
| 367 | pub fn enter_probe(&mut self) { | |
| 370 | fn enter_probe(&mut self) { | |
| 368 | 371 | match self.as_mut() { |
| 369 | 372 | None => {} |
| 370 | 373 | Some(DebugSolver::CanonicalGoalEvaluationStep(state)) => { |
| ... | ... | @@ -381,7 +384,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 381 | 384 | } |
| 382 | 385 | } |
| 383 | 386 | |
| 384 | pub fn probe_kind(&mut self, probe_kind: inspect::ProbeKind<I>) { | |
| 387 | pub(crate) fn probe_kind(&mut self, probe_kind: inspect::ProbeKind<I>) { | |
| 385 | 388 | match self.as_mut() { |
| 386 | 389 | None => {} |
| 387 | 390 | Some(DebugSolver::CanonicalGoalEvaluationStep(state)) => { |
| ... | ... | @@ -392,7 +395,11 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 392 | 395 | } |
| 393 | 396 | } |
| 394 | 397 | |
| 395 | pub fn probe_final_state(&mut self, delegate: &D, max_input_universe: ty::UniverseIndex) { | |
| 398 | pub(crate) fn probe_final_state( | |
| 399 | &mut self, | |
| 400 | delegate: &D, | |
| 401 | max_input_universe: ty::UniverseIndex, | |
| 402 | ) { | |
| 396 | 403 | match self.as_mut() { |
| 397 | 404 | None => {} |
| 398 | 405 | Some(DebugSolver::CanonicalGoalEvaluationStep(state)) => { |
| ... | ... | @@ -409,7 +416,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 409 | 416 | } |
| 410 | 417 | } |
| 411 | 418 | |
| 412 | pub fn add_normalizes_to_goal( | |
| 419 | pub(crate) fn add_normalizes_to_goal( | |
| 413 | 420 | &mut self, |
| 414 | 421 | delegate: &D, |
| 415 | 422 | max_input_universe: ty::UniverseIndex, |
| ... | ... | @@ -423,7 +430,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 423 | 430 | ); |
| 424 | 431 | } |
| 425 | 432 | |
| 426 | pub fn add_goal( | |
| 433 | pub(crate) fn add_goal( | |
| 427 | 434 | &mut self, |
| 428 | 435 | delegate: &D, |
| 429 | 436 | max_input_universe: ty::UniverseIndex, |
| ... | ... | @@ -469,7 +476,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 469 | 476 | } |
| 470 | 477 | } |
| 471 | 478 | |
| 472 | pub fn make_canonical_response(&mut self, shallow_certainty: Certainty) { | |
| 479 | pub(crate) fn make_canonical_response(&mut self, shallow_certainty: Certainty) { | |
| 473 | 480 | match self.as_mut() { |
| 474 | 481 | Some(DebugSolver::CanonicalGoalEvaluationStep(state)) => { |
| 475 | 482 | state |
| ... | ... | @@ -482,7 +489,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 482 | 489 | } |
| 483 | 490 | } |
| 484 | 491 | |
| 485 | pub fn finish_probe(mut self) -> ProofTreeBuilder<D> { | |
| 492 | pub(crate) fn finish_probe(mut self) -> ProofTreeBuilder<D> { | |
| 486 | 493 | match self.as_mut() { |
| 487 | 494 | None => {} |
| 488 | 495 | Some(DebugSolver::CanonicalGoalEvaluationStep(state)) => { |
| ... | ... | @@ -497,7 +504,7 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> { |
| 497 | 504 | self |
| 498 | 505 | } |
| 499 | 506 | |
| 500 | pub fn query_result(&mut self, result: QueryResult<I>) { | |
| 507 | pub(crate) fn query_result(&mut self, result: QueryResult<I>) { | |
| 501 | 508 | if let Some(this) = self.as_mut() { |
| 502 | 509 | match this { |
| 503 | 510 | DebugSolver::CanonicalGoalEvaluation(canonical_goal_evaluation) => { |
compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs+2-2| ... | ... | @@ -97,7 +97,7 @@ where |
| 97 | 97 | /// Checks whether each generic argument is simply a unique generic placeholder. |
| 98 | 98 | /// |
| 99 | 99 | /// FIXME: Interner argument is needed to constrain the `I` parameter. |
| 100 | pub fn uses_unique_placeholders_ignoring_regions<I: Interner>( | |
| 100 | fn uses_unique_placeholders_ignoring_regions<I: Interner>( | |
| 101 | 101 | _cx: I, |
| 102 | 102 | args: I::GenericArgs, |
| 103 | 103 | ) -> Result<(), NotUniqueParam<I>> { |
| ... | ... | @@ -130,7 +130,7 @@ pub fn uses_unique_placeholders_ignoring_regions<I: Interner>( |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // FIXME: This should check for dupes and non-params first, then infer vars. |
| 133 | pub enum NotUniqueParam<I: Interner> { | |
| 133 | enum NotUniqueParam<I: Interner> { | |
| 134 | 134 | DuplicateParam(I::GenericArg), |
| 135 | 135 | NotParam(I::GenericArg), |
| 136 | 136 | } |
compiler/rustc_parse/src/errors.rs+35-35| ... | ... | @@ -260,7 +260,7 @@ pub(crate) struct NotAsNegationOperator { |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | #[derive(Subdiagnostic)] |
| 263 | pub enum NotAsNegationOperatorSub { | |
| 263 | pub(crate) enum NotAsNegationOperatorSub { | |
| 264 | 264 | #[suggestion( |
| 265 | 265 | parse_unexpected_token_after_not_default, |
| 266 | 266 | style = "verbose", |
| ... | ... | @@ -424,7 +424,7 @@ pub(crate) enum IfExpressionMissingThenBlockSub { |
| 424 | 424 | #[derive(Diagnostic)] |
| 425 | 425 | #[diag(parse_ternary_operator)] |
| 426 | 426 | #[help] |
| 427 | pub struct TernaryOperator { | |
| 427 | pub(crate) struct TernaryOperator { | |
| 428 | 428 | #[primary_span] |
| 429 | 429 | pub span: Span, |
| 430 | 430 | } |
| ... | ... | @@ -1088,7 +1088,7 @@ pub(crate) enum ExpectedIdentifierFound { |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | impl ExpectedIdentifierFound { |
| 1091 | pub fn new(token_descr: Option<TokenDescription>, span: Span) -> Self { | |
| 1091 | pub(crate) fn new(token_descr: Option<TokenDescription>, span: Span) -> Self { | |
| 1092 | 1092 | (match token_descr { |
| 1093 | 1093 | Some(TokenDescription::ReservedIdentifier) => { |
| 1094 | 1094 | ExpectedIdentifierFound::ReservedIdentifier |
| ... | ... | @@ -1659,7 +1659,7 @@ pub(crate) struct SelfArgumentPointer { |
| 1659 | 1659 | |
| 1660 | 1660 | #[derive(Diagnostic)] |
| 1661 | 1661 | #[diag(parse_unexpected_token_after_dot)] |
| 1662 | pub struct UnexpectedTokenAfterDot<'a> { | |
| 1662 | pub(crate) struct UnexpectedTokenAfterDot<'a> { | |
| 1663 | 1663 | #[primary_span] |
| 1664 | 1664 | pub span: Span, |
| 1665 | 1665 | pub actual: Cow<'a, str>, |
| ... | ... | @@ -1928,7 +1928,7 @@ pub(crate) enum UnexpectedTokenAfterStructName { |
| 1928 | 1928 | } |
| 1929 | 1929 | |
| 1930 | 1930 | impl UnexpectedTokenAfterStructName { |
| 1931 | pub fn new(span: Span, token: Token) -> Self { | |
| 1931 | pub(crate) fn new(span: Span, token: Token) -> Self { | |
| 1932 | 1932 | match TokenDescription::from_token(&token) { |
| 1933 | 1933 | Some(TokenDescription::ReservedIdentifier) => Self::ReservedIdentifier { span, token }, |
| 1934 | 1934 | Some(TokenDescription::Keyword) => Self::Keyword { span, token }, |
| ... | ... | @@ -2006,7 +2006,7 @@ pub(crate) enum TopLevelOrPatternNotAllowed { |
| 2006 | 2006 | |
| 2007 | 2007 | #[derive(Diagnostic)] |
| 2008 | 2008 | #[diag(parse_cannot_be_raw_ident)] |
| 2009 | pub struct CannotBeRawIdent { | |
| 2009 | pub(crate) struct CannotBeRawIdent { | |
| 2010 | 2010 | #[primary_span] |
| 2011 | 2011 | pub span: Span, |
| 2012 | 2012 | pub ident: Symbol, |
| ... | ... | @@ -2014,14 +2014,14 @@ pub struct CannotBeRawIdent { |
| 2014 | 2014 | |
| 2015 | 2015 | #[derive(Diagnostic)] |
| 2016 | 2016 | #[diag(parse_keyword_lifetime)] |
| 2017 | pub struct KeywordLifetime { | |
| 2017 | pub(crate) struct KeywordLifetime { | |
| 2018 | 2018 | #[primary_span] |
| 2019 | 2019 | pub span: Span, |
| 2020 | 2020 | } |
| 2021 | 2021 | |
| 2022 | 2022 | #[derive(Diagnostic)] |
| 2023 | 2023 | #[diag(parse_invalid_label)] |
| 2024 | pub struct InvalidLabel { | |
| 2024 | pub(crate) struct InvalidLabel { | |
| 2025 | 2025 | #[primary_span] |
| 2026 | 2026 | pub span: Span, |
| 2027 | 2027 | pub name: Symbol, |
| ... | ... | @@ -2029,7 +2029,7 @@ pub struct InvalidLabel { |
| 2029 | 2029 | |
| 2030 | 2030 | #[derive(Diagnostic)] |
| 2031 | 2031 | #[diag(parse_cr_doc_comment)] |
| 2032 | pub struct CrDocComment { | |
| 2032 | pub(crate) struct CrDocComment { | |
| 2033 | 2033 | #[primary_span] |
| 2034 | 2034 | pub span: Span, |
| 2035 | 2035 | pub block: bool, |
| ... | ... | @@ -2037,14 +2037,14 @@ pub struct CrDocComment { |
| 2037 | 2037 | |
| 2038 | 2038 | #[derive(Diagnostic)] |
| 2039 | 2039 | #[diag(parse_no_digits_literal, code = E0768)] |
| 2040 | pub struct NoDigitsLiteral { | |
| 2040 | pub(crate) struct NoDigitsLiteral { | |
| 2041 | 2041 | #[primary_span] |
| 2042 | 2042 | pub span: Span, |
| 2043 | 2043 | } |
| 2044 | 2044 | |
| 2045 | 2045 | #[derive(Diagnostic)] |
| 2046 | 2046 | #[diag(parse_invalid_digit_literal)] |
| 2047 | pub struct InvalidDigitLiteral { | |
| 2047 | pub(crate) struct InvalidDigitLiteral { | |
| 2048 | 2048 | #[primary_span] |
| 2049 | 2049 | pub span: Span, |
| 2050 | 2050 | pub base: u32, |
| ... | ... | @@ -2052,14 +2052,14 @@ pub struct InvalidDigitLiteral { |
| 2052 | 2052 | |
| 2053 | 2053 | #[derive(Diagnostic)] |
| 2054 | 2054 | #[diag(parse_empty_exponent_float)] |
| 2055 | pub struct EmptyExponentFloat { | |
| 2055 | pub(crate) struct EmptyExponentFloat { | |
| 2056 | 2056 | #[primary_span] |
| 2057 | 2057 | pub span: Span, |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | 2060 | #[derive(Diagnostic)] |
| 2061 | 2061 | #[diag(parse_float_literal_unsupported_base)] |
| 2062 | pub struct FloatLiteralUnsupportedBase { | |
| 2062 | pub(crate) struct FloatLiteralUnsupportedBase { | |
| 2063 | 2063 | #[primary_span] |
| 2064 | 2064 | pub span: Span, |
| 2065 | 2065 | pub base: &'static str, |
| ... | ... | @@ -2068,7 +2068,7 @@ pub struct FloatLiteralUnsupportedBase { |
| 2068 | 2068 | #[derive(Diagnostic)] |
| 2069 | 2069 | #[diag(parse_unknown_prefix)] |
| 2070 | 2070 | #[note] |
| 2071 | pub struct UnknownPrefix<'a> { | |
| 2071 | pub(crate) struct UnknownPrefix<'a> { | |
| 2072 | 2072 | #[primary_span] |
| 2073 | 2073 | #[label] |
| 2074 | 2074 | pub span: Span, |
| ... | ... | @@ -2079,12 +2079,12 @@ pub struct UnknownPrefix<'a> { |
| 2079 | 2079 | |
| 2080 | 2080 | #[derive(Subdiagnostic)] |
| 2081 | 2081 | #[note(parse_macro_expands_to_adt_field)] |
| 2082 | pub struct MacroExpandsToAdtField<'a> { | |
| 2082 | pub(crate) struct MacroExpandsToAdtField<'a> { | |
| 2083 | 2083 | pub adt_ty: &'a str, |
| 2084 | 2084 | } |
| 2085 | 2085 | |
| 2086 | 2086 | #[derive(Subdiagnostic)] |
| 2087 | pub enum UnknownPrefixSugg { | |
| 2087 | pub(crate) enum UnknownPrefixSugg { | |
| 2088 | 2088 | #[suggestion( |
| 2089 | 2089 | parse_suggestion_br, |
| 2090 | 2090 | code = "br", |
| ... | ... | @@ -2114,7 +2114,7 @@ pub enum UnknownPrefixSugg { |
| 2114 | 2114 | |
| 2115 | 2115 | #[derive(Diagnostic)] |
| 2116 | 2116 | #[diag(parse_too_many_hashes)] |
| 2117 | pub struct TooManyHashes { | |
| 2117 | pub(crate) struct TooManyHashes { | |
| 2118 | 2118 | #[primary_span] |
| 2119 | 2119 | pub span: Span, |
| 2120 | 2120 | pub num: u32, |
| ... | ... | @@ -2122,7 +2122,7 @@ pub struct TooManyHashes { |
| 2122 | 2122 | |
| 2123 | 2123 | #[derive(Diagnostic)] |
| 2124 | 2124 | #[diag(parse_unknown_start_of_token)] |
| 2125 | pub struct UnknownTokenStart { | |
| 2125 | pub(crate) struct UnknownTokenStart { | |
| 2126 | 2126 | #[primary_span] |
| 2127 | 2127 | pub span: Span, |
| 2128 | 2128 | pub escaped: String, |
| ... | ... | @@ -2135,7 +2135,7 @@ pub struct UnknownTokenStart { |
| 2135 | 2135 | } |
| 2136 | 2136 | |
| 2137 | 2137 | #[derive(Subdiagnostic)] |
| 2138 | pub enum TokenSubstitution { | |
| 2138 | pub(crate) enum TokenSubstitution { | |
| 2139 | 2139 | #[suggestion( |
| 2140 | 2140 | parse_sugg_quotes, |
| 2141 | 2141 | code = "{suggestion}", |
| ... | ... | @@ -2168,16 +2168,16 @@ pub enum TokenSubstitution { |
| 2168 | 2168 | |
| 2169 | 2169 | #[derive(Subdiagnostic)] |
| 2170 | 2170 | #[note(parse_note_repeats)] |
| 2171 | pub struct UnknownTokenRepeat { | |
| 2171 | pub(crate) struct UnknownTokenRepeat { | |
| 2172 | 2172 | pub repeats: usize, |
| 2173 | 2173 | } |
| 2174 | 2174 | |
| 2175 | 2175 | #[derive(Subdiagnostic)] |
| 2176 | 2176 | #[help(parse_help_null)] |
| 2177 | pub struct UnknownTokenNull; | |
| 2177 | pub(crate) struct UnknownTokenNull; | |
| 2178 | 2178 | |
| 2179 | 2179 | #[derive(Diagnostic)] |
| 2180 | pub enum UnescapeError { | |
| 2180 | pub(crate) enum UnescapeError { | |
| 2181 | 2181 | #[diag(parse_invalid_unicode_escape)] |
| 2182 | 2182 | #[help] |
| 2183 | 2183 | InvalidUnicodeEscape { |
| ... | ... | @@ -2322,7 +2322,7 @@ pub enum UnescapeError { |
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | 2324 | #[derive(Subdiagnostic)] |
| 2325 | pub enum MoreThanOneCharSugg { | |
| 2325 | pub(crate) enum MoreThanOneCharSugg { | |
| 2326 | 2326 | #[suggestion( |
| 2327 | 2327 | parse_consider_normalized, |
| 2328 | 2328 | code = "{normalized}", |
| ... | ... | @@ -2370,7 +2370,7 @@ pub enum MoreThanOneCharSugg { |
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | #[derive(Subdiagnostic)] |
| 2373 | pub enum MoreThanOneCharNote { | |
| 2373 | pub(crate) enum MoreThanOneCharNote { | |
| 2374 | 2374 | #[note(parse_followed_by)] |
| 2375 | 2375 | AllCombining { |
| 2376 | 2376 | #[primary_span] |
| ... | ... | @@ -2388,7 +2388,7 @@ pub enum MoreThanOneCharNote { |
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | 2390 | #[derive(Subdiagnostic)] |
| 2391 | pub enum NoBraceUnicodeSub { | |
| 2391 | pub(crate) enum NoBraceUnicodeSub { | |
| 2392 | 2392 | #[suggestion( |
| 2393 | 2393 | parse_use_braces, |
| 2394 | 2394 | code = "{suggestion}", |
| ... | ... | @@ -2703,7 +2703,7 @@ pub(crate) struct InvalidDynKeyword { |
| 2703 | 2703 | } |
| 2704 | 2704 | |
| 2705 | 2705 | #[derive(Subdiagnostic)] |
| 2706 | pub enum HelpUseLatestEdition { | |
| 2706 | pub(crate) enum HelpUseLatestEdition { | |
| 2707 | 2707 | #[help(parse_help_set_edition_cargo)] |
| 2708 | 2708 | #[note(parse_note_edition_guide)] |
| 2709 | 2709 | Cargo { edition: Edition }, |
| ... | ... | @@ -2713,7 +2713,7 @@ pub enum HelpUseLatestEdition { |
| 2713 | 2713 | } |
| 2714 | 2714 | |
| 2715 | 2715 | impl HelpUseLatestEdition { |
| 2716 | pub fn new() -> Self { | |
| 2716 | pub(crate) fn new() -> Self { | |
| 2717 | 2717 | let edition = LATEST_STABLE_EDITION; |
| 2718 | 2718 | if rustc_session::utils::was_invoked_from_cargo() { |
| 2719 | 2719 | Self::Cargo { edition } |
| ... | ... | @@ -2725,7 +2725,7 @@ impl HelpUseLatestEdition { |
| 2725 | 2725 | |
| 2726 | 2726 | #[derive(Diagnostic)] |
| 2727 | 2727 | #[diag(parse_box_syntax_removed)] |
| 2728 | pub struct BoxSyntaxRemoved { | |
| 2728 | pub(crate) struct BoxSyntaxRemoved { | |
| 2729 | 2729 | #[primary_span] |
| 2730 | 2730 | pub span: Span, |
| 2731 | 2731 | #[subdiagnostic] |
| ... | ... | @@ -2738,7 +2738,7 @@ pub struct BoxSyntaxRemoved { |
| 2738 | 2738 | applicability = "machine-applicable", |
| 2739 | 2739 | style = "verbose" |
| 2740 | 2740 | )] |
| 2741 | pub struct AddBoxNew { | |
| 2741 | pub(crate) struct AddBoxNew { | |
| 2742 | 2742 | #[suggestion_part(code = "Box::new(")] |
| 2743 | 2743 | pub box_kw_and_lo: Span, |
| 2744 | 2744 | #[suggestion_part(code = ")")] |
| ... | ... | @@ -3190,7 +3190,7 @@ pub(crate) struct DotDotRangeAttribute { |
| 3190 | 3190 | #[derive(Diagnostic)] |
| 3191 | 3191 | #[diag(parse_invalid_attr_unsafe)] |
| 3192 | 3192 | #[note] |
| 3193 | pub struct InvalidAttrUnsafe { | |
| 3193 | pub(crate) struct InvalidAttrUnsafe { | |
| 3194 | 3194 | #[primary_span] |
| 3195 | 3195 | #[label] |
| 3196 | 3196 | pub span: Span, |
| ... | ... | @@ -3199,7 +3199,7 @@ pub struct InvalidAttrUnsafe { |
| 3199 | 3199 | |
| 3200 | 3200 | #[derive(Diagnostic)] |
| 3201 | 3201 | #[diag(parse_unsafe_attr_outside_unsafe)] |
| 3202 | pub struct UnsafeAttrOutsideUnsafe { | |
| 3202 | pub(crate) struct UnsafeAttrOutsideUnsafe { | |
| 3203 | 3203 | #[primary_span] |
| 3204 | 3204 | #[label] |
| 3205 | 3205 | pub span: Span, |
| ... | ... | @@ -3212,7 +3212,7 @@ pub struct UnsafeAttrOutsideUnsafe { |
| 3212 | 3212 | parse_unsafe_attr_outside_unsafe_suggestion, |
| 3213 | 3213 | applicability = "machine-applicable" |
| 3214 | 3214 | )] |
| 3215 | pub struct UnsafeAttrOutsideUnsafeSuggestion { | |
| 3215 | pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion { | |
| 3216 | 3216 | #[suggestion_part(code = "unsafe(")] |
| 3217 | 3217 | pub left: Span, |
| 3218 | 3218 | #[suggestion_part(code = ")")] |
| ... | ... | @@ -3221,7 +3221,7 @@ pub struct UnsafeAttrOutsideUnsafeSuggestion { |
| 3221 | 3221 | |
| 3222 | 3222 | #[derive(Diagnostic)] |
| 3223 | 3223 | #[diag(parse_binder_before_modifiers)] |
| 3224 | pub struct BinderBeforeModifiers { | |
| 3224 | pub(crate) struct BinderBeforeModifiers { | |
| 3225 | 3225 | #[primary_span] |
| 3226 | 3226 | pub binder_span: Span, |
| 3227 | 3227 | #[label] |
| ... | ... | @@ -3230,7 +3230,7 @@ pub struct BinderBeforeModifiers { |
| 3230 | 3230 | |
| 3231 | 3231 | #[derive(Diagnostic)] |
| 3232 | 3232 | #[diag(parse_binder_and_polarity)] |
| 3233 | pub struct BinderAndPolarity { | |
| 3233 | pub(crate) struct BinderAndPolarity { | |
| 3234 | 3234 | #[primary_span] |
| 3235 | 3235 | pub polarity_span: Span, |
| 3236 | 3236 | #[label] |
| ... | ... | @@ -3240,7 +3240,7 @@ pub struct BinderAndPolarity { |
| 3240 | 3240 | |
| 3241 | 3241 | #[derive(Diagnostic)] |
| 3242 | 3242 | #[diag(parse_modifiers_and_polarity)] |
| 3243 | pub struct PolarityAndModifiers { | |
| 3243 | pub(crate) struct PolarityAndModifiers { | |
| 3244 | 3244 | #[primary_span] |
| 3245 | 3245 | pub polarity_span: Span, |
| 3246 | 3246 | #[label] |
compiler/rustc_parse/src/lib.rs+1| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #![feature(if_let_guard)] |
| 12 | 12 | #![feature(iter_intersperse)] |
| 13 | 13 | #![feature(let_chains)] |
| 14 | #![warn(unreachable_pub)] | |
| 14 | 15 | // tidy-alphabetical-end |
| 15 | 16 | |
| 16 | 17 | use std::path::Path; |
compiler/rustc_parse_format/src/lib.rs+1| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | html_playground_url = "https://play.rust-lang.org/", |
| 14 | 14 | test(attr(deny(warnings))) |
| 15 | 15 | )] |
| 16 | #![warn(unreachable_pub)] | |
| 16 | 17 | // tidy-alphabetical-end |
| 17 | 18 | |
| 18 | 19 | use std::{iter, str, string}; |
compiler/rustc_passes/src/debugger_visualizer.rs+1-1| ... | ... | @@ -95,6 +95,6 @@ fn debugger_visualizers(tcx: TyCtxt<'_>, _: LocalCrate) -> Vec<DebuggerVisualize |
| 95 | 95 | visitor.visualizers |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | pub fn provide(providers: &mut Providers) { | |
| 98 | pub(crate) fn provide(providers: &mut Providers) { | |
| 99 | 99 | providers.debugger_visualizers = debugger_visualizers; |
| 100 | 100 | } |
compiler/rustc_passes/src/diagnostic_items.rs+1-1| ... | ... | @@ -90,7 +90,7 @@ fn all_diagnostic_items(tcx: TyCtxt<'_>, (): ()) -> DiagnosticItems { |
| 90 | 90 | items |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | pub fn provide(providers: &mut Providers) { | |
| 93 | pub(crate) fn provide(providers: &mut Providers) { | |
| 94 | 94 | providers.diagnostic_items = diagnostic_items; |
| 95 | 95 | providers.all_diagnostic_items = all_diagnostic_items; |
| 96 | 96 | } |
compiler/rustc_passes/src/errors.rs+183-183| ... | ... | @@ -18,41 +18,41 @@ use crate::lang_items::Duplicate; |
| 18 | 18 | |
| 19 | 19 | #[derive(LintDiagnostic)] |
| 20 | 20 | #[diag(passes_incorrect_do_not_recommend_location)] |
| 21 | pub struct IncorrectDoNotRecommendLocation; | |
| 21 | pub(crate) struct IncorrectDoNotRecommendLocation; | |
| 22 | 22 | |
| 23 | 23 | #[derive(LintDiagnostic)] |
| 24 | 24 | #[diag(passes_outer_crate_level_attr)] |
| 25 | pub struct OuterCrateLevelAttr; | |
| 25 | pub(crate) struct OuterCrateLevelAttr; | |
| 26 | 26 | |
| 27 | 27 | #[derive(LintDiagnostic)] |
| 28 | 28 | #[diag(passes_inner_crate_level_attr)] |
| 29 | pub struct InnerCrateLevelAttr; | |
| 29 | pub(crate) struct InnerCrateLevelAttr; | |
| 30 | 30 | |
| 31 | 31 | #[derive(LintDiagnostic)] |
| 32 | 32 | #[diag(passes_ignored_attr_with_macro)] |
| 33 | pub struct IgnoredAttrWithMacro<'a> { | |
| 33 | pub(crate) struct IgnoredAttrWithMacro<'a> { | |
| 34 | 34 | pub sym: &'a str, |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | #[derive(LintDiagnostic)] |
| 38 | 38 | #[diag(passes_ignored_attr)] |
| 39 | pub struct IgnoredAttr<'a> { | |
| 39 | pub(crate) struct IgnoredAttr<'a> { | |
| 40 | 40 | pub sym: &'a str, |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | #[derive(LintDiagnostic)] |
| 44 | 44 | #[diag(passes_inline_ignored_function_prototype)] |
| 45 | pub struct IgnoredInlineAttrFnProto; | |
| 45 | pub(crate) struct IgnoredInlineAttrFnProto; | |
| 46 | 46 | |
| 47 | 47 | #[derive(LintDiagnostic)] |
| 48 | 48 | #[diag(passes_inline_ignored_constants)] |
| 49 | 49 | #[warning] |
| 50 | 50 | #[note] |
| 51 | pub struct IgnoredInlineAttrConstants; | |
| 51 | pub(crate) struct IgnoredInlineAttrConstants; | |
| 52 | 52 | |
| 53 | 53 | #[derive(Diagnostic)] |
| 54 | 54 | #[diag(passes_inline_not_fn_or_closure, code = E0518)] |
| 55 | pub struct InlineNotFnOrClosure { | |
| 55 | pub(crate) struct InlineNotFnOrClosure { | |
| 56 | 56 | #[primary_span] |
| 57 | 57 | pub attr_span: Span, |
| 58 | 58 | #[label] |
| ... | ... | @@ -61,7 +61,7 @@ pub struct InlineNotFnOrClosure { |
| 61 | 61 | |
| 62 | 62 | #[derive(Diagnostic)] |
| 63 | 63 | #[diag(passes_coverage_not_fn_or_closure, code = E0788)] |
| 64 | pub struct CoverageNotFnOrClosure { | |
| 64 | pub(crate) struct CoverageNotFnOrClosure { | |
| 65 | 65 | #[primary_span] |
| 66 | 66 | pub attr_span: Span, |
| 67 | 67 | #[label] |
| ... | ... | @@ -70,11 +70,11 @@ pub struct CoverageNotFnOrClosure { |
| 70 | 70 | |
| 71 | 71 | #[derive(LintDiagnostic)] |
| 72 | 72 | #[diag(passes_optimize_not_fn_or_closure)] |
| 73 | pub struct OptimizeNotFnOrClosure; | |
| 73 | pub(crate) struct OptimizeNotFnOrClosure; | |
| 74 | 74 | |
| 75 | 75 | #[derive(Diagnostic)] |
| 76 | 76 | #[diag(passes_should_be_applied_to_fn)] |
| 77 | pub struct AttrShouldBeAppliedToFn { | |
| 77 | pub(crate) struct AttrShouldBeAppliedToFn { | |
| 78 | 78 | #[primary_span] |
| 79 | 79 | pub attr_span: Span, |
| 80 | 80 | #[label] |
| ... | ... | @@ -84,7 +84,7 @@ pub struct AttrShouldBeAppliedToFn { |
| 84 | 84 | |
| 85 | 85 | #[derive(Diagnostic)] |
| 86 | 86 | #[diag(passes_should_be_applied_to_fn_or_unit_struct)] |
| 87 | pub struct AttrShouldBeAppliedToFnOrUnitStruct { | |
| 87 | pub(crate) struct AttrShouldBeAppliedToFnOrUnitStruct { | |
| 88 | 88 | #[primary_span] |
| 89 | 89 | pub attr_span: Span, |
| 90 | 90 | #[label] |
| ... | ... | @@ -93,7 +93,7 @@ pub struct AttrShouldBeAppliedToFnOrUnitStruct { |
| 93 | 93 | |
| 94 | 94 | #[derive(Diagnostic)] |
| 95 | 95 | #[diag(passes_should_be_applied_to_fn, code = E0739)] |
| 96 | pub struct TrackedCallerWrongLocation { | |
| 96 | pub(crate) struct TrackedCallerWrongLocation { | |
| 97 | 97 | #[primary_span] |
| 98 | 98 | pub attr_span: Span, |
| 99 | 99 | #[label] |
| ... | ... | @@ -103,7 +103,7 @@ pub struct TrackedCallerWrongLocation { |
| 103 | 103 | |
| 104 | 104 | #[derive(Diagnostic)] |
| 105 | 105 | #[diag(passes_should_be_applied_to_struct_enum, code = E0701)] |
| 106 | pub struct NonExhaustiveWrongLocation { | |
| 106 | pub(crate) struct NonExhaustiveWrongLocation { | |
| 107 | 107 | #[primary_span] |
| 108 | 108 | pub attr_span: Span, |
| 109 | 109 | #[label] |
| ... | ... | @@ -112,7 +112,7 @@ pub struct NonExhaustiveWrongLocation { |
| 112 | 112 | |
| 113 | 113 | #[derive(Diagnostic)] |
| 114 | 114 | #[diag(passes_should_be_applied_to_trait)] |
| 115 | pub struct AttrShouldBeAppliedToTrait { | |
| 115 | pub(crate) struct AttrShouldBeAppliedToTrait { | |
| 116 | 116 | #[primary_span] |
| 117 | 117 | pub attr_span: Span, |
| 118 | 118 | #[label] |
| ... | ... | @@ -121,11 +121,11 @@ pub struct AttrShouldBeAppliedToTrait { |
| 121 | 121 | |
| 122 | 122 | #[derive(LintDiagnostic)] |
| 123 | 123 | #[diag(passes_target_feature_on_statement)] |
| 124 | pub struct TargetFeatureOnStatement; | |
| 124 | pub(crate) struct TargetFeatureOnStatement; | |
| 125 | 125 | |
| 126 | 126 | #[derive(Diagnostic)] |
| 127 | 127 | #[diag(passes_should_be_applied_to_static)] |
| 128 | pub struct AttrShouldBeAppliedToStatic { | |
| 128 | pub(crate) struct AttrShouldBeAppliedToStatic { | |
| 129 | 129 | #[primary_span] |
| 130 | 130 | pub attr_span: Span, |
| 131 | 131 | #[label] |
| ... | ... | @@ -134,7 +134,7 @@ pub struct AttrShouldBeAppliedToStatic { |
| 134 | 134 | |
| 135 | 135 | #[derive(Diagnostic)] |
| 136 | 136 | #[diag(passes_doc_expect_str)] |
| 137 | pub struct DocExpectStr<'a> { | |
| 137 | pub(crate) struct DocExpectStr<'a> { | |
| 138 | 138 | #[primary_span] |
| 139 | 139 | pub attr_span: Span, |
| 140 | 140 | pub attr_name: &'a str, |
| ... | ... | @@ -142,7 +142,7 @@ pub struct DocExpectStr<'a> { |
| 142 | 142 | |
| 143 | 143 | #[derive(Diagnostic)] |
| 144 | 144 | #[diag(passes_doc_alias_empty)] |
| 145 | pub struct DocAliasEmpty<'a> { | |
| 145 | pub(crate) struct DocAliasEmpty<'a> { | |
| 146 | 146 | #[primary_span] |
| 147 | 147 | pub span: Span, |
| 148 | 148 | pub attr_str: &'a str, |
| ... | ... | @@ -150,7 +150,7 @@ pub struct DocAliasEmpty<'a> { |
| 150 | 150 | |
| 151 | 151 | #[derive(Diagnostic)] |
| 152 | 152 | #[diag(passes_doc_alias_bad_char)] |
| 153 | pub struct DocAliasBadChar<'a> { | |
| 153 | pub(crate) struct DocAliasBadChar<'a> { | |
| 154 | 154 | #[primary_span] |
| 155 | 155 | pub span: Span, |
| 156 | 156 | pub attr_str: &'a str, |
| ... | ... | @@ -159,7 +159,7 @@ pub struct DocAliasBadChar<'a> { |
| 159 | 159 | |
| 160 | 160 | #[derive(Diagnostic)] |
| 161 | 161 | #[diag(passes_doc_alias_start_end)] |
| 162 | pub struct DocAliasStartEnd<'a> { | |
| 162 | pub(crate) struct DocAliasStartEnd<'a> { | |
| 163 | 163 | #[primary_span] |
| 164 | 164 | pub span: Span, |
| 165 | 165 | pub attr_str: &'a str, |
| ... | ... | @@ -167,7 +167,7 @@ pub struct DocAliasStartEnd<'a> { |
| 167 | 167 | |
| 168 | 168 | #[derive(Diagnostic)] |
| 169 | 169 | #[diag(passes_doc_alias_bad_location)] |
| 170 | pub struct DocAliasBadLocation<'a> { | |
| 170 | pub(crate) struct DocAliasBadLocation<'a> { | |
| 171 | 171 | #[primary_span] |
| 172 | 172 | pub span: Span, |
| 173 | 173 | pub attr_str: &'a str, |
| ... | ... | @@ -176,7 +176,7 @@ pub struct DocAliasBadLocation<'a> { |
| 176 | 176 | |
| 177 | 177 | #[derive(Diagnostic)] |
| 178 | 178 | #[diag(passes_doc_alias_not_an_alias)] |
| 179 | pub struct DocAliasNotAnAlias<'a> { | |
| 179 | pub(crate) struct DocAliasNotAnAlias<'a> { | |
| 180 | 180 | #[primary_span] |
| 181 | 181 | pub span: Span, |
| 182 | 182 | pub attr_str: &'a str, |
| ... | ... | @@ -184,42 +184,42 @@ pub struct DocAliasNotAnAlias<'a> { |
| 184 | 184 | |
| 185 | 185 | #[derive(LintDiagnostic)] |
| 186 | 186 | #[diag(passes_doc_alias_duplicated)] |
| 187 | pub struct DocAliasDuplicated { | |
| 187 | pub(crate) struct DocAliasDuplicated { | |
| 188 | 188 | #[label] |
| 189 | 189 | pub first_defn: Span, |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | #[derive(Diagnostic)] |
| 193 | 193 | #[diag(passes_doc_alias_not_string_literal)] |
| 194 | pub struct DocAliasNotStringLiteral { | |
| 194 | pub(crate) struct DocAliasNotStringLiteral { | |
| 195 | 195 | #[primary_span] |
| 196 | 196 | pub span: Span, |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | #[derive(Diagnostic)] |
| 200 | 200 | #[diag(passes_doc_alias_malformed)] |
| 201 | pub struct DocAliasMalformed { | |
| 201 | pub(crate) struct DocAliasMalformed { | |
| 202 | 202 | #[primary_span] |
| 203 | 203 | pub span: Span, |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | #[derive(Diagnostic)] |
| 207 | 207 | #[diag(passes_doc_keyword_empty_mod)] |
| 208 | pub struct DocKeywordEmptyMod { | |
| 208 | pub(crate) struct DocKeywordEmptyMod { | |
| 209 | 209 | #[primary_span] |
| 210 | 210 | pub span: Span, |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | #[derive(Diagnostic)] |
| 214 | 214 | #[diag(passes_doc_keyword_not_mod)] |
| 215 | pub struct DocKeywordNotMod { | |
| 215 | pub(crate) struct DocKeywordNotMod { | |
| 216 | 216 | #[primary_span] |
| 217 | 217 | pub span: Span, |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | #[derive(Diagnostic)] |
| 221 | 221 | #[diag(passes_doc_keyword_invalid_ident)] |
| 222 | pub struct DocKeywordInvalidIdent { | |
| 222 | pub(crate) struct DocKeywordInvalidIdent { | |
| 223 | 223 | #[primary_span] |
| 224 | 224 | pub span: Span, |
| 225 | 225 | pub doc_keyword: Symbol, |
| ... | ... | @@ -227,14 +227,14 @@ pub struct DocKeywordInvalidIdent { |
| 227 | 227 | |
| 228 | 228 | #[derive(Diagnostic)] |
| 229 | 229 | #[diag(passes_doc_fake_variadic_not_valid)] |
| 230 | pub struct DocFakeVariadicNotValid { | |
| 230 | pub(crate) struct DocFakeVariadicNotValid { | |
| 231 | 231 | #[primary_span] |
| 232 | 232 | pub span: Span, |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | #[derive(Diagnostic)] |
| 236 | 236 | #[diag(passes_doc_keyword_only_impl)] |
| 237 | pub struct DocKeywordOnlyImpl { | |
| 237 | pub(crate) struct DocKeywordOnlyImpl { | |
| 238 | 238 | #[primary_span] |
| 239 | 239 | pub span: Span, |
| 240 | 240 | } |
| ... | ... | @@ -242,7 +242,7 @@ pub struct DocKeywordOnlyImpl { |
| 242 | 242 | #[derive(Diagnostic)] |
| 243 | 243 | #[diag(passes_doc_inline_conflict)] |
| 244 | 244 | #[help] |
| 245 | pub struct DocKeywordConflict { | |
| 245 | pub(crate) struct DocKeywordConflict { | |
| 246 | 246 | #[primary_span] |
| 247 | 247 | pub spans: MultiSpan, |
| 248 | 248 | } |
| ... | ... | @@ -250,7 +250,7 @@ pub struct DocKeywordConflict { |
| 250 | 250 | #[derive(LintDiagnostic)] |
| 251 | 251 | #[diag(passes_doc_inline_only_use)] |
| 252 | 252 | #[note] |
| 253 | pub struct DocInlineOnlyUse { | |
| 253 | pub(crate) struct DocInlineOnlyUse { | |
| 254 | 254 | #[label] |
| 255 | 255 | pub attr_span: Span, |
| 256 | 256 | #[label(passes_not_a_use_item_label)] |
| ... | ... | @@ -260,7 +260,7 @@ pub struct DocInlineOnlyUse { |
| 260 | 260 | #[derive(LintDiagnostic)] |
| 261 | 261 | #[diag(passes_doc_masked_only_extern_crate)] |
| 262 | 262 | #[note] |
| 263 | pub struct DocMaskedOnlyExternCrate { | |
| 263 | pub(crate) struct DocMaskedOnlyExternCrate { | |
| 264 | 264 | #[label] |
| 265 | 265 | pub attr_span: Span, |
| 266 | 266 | #[label(passes_not_an_extern_crate_label)] |
| ... | ... | @@ -269,7 +269,7 @@ pub struct DocMaskedOnlyExternCrate { |
| 269 | 269 | |
| 270 | 270 | #[derive(LintDiagnostic)] |
| 271 | 271 | #[diag(passes_doc_masked_not_extern_crate_self)] |
| 272 | pub struct DocMaskedNotExternCrateSelf { | |
| 272 | pub(crate) struct DocMaskedNotExternCrateSelf { | |
| 273 | 273 | #[label] |
| 274 | 274 | pub attr_span: Span, |
| 275 | 275 | #[label(passes_extern_crate_self_label)] |
| ... | ... | @@ -278,7 +278,7 @@ pub struct DocMaskedNotExternCrateSelf { |
| 278 | 278 | |
| 279 | 279 | #[derive(Diagnostic)] |
| 280 | 280 | #[diag(passes_doc_attr_not_crate_level)] |
| 281 | pub struct DocAttrNotCrateLevel<'a> { | |
| 281 | pub(crate) struct DocAttrNotCrateLevel<'a> { | |
| 282 | 282 | #[primary_span] |
| 283 | 283 | pub span: Span, |
| 284 | 284 | pub attr_name: &'a str, |
| ... | ... | @@ -286,25 +286,25 @@ pub struct DocAttrNotCrateLevel<'a> { |
| 286 | 286 | |
| 287 | 287 | #[derive(LintDiagnostic)] |
| 288 | 288 | #[diag(passes_doc_test_unknown)] |
| 289 | pub struct DocTestUnknown { | |
| 289 | pub(crate) struct DocTestUnknown { | |
| 290 | 290 | pub path: String, |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | #[derive(LintDiagnostic)] |
| 294 | 294 | #[diag(passes_doc_test_literal)] |
| 295 | pub struct DocTestLiteral; | |
| 295 | pub(crate) struct DocTestLiteral; | |
| 296 | 296 | |
| 297 | 297 | #[derive(LintDiagnostic)] |
| 298 | 298 | #[diag(passes_doc_test_takes_list)] |
| 299 | pub struct DocTestTakesList; | |
| 299 | pub(crate) struct DocTestTakesList; | |
| 300 | 300 | |
| 301 | 301 | #[derive(LintDiagnostic)] |
| 302 | 302 | #[diag(passes_doc_cfg_hide_takes_list)] |
| 303 | pub struct DocCfgHideTakesList; | |
| 303 | pub(crate) struct DocCfgHideTakesList; | |
| 304 | 304 | |
| 305 | 305 | #[derive(LintDiagnostic)] |
| 306 | 306 | #[diag(passes_doc_test_unknown_any)] |
| 307 | pub struct DocTestUnknownAny { | |
| 307 | pub(crate) struct DocTestUnknownAny { | |
| 308 | 308 | pub path: String, |
| 309 | 309 | } |
| 310 | 310 | |
| ... | ... | @@ -312,7 +312,7 @@ pub struct DocTestUnknownAny { |
| 312 | 312 | #[diag(passes_doc_test_unknown_spotlight)] |
| 313 | 313 | #[note] |
| 314 | 314 | #[note(passes_no_op_note)] |
| 315 | pub struct DocTestUnknownSpotlight { | |
| 315 | pub(crate) struct DocTestUnknownSpotlight { | |
| 316 | 316 | pub path: String, |
| 317 | 317 | #[suggestion(style = "short", applicability = "machine-applicable", code = "notable_trait")] |
| 318 | 318 | pub span: Span, |
| ... | ... | @@ -320,7 +320,7 @@ pub struct DocTestUnknownSpotlight { |
| 320 | 320 | |
| 321 | 321 | #[derive(LintDiagnostic)] |
| 322 | 322 | #[diag(passes_doc_test_unknown_include)] |
| 323 | pub struct DocTestUnknownInclude { | |
| 323 | pub(crate) struct DocTestUnknownInclude { | |
| 324 | 324 | pub path: String, |
| 325 | 325 | pub value: String, |
| 326 | 326 | pub inner: &'static str, |
| ... | ... | @@ -330,11 +330,11 @@ pub struct DocTestUnknownInclude { |
| 330 | 330 | |
| 331 | 331 | #[derive(LintDiagnostic)] |
| 332 | 332 | #[diag(passes_doc_invalid)] |
| 333 | pub struct DocInvalid; | |
| 333 | pub(crate) struct DocInvalid; | |
| 334 | 334 | |
| 335 | 335 | #[derive(Diagnostic)] |
| 336 | 336 | #[diag(passes_pass_by_value)] |
| 337 | pub struct PassByValue { | |
| 337 | pub(crate) struct PassByValue { | |
| 338 | 338 | #[primary_span] |
| 339 | 339 | pub attr_span: Span, |
| 340 | 340 | #[label] |
| ... | ... | @@ -343,7 +343,7 @@ pub struct PassByValue { |
| 343 | 343 | |
| 344 | 344 | #[derive(Diagnostic)] |
| 345 | 345 | #[diag(passes_allow_incoherent_impl)] |
| 346 | pub struct AllowIncoherentImpl { | |
| 346 | pub(crate) struct AllowIncoherentImpl { | |
| 347 | 347 | #[primary_span] |
| 348 | 348 | pub attr_span: Span, |
| 349 | 349 | #[label] |
| ... | ... | @@ -352,7 +352,7 @@ pub struct AllowIncoherentImpl { |
| 352 | 352 | |
| 353 | 353 | #[derive(Diagnostic)] |
| 354 | 354 | #[diag(passes_has_incoherent_inherent_impl)] |
| 355 | pub struct HasIncoherentInherentImpl { | |
| 355 | pub(crate) struct HasIncoherentInherentImpl { | |
| 356 | 356 | #[primary_span] |
| 357 | 357 | pub attr_span: Span, |
| 358 | 358 | #[label] |
| ... | ... | @@ -361,35 +361,35 @@ pub struct HasIncoherentInherentImpl { |
| 361 | 361 | |
| 362 | 362 | #[derive(Diagnostic)] |
| 363 | 363 | #[diag(passes_both_ffi_const_and_pure, code = E0757)] |
| 364 | pub struct BothFfiConstAndPure { | |
| 364 | pub(crate) struct BothFfiConstAndPure { | |
| 365 | 365 | #[primary_span] |
| 366 | 366 | pub attr_span: Span, |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | #[derive(Diagnostic)] |
| 370 | 370 | #[diag(passes_ffi_pure_invalid_target, code = E0755)] |
| 371 | pub struct FfiPureInvalidTarget { | |
| 371 | pub(crate) struct FfiPureInvalidTarget { | |
| 372 | 372 | #[primary_span] |
| 373 | 373 | pub attr_span: Span, |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | #[derive(Diagnostic)] |
| 377 | 377 | #[diag(passes_ffi_const_invalid_target, code = E0756)] |
| 378 | pub struct FfiConstInvalidTarget { | |
| 378 | pub(crate) struct FfiConstInvalidTarget { | |
| 379 | 379 | #[primary_span] |
| 380 | 380 | pub attr_span: Span, |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | #[derive(LintDiagnostic)] |
| 384 | 384 | #[diag(passes_must_use_no_effect)] |
| 385 | pub struct MustUseNoEffect { | |
| 385 | pub(crate) struct MustUseNoEffect { | |
| 386 | 386 | pub article: &'static str, |
| 387 | 387 | pub target: rustc_hir::Target, |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | #[derive(Diagnostic)] |
| 391 | 391 | #[diag(passes_must_not_suspend)] |
| 392 | pub struct MustNotSuspend { | |
| 392 | pub(crate) struct MustNotSuspend { | |
| 393 | 393 | #[primary_span] |
| 394 | 394 | pub attr_span: Span, |
| 395 | 395 | #[label] |
| ... | ... | @@ -399,7 +399,7 @@ pub struct MustNotSuspend { |
| 399 | 399 | #[derive(LintDiagnostic)] |
| 400 | 400 | #[diag(passes_cold)] |
| 401 | 401 | #[warning] |
| 402 | pub struct Cold { | |
| 402 | pub(crate) struct Cold { | |
| 403 | 403 | #[label] |
| 404 | 404 | pub span: Span, |
| 405 | 405 | pub on_crate: bool, |
| ... | ... | @@ -408,7 +408,7 @@ pub struct Cold { |
| 408 | 408 | #[derive(LintDiagnostic)] |
| 409 | 409 | #[diag(passes_link)] |
| 410 | 410 | #[warning] |
| 411 | pub struct Link { | |
| 411 | pub(crate) struct Link { | |
| 412 | 412 | #[label] |
| 413 | 413 | pub span: Option<Span>, |
| 414 | 414 | } |
| ... | ... | @@ -416,7 +416,7 @@ pub struct Link { |
| 416 | 416 | #[derive(LintDiagnostic)] |
| 417 | 417 | #[diag(passes_link_name)] |
| 418 | 418 | #[warning] |
| 419 | pub struct LinkName<'a> { | |
| 419 | pub(crate) struct LinkName<'a> { | |
| 420 | 420 | #[help] |
| 421 | 421 | pub attr_span: Option<Span>, |
| 422 | 422 | #[label] |
| ... | ... | @@ -426,7 +426,7 @@ pub struct LinkName<'a> { |
| 426 | 426 | |
| 427 | 427 | #[derive(Diagnostic)] |
| 428 | 428 | #[diag(passes_no_link)] |
| 429 | pub struct NoLink { | |
| 429 | pub(crate) struct NoLink { | |
| 430 | 430 | #[primary_span] |
| 431 | 431 | pub attr_span: Span, |
| 432 | 432 | #[label] |
| ... | ... | @@ -435,7 +435,7 @@ pub struct NoLink { |
| 435 | 435 | |
| 436 | 436 | #[derive(Diagnostic)] |
| 437 | 437 | #[diag(passes_export_name)] |
| 438 | pub struct ExportName { | |
| 438 | pub(crate) struct ExportName { | |
| 439 | 439 | #[primary_span] |
| 440 | 440 | pub attr_span: Span, |
| 441 | 441 | #[label] |
| ... | ... | @@ -444,7 +444,7 @@ pub struct ExportName { |
| 444 | 444 | |
| 445 | 445 | #[derive(Diagnostic)] |
| 446 | 446 | #[diag(passes_rustc_layout_scalar_valid_range_not_struct)] |
| 447 | pub struct RustcLayoutScalarValidRangeNotStruct { | |
| 447 | pub(crate) struct RustcLayoutScalarValidRangeNotStruct { | |
| 448 | 448 | #[primary_span] |
| 449 | 449 | pub attr_span: Span, |
| 450 | 450 | #[label] |
| ... | ... | @@ -453,14 +453,14 @@ pub struct RustcLayoutScalarValidRangeNotStruct { |
| 453 | 453 | |
| 454 | 454 | #[derive(Diagnostic)] |
| 455 | 455 | #[diag(passes_rustc_layout_scalar_valid_range_arg)] |
| 456 | pub struct RustcLayoutScalarValidRangeArg { | |
| 456 | pub(crate) struct RustcLayoutScalarValidRangeArg { | |
| 457 | 457 | #[primary_span] |
| 458 | 458 | pub attr_span: Span, |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | #[derive(Diagnostic)] |
| 462 | 462 | #[diag(passes_rustc_legacy_const_generics_only)] |
| 463 | pub struct RustcLegacyConstGenericsOnly { | |
| 463 | pub(crate) struct RustcLegacyConstGenericsOnly { | |
| 464 | 464 | #[primary_span] |
| 465 | 465 | pub attr_span: Span, |
| 466 | 466 | #[label] |
| ... | ... | @@ -469,7 +469,7 @@ pub struct RustcLegacyConstGenericsOnly { |
| 469 | 469 | |
| 470 | 470 | #[derive(Diagnostic)] |
| 471 | 471 | #[diag(passes_rustc_legacy_const_generics_index)] |
| 472 | pub struct RustcLegacyConstGenericsIndex { | |
| 472 | pub(crate) struct RustcLegacyConstGenericsIndex { | |
| 473 | 473 | #[primary_span] |
| 474 | 474 | pub attr_span: Span, |
| 475 | 475 | #[label] |
| ... | ... | @@ -478,7 +478,7 @@ pub struct RustcLegacyConstGenericsIndex { |
| 478 | 478 | |
| 479 | 479 | #[derive(Diagnostic)] |
| 480 | 480 | #[diag(passes_rustc_legacy_const_generics_index_exceed)] |
| 481 | pub struct RustcLegacyConstGenericsIndexExceed { | |
| 481 | pub(crate) struct RustcLegacyConstGenericsIndexExceed { | |
| 482 | 482 | #[primary_span] |
| 483 | 483 | #[label] |
| 484 | 484 | pub span: Span, |
| ... | ... | @@ -487,14 +487,14 @@ pub struct RustcLegacyConstGenericsIndexExceed { |
| 487 | 487 | |
| 488 | 488 | #[derive(Diagnostic)] |
| 489 | 489 | #[diag(passes_rustc_legacy_const_generics_index_negative)] |
| 490 | pub struct RustcLegacyConstGenericsIndexNegative { | |
| 490 | pub(crate) struct RustcLegacyConstGenericsIndexNegative { | |
| 491 | 491 | #[primary_span] |
| 492 | 492 | pub invalid_args: Vec<Span>, |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | #[derive(Diagnostic)] |
| 496 | 496 | #[diag(passes_rustc_dirty_clean)] |
| 497 | pub struct RustcDirtyClean { | |
| 497 | pub(crate) struct RustcDirtyClean { | |
| 498 | 498 | #[primary_span] |
| 499 | 499 | pub span: Span, |
| 500 | 500 | } |
| ... | ... | @@ -502,7 +502,7 @@ pub struct RustcDirtyClean { |
| 502 | 502 | #[derive(LintDiagnostic)] |
| 503 | 503 | #[diag(passes_link_section)] |
| 504 | 504 | #[warning] |
| 505 | pub struct LinkSection { | |
| 505 | pub(crate) struct LinkSection { | |
| 506 | 506 | #[label] |
| 507 | 507 | pub span: Span, |
| 508 | 508 | } |
| ... | ... | @@ -511,7 +511,7 @@ pub struct LinkSection { |
| 511 | 511 | #[diag(passes_no_mangle_foreign)] |
| 512 | 512 | #[warning] |
| 513 | 513 | #[note] |
| 514 | pub struct NoMangleForeign { | |
| 514 | pub(crate) struct NoMangleForeign { | |
| 515 | 515 | #[label] |
| 516 | 516 | pub span: Span, |
| 517 | 517 | #[suggestion(code = "", applicability = "machine-applicable")] |
| ... | ... | @@ -522,32 +522,32 @@ pub struct NoMangleForeign { |
| 522 | 522 | #[derive(LintDiagnostic)] |
| 523 | 523 | #[diag(passes_no_mangle)] |
| 524 | 524 | #[warning] |
| 525 | pub struct NoMangle { | |
| 525 | pub(crate) struct NoMangle { | |
| 526 | 526 | #[label] |
| 527 | 527 | pub span: Span, |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | #[derive(Diagnostic)] |
| 531 | 531 | #[diag(passes_repr_ident, code = E0565)] |
| 532 | pub struct ReprIdent { | |
| 532 | pub(crate) struct ReprIdent { | |
| 533 | 533 | #[primary_span] |
| 534 | 534 | pub span: Span, |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | #[derive(Diagnostic)] |
| 538 | 538 | #[diag(passes_repr_conflicting, code = E0566)] |
| 539 | pub struct ReprConflicting { | |
| 539 | pub(crate) struct ReprConflicting { | |
| 540 | 540 | #[primary_span] |
| 541 | 541 | pub hint_spans: Vec<Span>, |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | #[derive(LintDiagnostic)] |
| 545 | 545 | #[diag(passes_repr_conflicting, code = E0566)] |
| 546 | pub struct ReprConflictingLint; | |
| 546 | pub(crate) struct ReprConflictingLint; | |
| 547 | 547 | |
| 548 | 548 | #[derive(Diagnostic)] |
| 549 | 549 | #[diag(passes_used_static)] |
| 550 | pub struct UsedStatic { | |
| 550 | pub(crate) struct UsedStatic { | |
| 551 | 551 | #[primary_span] |
| 552 | 552 | pub attr_span: Span, |
| 553 | 553 | #[label] |
| ... | ... | @@ -557,14 +557,14 @@ pub struct UsedStatic { |
| 557 | 557 | |
| 558 | 558 | #[derive(Diagnostic)] |
| 559 | 559 | #[diag(passes_used_compiler_linker)] |
| 560 | pub struct UsedCompilerLinker { | |
| 560 | pub(crate) struct UsedCompilerLinker { | |
| 561 | 561 | #[primary_span] |
| 562 | 562 | pub spans: Vec<Span>, |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | #[derive(Diagnostic)] |
| 566 | 566 | #[diag(passes_allow_internal_unstable)] |
| 567 | pub struct AllowInternalUnstable { | |
| 567 | pub(crate) struct AllowInternalUnstable { | |
| 568 | 568 | #[primary_span] |
| 569 | 569 | pub attr_span: Span, |
| 570 | 570 | #[label] |
| ... | ... | @@ -573,7 +573,7 @@ pub struct AllowInternalUnstable { |
| 573 | 573 | |
| 574 | 574 | #[derive(Diagnostic)] |
| 575 | 575 | #[diag(passes_debug_visualizer_placement)] |
| 576 | pub struct DebugVisualizerPlacement { | |
| 576 | pub(crate) struct DebugVisualizerPlacement { | |
| 577 | 577 | #[primary_span] |
| 578 | 578 | pub span: Span, |
| 579 | 579 | } |
| ... | ... | @@ -583,14 +583,14 @@ pub struct DebugVisualizerPlacement { |
| 583 | 583 | #[note(passes_note_1)] |
| 584 | 584 | #[note(passes_note_2)] |
| 585 | 585 | #[note(passes_note_3)] |
| 586 | pub struct DebugVisualizerInvalid { | |
| 586 | pub(crate) struct DebugVisualizerInvalid { | |
| 587 | 587 | #[primary_span] |
| 588 | 588 | pub span: Span, |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | #[derive(Diagnostic)] |
| 592 | 592 | #[diag(passes_debug_visualizer_unreadable)] |
| 593 | pub struct DebugVisualizerUnreadable<'a> { | |
| 593 | pub(crate) struct DebugVisualizerUnreadable<'a> { | |
| 594 | 594 | #[primary_span] |
| 595 | 595 | pub span: Span, |
| 596 | 596 | pub file: &'a Path, |
| ... | ... | @@ -599,7 +599,7 @@ pub struct DebugVisualizerUnreadable<'a> { |
| 599 | 599 | |
| 600 | 600 | #[derive(Diagnostic)] |
| 601 | 601 | #[diag(passes_rustc_allow_const_fn_unstable)] |
| 602 | pub struct RustcAllowConstFnUnstable { | |
| 602 | pub(crate) struct RustcAllowConstFnUnstable { | |
| 603 | 603 | #[primary_span] |
| 604 | 604 | pub attr_span: Span, |
| 605 | 605 | #[label] |
| ... | ... | @@ -608,7 +608,7 @@ pub struct RustcAllowConstFnUnstable { |
| 608 | 608 | |
| 609 | 609 | #[derive(Diagnostic)] |
| 610 | 610 | #[diag(passes_rustc_safe_intrinsic)] |
| 611 | pub struct RustcSafeIntrinsic { | |
| 611 | pub(crate) struct RustcSafeIntrinsic { | |
| 612 | 612 | #[primary_span] |
| 613 | 613 | pub attr_span: Span, |
| 614 | 614 | #[label] |
| ... | ... | @@ -617,7 +617,7 @@ pub struct RustcSafeIntrinsic { |
| 617 | 617 | |
| 618 | 618 | #[derive(Diagnostic)] |
| 619 | 619 | #[diag(passes_rustc_std_internal_symbol)] |
| 620 | pub struct RustcStdInternalSymbol { | |
| 620 | pub(crate) struct RustcStdInternalSymbol { | |
| 621 | 621 | #[primary_span] |
| 622 | 622 | pub attr_span: Span, |
| 623 | 623 | #[label] |
| ... | ... | @@ -626,7 +626,7 @@ pub struct RustcStdInternalSymbol { |
| 626 | 626 | |
| 627 | 627 | #[derive(Diagnostic)] |
| 628 | 628 | #[diag(passes_rustc_pub_transparent)] |
| 629 | pub struct RustcPubTransparent { | |
| 629 | pub(crate) struct RustcPubTransparent { | |
| 630 | 630 | #[primary_span] |
| 631 | 631 | pub attr_span: Span, |
| 632 | 632 | #[label] |
| ... | ... | @@ -635,28 +635,28 @@ pub struct RustcPubTransparent { |
| 635 | 635 | |
| 636 | 636 | #[derive(Diagnostic)] |
| 637 | 637 | #[diag(passes_link_ordinal)] |
| 638 | pub struct LinkOrdinal { | |
| 638 | pub(crate) struct LinkOrdinal { | |
| 639 | 639 | #[primary_span] |
| 640 | 640 | pub attr_span: Span, |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | #[derive(Diagnostic)] |
| 644 | 644 | #[diag(passes_confusables)] |
| 645 | pub struct Confusables { | |
| 645 | pub(crate) struct Confusables { | |
| 646 | 646 | #[primary_span] |
| 647 | 647 | pub attr_span: Span, |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | #[derive(Diagnostic)] |
| 651 | 651 | #[diag(passes_coroutine_on_non_closure)] |
| 652 | pub struct CoroutineOnNonClosure { | |
| 652 | pub(crate) struct CoroutineOnNonClosure { | |
| 653 | 653 | #[primary_span] |
| 654 | 654 | pub span: Span, |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | #[derive(Diagnostic)] |
| 658 | 658 | #[diag(passes_linkage)] |
| 659 | pub struct Linkage { | |
| 659 | pub(crate) struct Linkage { | |
| 660 | 660 | #[primary_span] |
| 661 | 661 | pub attr_span: Span, |
| 662 | 662 | #[label] |
| ... | ... | @@ -690,23 +690,23 @@ pub(crate) struct IncorrectMetaItemSuggestion { |
| 690 | 690 | |
| 691 | 691 | #[derive(Diagnostic)] |
| 692 | 692 | #[diag(passes_stability_promotable)] |
| 693 | pub struct StabilityPromotable { | |
| 693 | pub(crate) struct StabilityPromotable { | |
| 694 | 694 | #[primary_span] |
| 695 | 695 | pub attr_span: Span, |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | #[derive(LintDiagnostic)] |
| 699 | 699 | #[diag(passes_deprecated)] |
| 700 | pub struct Deprecated; | |
| 700 | pub(crate) struct Deprecated; | |
| 701 | 701 | |
| 702 | 702 | #[derive(LintDiagnostic)] |
| 703 | 703 | #[diag(passes_macro_use)] |
| 704 | pub struct MacroUse { | |
| 704 | pub(crate) struct MacroUse { | |
| 705 | 705 | pub name: Symbol, |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | #[derive(LintDiagnostic)] |
| 709 | pub enum MacroExport { | |
| 709 | pub(crate) enum MacroExport { | |
| 710 | 710 | #[diag(passes_macro_export)] |
| 711 | 711 | Normal, |
| 712 | 712 | |
| ... | ... | @@ -722,7 +722,7 @@ pub enum MacroExport { |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | #[derive(Subdiagnostic)] |
| 725 | pub enum UnusedNote { | |
| 725 | pub(crate) enum UnusedNote { | |
| 726 | 726 | #[note(passes_unused_empty_lints_note)] |
| 727 | 727 | EmptyList { name: Symbol }, |
| 728 | 728 | #[note(passes_unused_no_lints_note)] |
| ... | ... | @@ -733,7 +733,7 @@ pub enum UnusedNote { |
| 733 | 733 | |
| 734 | 734 | #[derive(LintDiagnostic)] |
| 735 | 735 | #[diag(passes_unused)] |
| 736 | pub struct Unused { | |
| 736 | pub(crate) struct Unused { | |
| 737 | 737 | #[suggestion(code = "", applicability = "machine-applicable")] |
| 738 | 738 | pub attr_span: Span, |
| 739 | 739 | #[subdiagnostic] |
| ... | ... | @@ -742,7 +742,7 @@ pub struct Unused { |
| 742 | 742 | |
| 743 | 743 | #[derive(Diagnostic)] |
| 744 | 744 | #[diag(passes_non_exported_macro_invalid_attrs, code = E0518)] |
| 745 | pub struct NonExportedMacroInvalidAttrs { | |
| 745 | pub(crate) struct NonExportedMacroInvalidAttrs { | |
| 746 | 746 | #[primary_span] |
| 747 | 747 | #[label] |
| 748 | 748 | pub attr_span: Span, |
| ... | ... | @@ -750,14 +750,14 @@ pub struct NonExportedMacroInvalidAttrs { |
| 750 | 750 | |
| 751 | 751 | #[derive(Diagnostic)] |
| 752 | 752 | #[diag(passes_may_dangle)] |
| 753 | pub struct InvalidMayDangle { | |
| 753 | pub(crate) struct InvalidMayDangle { | |
| 754 | 754 | #[primary_span] |
| 755 | 755 | pub attr_span: Span, |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | #[derive(LintDiagnostic)] |
| 759 | 759 | #[diag(passes_unused_duplicate)] |
| 760 | pub struct UnusedDuplicate { | |
| 760 | pub(crate) struct UnusedDuplicate { | |
| 761 | 761 | #[suggestion(code = "", applicability = "machine-applicable")] |
| 762 | 762 | pub this: Span, |
| 763 | 763 | #[note] |
| ... | ... | @@ -768,7 +768,7 @@ pub struct UnusedDuplicate { |
| 768 | 768 | |
| 769 | 769 | #[derive(Diagnostic)] |
| 770 | 770 | #[diag(passes_unused_multiple)] |
| 771 | pub struct UnusedMultiple { | |
| 771 | pub(crate) struct UnusedMultiple { | |
| 772 | 772 | #[primary_span] |
| 773 | 773 | #[suggestion(code = "", applicability = "machine-applicable")] |
| 774 | 774 | pub this: Span, |
| ... | ... | @@ -779,7 +779,7 @@ pub struct UnusedMultiple { |
| 779 | 779 | |
| 780 | 780 | #[derive(Diagnostic)] |
| 781 | 781 | #[diag(passes_rustc_lint_opt_ty)] |
| 782 | pub struct RustcLintOptTy { | |
| 782 | pub(crate) struct RustcLintOptTy { | |
| 783 | 783 | #[primary_span] |
| 784 | 784 | pub attr_span: Span, |
| 785 | 785 | #[label] |
| ... | ... | @@ -788,7 +788,7 @@ pub struct RustcLintOptTy { |
| 788 | 788 | |
| 789 | 789 | #[derive(Diagnostic)] |
| 790 | 790 | #[diag(passes_rustc_lint_opt_deny_field_access)] |
| 791 | pub struct RustcLintOptDenyFieldAccess { | |
| 791 | pub(crate) struct RustcLintOptDenyFieldAccess { | |
| 792 | 792 | #[primary_span] |
| 793 | 793 | pub attr_span: Span, |
| 794 | 794 | #[label] |
| ... | ... | @@ -797,7 +797,7 @@ pub struct RustcLintOptDenyFieldAccess { |
| 797 | 797 | |
| 798 | 798 | #[derive(Diagnostic)] |
| 799 | 799 | #[diag(passes_collapse_debuginfo)] |
| 800 | pub struct CollapseDebuginfo { | |
| 800 | pub(crate) struct CollapseDebuginfo { | |
| 801 | 801 | #[primary_span] |
| 802 | 802 | pub attr_span: Span, |
| 803 | 803 | #[label] |
| ... | ... | @@ -806,14 +806,14 @@ pub struct CollapseDebuginfo { |
| 806 | 806 | |
| 807 | 807 | #[derive(LintDiagnostic)] |
| 808 | 808 | #[diag(passes_deprecated_annotation_has_no_effect)] |
| 809 | pub struct DeprecatedAnnotationHasNoEffect { | |
| 809 | pub(crate) struct DeprecatedAnnotationHasNoEffect { | |
| 810 | 810 | #[suggestion(applicability = "machine-applicable", code = "")] |
| 811 | 811 | pub span: Span, |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | #[derive(Diagnostic)] |
| 815 | 815 | #[diag(passes_unknown_external_lang_item, code = E0264)] |
| 816 | pub struct UnknownExternLangItem { | |
| 816 | pub(crate) struct UnknownExternLangItem { | |
| 817 | 817 | #[primary_span] |
| 818 | 818 | pub span: Span, |
| 819 | 819 | pub lang_item: Symbol, |
| ... | ... | @@ -821,25 +821,25 @@ pub struct UnknownExternLangItem { |
| 821 | 821 | |
| 822 | 822 | #[derive(Diagnostic)] |
| 823 | 823 | #[diag(passes_missing_panic_handler)] |
| 824 | pub struct MissingPanicHandler; | |
| 824 | pub(crate) struct MissingPanicHandler; | |
| 825 | 825 | |
| 826 | 826 | #[derive(Diagnostic)] |
| 827 | 827 | #[diag(passes_panic_unwind_without_std)] |
| 828 | 828 | #[help] |
| 829 | 829 | #[note] |
| 830 | pub struct PanicUnwindWithoutStd; | |
| 830 | pub(crate) struct PanicUnwindWithoutStd; | |
| 831 | 831 | |
| 832 | 832 | #[derive(Diagnostic)] |
| 833 | 833 | #[diag(passes_missing_lang_item)] |
| 834 | 834 | #[note] |
| 835 | 835 | #[help] |
| 836 | pub struct MissingLangItem { | |
| 836 | pub(crate) struct MissingLangItem { | |
| 837 | 837 | pub name: Symbol, |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | #[derive(Diagnostic)] |
| 841 | 841 | #[diag(passes_lang_item_fn_with_track_caller)] |
| 842 | pub struct LangItemWithTrackCaller { | |
| 842 | pub(crate) struct LangItemWithTrackCaller { | |
| 843 | 843 | #[primary_span] |
| 844 | 844 | pub attr_span: Span, |
| 845 | 845 | pub name: Symbol, |
| ... | ... | @@ -849,7 +849,7 @@ pub struct LangItemWithTrackCaller { |
| 849 | 849 | |
| 850 | 850 | #[derive(Diagnostic)] |
| 851 | 851 | #[diag(passes_lang_item_fn_with_target_feature)] |
| 852 | pub struct LangItemWithTargetFeature { | |
| 852 | pub(crate) struct LangItemWithTargetFeature { | |
| 853 | 853 | #[primary_span] |
| 854 | 854 | pub attr_span: Span, |
| 855 | 855 | pub name: Symbol, |
| ... | ... | @@ -859,7 +859,7 @@ pub struct LangItemWithTargetFeature { |
| 859 | 859 | |
| 860 | 860 | #[derive(Diagnostic)] |
| 861 | 861 | #[diag(passes_lang_item_on_incorrect_target, code = E0718)] |
| 862 | pub struct LangItemOnIncorrectTarget { | |
| 862 | pub(crate) struct LangItemOnIncorrectTarget { | |
| 863 | 863 | #[primary_span] |
| 864 | 864 | #[label] |
| 865 | 865 | pub span: Span, |
| ... | ... | @@ -870,14 +870,14 @@ pub struct LangItemOnIncorrectTarget { |
| 870 | 870 | |
| 871 | 871 | #[derive(Diagnostic)] |
| 872 | 872 | #[diag(passes_unknown_lang_item, code = E0522)] |
| 873 | pub struct UnknownLangItem { | |
| 873 | pub(crate) struct UnknownLangItem { | |
| 874 | 874 | #[primary_span] |
| 875 | 875 | #[label] |
| 876 | 876 | pub span: Span, |
| 877 | 877 | pub name: Symbol, |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | pub struct InvalidAttrAtCrateLevel { | |
| 880 | pub(crate) struct InvalidAttrAtCrateLevel { | |
| 881 | 881 | pub span: Span, |
| 882 | 882 | pub sugg_span: Option<Span>, |
| 883 | 883 | pub name: Symbol, |
| ... | ... | @@ -885,7 +885,7 @@ pub struct InvalidAttrAtCrateLevel { |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | #[derive(Clone, Copy)] |
| 888 | pub struct ItemFollowingInnerAttr { | |
| 888 | pub(crate) struct ItemFollowingInnerAttr { | |
| 889 | 889 | pub span: Span, |
| 890 | 890 | pub kind: &'static str, |
| 891 | 891 | } |
| ... | ... | @@ -916,7 +916,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidAttrAtCrateLevel { |
| 916 | 916 | |
| 917 | 917 | #[derive(Diagnostic)] |
| 918 | 918 | #[diag(passes_duplicate_diagnostic_item_in_crate)] |
| 919 | pub struct DuplicateDiagnosticItemInCrate { | |
| 919 | pub(crate) struct DuplicateDiagnosticItemInCrate { | |
| 920 | 920 | #[primary_span] |
| 921 | 921 | pub duplicate_span: Option<Span>, |
| 922 | 922 | #[note(passes_diagnostic_item_first_defined)] |
| ... | ... | @@ -930,7 +930,7 @@ pub struct DuplicateDiagnosticItemInCrate { |
| 930 | 930 | |
| 931 | 931 | #[derive(Diagnostic)] |
| 932 | 932 | #[diag(passes_layout_abi)] |
| 933 | pub struct LayoutAbi { | |
| 933 | pub(crate) struct LayoutAbi { | |
| 934 | 934 | #[primary_span] |
| 935 | 935 | pub span: Span, |
| 936 | 936 | pub abi: String, |
| ... | ... | @@ -938,7 +938,7 @@ pub struct LayoutAbi { |
| 938 | 938 | |
| 939 | 939 | #[derive(Diagnostic)] |
| 940 | 940 | #[diag(passes_layout_align)] |
| 941 | pub struct LayoutAlign { | |
| 941 | pub(crate) struct LayoutAlign { | |
| 942 | 942 | #[primary_span] |
| 943 | 943 | pub span: Span, |
| 944 | 944 | pub align: String, |
| ... | ... | @@ -946,7 +946,7 @@ pub struct LayoutAlign { |
| 946 | 946 | |
| 947 | 947 | #[derive(Diagnostic)] |
| 948 | 948 | #[diag(passes_layout_size)] |
| 949 | pub struct LayoutSize { | |
| 949 | pub(crate) struct LayoutSize { | |
| 950 | 950 | #[primary_span] |
| 951 | 951 | pub span: Span, |
| 952 | 952 | pub size: String, |
| ... | ... | @@ -954,7 +954,7 @@ pub struct LayoutSize { |
| 954 | 954 | |
| 955 | 955 | #[derive(Diagnostic)] |
| 956 | 956 | #[diag(passes_layout_homogeneous_aggregate)] |
| 957 | pub struct LayoutHomogeneousAggregate { | |
| 957 | pub(crate) struct LayoutHomogeneousAggregate { | |
| 958 | 958 | #[primary_span] |
| 959 | 959 | pub span: Span, |
| 960 | 960 | pub homogeneous_aggregate: String, |
| ... | ... | @@ -962,7 +962,7 @@ pub struct LayoutHomogeneousAggregate { |
| 962 | 962 | |
| 963 | 963 | #[derive(Diagnostic)] |
| 964 | 964 | #[diag(passes_layout_of)] |
| 965 | pub struct LayoutOf { | |
| 965 | pub(crate) struct LayoutOf { | |
| 966 | 966 | #[primary_span] |
| 967 | 967 | pub span: Span, |
| 968 | 968 | pub normalized_ty: String, |
| ... | ... | @@ -971,14 +971,14 @@ pub struct LayoutOf { |
| 971 | 971 | |
| 972 | 972 | #[derive(Diagnostic)] |
| 973 | 973 | #[diag(passes_layout_invalid_attribute)] |
| 974 | pub struct LayoutInvalidAttribute { | |
| 974 | pub(crate) struct LayoutInvalidAttribute { | |
| 975 | 975 | #[primary_span] |
| 976 | 976 | pub span: Span, |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | #[derive(Diagnostic)] |
| 980 | 980 | #[diag(passes_abi_of)] |
| 981 | pub struct AbiOf { | |
| 981 | pub(crate) struct AbiOf { | |
| 982 | 982 | #[primary_span] |
| 983 | 983 | pub span: Span, |
| 984 | 984 | pub fn_name: Symbol, |
| ... | ... | @@ -987,7 +987,7 @@ pub struct AbiOf { |
| 987 | 987 | |
| 988 | 988 | #[derive(Diagnostic)] |
| 989 | 989 | #[diag(passes_abi_ne)] |
| 990 | pub struct AbiNe { | |
| 990 | pub(crate) struct AbiNe { | |
| 991 | 991 | #[primary_span] |
| 992 | 992 | pub span: Span, |
| 993 | 993 | pub left: String, |
| ... | ... | @@ -996,14 +996,14 @@ pub struct AbiNe { |
| 996 | 996 | |
| 997 | 997 | #[derive(Diagnostic)] |
| 998 | 998 | #[diag(passes_abi_invalid_attribute)] |
| 999 | pub struct AbiInvalidAttribute { | |
| 999 | pub(crate) struct AbiInvalidAttribute { | |
| 1000 | 1000 | #[primary_span] |
| 1001 | 1001 | pub span: Span, |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | #[derive(Diagnostic)] |
| 1005 | 1005 | #[diag(passes_unrecognized_field)] |
| 1006 | pub struct UnrecognizedField { | |
| 1006 | pub(crate) struct UnrecognizedField { | |
| 1007 | 1007 | #[primary_span] |
| 1008 | 1008 | pub span: Span, |
| 1009 | 1009 | pub name: Symbol, |
| ... | ... | @@ -1011,7 +1011,7 @@ pub struct UnrecognizedField { |
| 1011 | 1011 | |
| 1012 | 1012 | #[derive(Diagnostic)] |
| 1013 | 1013 | #[diag(passes_feature_stable_twice, code = E0711)] |
| 1014 | pub struct FeatureStableTwice { | |
| 1014 | pub(crate) struct FeatureStableTwice { | |
| 1015 | 1015 | #[primary_span] |
| 1016 | 1016 | pub span: Span, |
| 1017 | 1017 | pub feature: Symbol, |
| ... | ... | @@ -1021,7 +1021,7 @@ pub struct FeatureStableTwice { |
| 1021 | 1021 | |
| 1022 | 1022 | #[derive(Diagnostic)] |
| 1023 | 1023 | #[diag(passes_feature_previously_declared, code = E0711)] |
| 1024 | pub struct FeaturePreviouslyDeclared<'a, 'b> { | |
| 1024 | pub(crate) struct FeaturePreviouslyDeclared<'a, 'b> { | |
| 1025 | 1025 | #[primary_span] |
| 1026 | 1026 | pub span: Span, |
| 1027 | 1027 | pub feature: Symbol, |
| ... | ... | @@ -1029,7 +1029,7 @@ pub struct FeaturePreviouslyDeclared<'a, 'b> { |
| 1029 | 1029 | pub prev_declared: &'b str, |
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | pub struct BreakNonLoop<'a> { | |
| 1032 | pub(crate) struct BreakNonLoop<'a> { | |
| 1033 | 1033 | pub span: Span, |
| 1034 | 1034 | pub head: Option<Span>, |
| 1035 | 1035 | pub kind: &'a str, |
| ... | ... | @@ -1084,7 +1084,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'_, G> for BreakNonLoop<'a> { |
| 1084 | 1084 | |
| 1085 | 1085 | #[derive(Diagnostic)] |
| 1086 | 1086 | #[diag(passes_continue_labeled_block, code = E0696)] |
| 1087 | pub struct ContinueLabeledBlock { | |
| 1087 | pub(crate) struct ContinueLabeledBlock { | |
| 1088 | 1088 | #[primary_span] |
| 1089 | 1089 | #[label] |
| 1090 | 1090 | pub span: Span, |
| ... | ... | @@ -1094,7 +1094,7 @@ pub struct ContinueLabeledBlock { |
| 1094 | 1094 | |
| 1095 | 1095 | #[derive(Diagnostic)] |
| 1096 | 1096 | #[diag(passes_break_inside_closure, code = E0267)] |
| 1097 | pub struct BreakInsideClosure<'a> { | |
| 1097 | pub(crate) struct BreakInsideClosure<'a> { | |
| 1098 | 1098 | #[primary_span] |
| 1099 | 1099 | #[label] |
| 1100 | 1100 | pub span: Span, |
| ... | ... | @@ -1105,7 +1105,7 @@ pub struct BreakInsideClosure<'a> { |
| 1105 | 1105 | |
| 1106 | 1106 | #[derive(Diagnostic)] |
| 1107 | 1107 | #[diag(passes_break_inside_coroutine, code = E0267)] |
| 1108 | pub struct BreakInsideCoroutine<'a> { | |
| 1108 | pub(crate) struct BreakInsideCoroutine<'a> { | |
| 1109 | 1109 | #[primary_span] |
| 1110 | 1110 | #[label] |
| 1111 | 1111 | pub span: Span, |
| ... | ... | @@ -1118,7 +1118,7 @@ pub struct BreakInsideCoroutine<'a> { |
| 1118 | 1118 | |
| 1119 | 1119 | #[derive(Diagnostic)] |
| 1120 | 1120 | #[diag(passes_outside_loop, code = E0268)] |
| 1121 | pub struct OutsideLoop<'a> { | |
| 1121 | pub(crate) struct OutsideLoop<'a> { | |
| 1122 | 1122 | #[primary_span] |
| 1123 | 1123 | #[label] |
| 1124 | 1124 | pub spans: Vec<Span>, |
| ... | ... | @@ -1129,7 +1129,7 @@ pub struct OutsideLoop<'a> { |
| 1129 | 1129 | } |
| 1130 | 1130 | #[derive(Subdiagnostic)] |
| 1131 | 1131 | #[multipart_suggestion(passes_outside_loop_suggestion, applicability = "maybe-incorrect")] |
| 1132 | pub struct OutsideLoopSuggestion { | |
| 1132 | pub(crate) struct OutsideLoopSuggestion { | |
| 1133 | 1133 | #[suggestion_part(code = "'block: ")] |
| 1134 | 1134 | pub block_span: Span, |
| 1135 | 1135 | #[suggestion_part(code = " 'block")] |
| ... | ... | @@ -1138,7 +1138,7 @@ pub struct OutsideLoopSuggestion { |
| 1138 | 1138 | |
| 1139 | 1139 | #[derive(Diagnostic)] |
| 1140 | 1140 | #[diag(passes_unlabeled_in_labeled_block, code = E0695)] |
| 1141 | pub struct UnlabeledInLabeledBlock<'a> { | |
| 1141 | pub(crate) struct UnlabeledInLabeledBlock<'a> { | |
| 1142 | 1142 | #[primary_span] |
| 1143 | 1143 | #[label] |
| 1144 | 1144 | pub span: Span, |
| ... | ... | @@ -1147,7 +1147,7 @@ pub struct UnlabeledInLabeledBlock<'a> { |
| 1147 | 1147 | |
| 1148 | 1148 | #[derive(Diagnostic)] |
| 1149 | 1149 | #[diag(passes_unlabeled_cf_in_while_condition, code = E0590)] |
| 1150 | pub struct UnlabeledCfInWhileCondition<'a> { | |
| 1150 | pub(crate) struct UnlabeledCfInWhileCondition<'a> { | |
| 1151 | 1151 | #[primary_span] |
| 1152 | 1152 | #[label] |
| 1153 | 1153 | pub span: Span, |
| ... | ... | @@ -1156,11 +1156,11 @@ pub struct UnlabeledCfInWhileCondition<'a> { |
| 1156 | 1156 | |
| 1157 | 1157 | #[derive(LintDiagnostic)] |
| 1158 | 1158 | #[diag(passes_undefined_naked_function_abi)] |
| 1159 | pub struct UndefinedNakedFunctionAbi; | |
| 1159 | pub(crate) struct UndefinedNakedFunctionAbi; | |
| 1160 | 1160 | |
| 1161 | 1161 | #[derive(Diagnostic)] |
| 1162 | 1162 | #[diag(passes_no_patterns)] |
| 1163 | pub struct NoPatterns { | |
| 1163 | pub(crate) struct NoPatterns { | |
| 1164 | 1164 | #[primary_span] |
| 1165 | 1165 | pub span: Span, |
| 1166 | 1166 | } |
| ... | ... | @@ -1168,12 +1168,12 @@ pub struct NoPatterns { |
| 1168 | 1168 | #[derive(Diagnostic)] |
| 1169 | 1169 | #[diag(passes_params_not_allowed)] |
| 1170 | 1170 | #[help] |
| 1171 | pub struct ParamsNotAllowed { | |
| 1171 | pub(crate) struct ParamsNotAllowed { | |
| 1172 | 1172 | #[primary_span] |
| 1173 | 1173 | pub span: Span, |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | pub struct NakedFunctionsAsmBlock { | |
| 1176 | pub(crate) struct NakedFunctionsAsmBlock { | |
| 1177 | 1177 | pub span: Span, |
| 1178 | 1178 | pub multiple_asms: Vec<Span>, |
| 1179 | 1179 | pub non_asms: Vec<Span>, |
| ... | ... | @@ -1197,14 +1197,14 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for NakedFunctionsAsmBlock { |
| 1197 | 1197 | |
| 1198 | 1198 | #[derive(Diagnostic)] |
| 1199 | 1199 | #[diag(passes_naked_functions_operands, code = E0787)] |
| 1200 | pub struct NakedFunctionsOperands { | |
| 1200 | pub(crate) struct NakedFunctionsOperands { | |
| 1201 | 1201 | #[primary_span] |
| 1202 | 1202 | pub unsupported_operands: Vec<Span>, |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | #[derive(Diagnostic)] |
| 1206 | 1206 | #[diag(passes_naked_functions_asm_options, code = E0787)] |
| 1207 | pub struct NakedFunctionsAsmOptions { | |
| 1207 | pub(crate) struct NakedFunctionsAsmOptions { | |
| 1208 | 1208 | #[primary_span] |
| 1209 | 1209 | pub span: Span, |
| 1210 | 1210 | pub unsupported_options: String, |
| ... | ... | @@ -1212,7 +1212,7 @@ pub struct NakedFunctionsAsmOptions { |
| 1212 | 1212 | |
| 1213 | 1213 | #[derive(Diagnostic)] |
| 1214 | 1214 | #[diag(passes_naked_functions_must_use_noreturn, code = E0787)] |
| 1215 | pub struct NakedFunctionsMustUseNoreturn { | |
| 1215 | pub(crate) struct NakedFunctionsMustUseNoreturn { | |
| 1216 | 1216 | #[primary_span] |
| 1217 | 1217 | pub span: Span, |
| 1218 | 1218 | #[suggestion(code = ", options(noreturn)", applicability = "machine-applicable")] |
| ... | ... | @@ -1221,7 +1221,7 @@ pub struct NakedFunctionsMustUseNoreturn { |
| 1221 | 1221 | |
| 1222 | 1222 | #[derive(Diagnostic)] |
| 1223 | 1223 | #[diag(passes_naked_functions_incompatible_attribute, code = E0736)] |
| 1224 | pub struct NakedFunctionIncompatibleAttribute { | |
| 1224 | pub(crate) struct NakedFunctionIncompatibleAttribute { | |
| 1225 | 1225 | #[primary_span] |
| 1226 | 1226 | #[label] |
| 1227 | 1227 | pub span: Span, |
| ... | ... | @@ -1232,7 +1232,7 @@ pub struct NakedFunctionIncompatibleAttribute { |
| 1232 | 1232 | |
| 1233 | 1233 | #[derive(Diagnostic)] |
| 1234 | 1234 | #[diag(passes_attr_only_in_functions)] |
| 1235 | pub struct AttrOnlyInFunctions { | |
| 1235 | pub(crate) struct AttrOnlyInFunctions { | |
| 1236 | 1236 | #[primary_span] |
| 1237 | 1237 | pub span: Span, |
| 1238 | 1238 | pub attr: Symbol, |
| ... | ... | @@ -1240,7 +1240,7 @@ pub struct AttrOnlyInFunctions { |
| 1240 | 1240 | |
| 1241 | 1241 | #[derive(Diagnostic)] |
| 1242 | 1242 | #[diag(passes_multiple_rustc_main, code = E0137)] |
| 1243 | pub struct MultipleRustcMain { | |
| 1243 | pub(crate) struct MultipleRustcMain { | |
| 1244 | 1244 | #[primary_span] |
| 1245 | 1245 | pub span: Span, |
| 1246 | 1246 | #[label(passes_first)] |
| ... | ... | @@ -1251,7 +1251,7 @@ pub struct MultipleRustcMain { |
| 1251 | 1251 | |
| 1252 | 1252 | #[derive(Diagnostic)] |
| 1253 | 1253 | #[diag(passes_multiple_start_functions, code = E0138)] |
| 1254 | pub struct MultipleStartFunctions { | |
| 1254 | pub(crate) struct MultipleStartFunctions { | |
| 1255 | 1255 | #[primary_span] |
| 1256 | 1256 | pub span: Span, |
| 1257 | 1257 | #[label] |
| ... | ... | @@ -1262,12 +1262,12 @@ pub struct MultipleStartFunctions { |
| 1262 | 1262 | |
| 1263 | 1263 | #[derive(Diagnostic)] |
| 1264 | 1264 | #[diag(passes_extern_main)] |
| 1265 | pub struct ExternMain { | |
| 1265 | pub(crate) struct ExternMain { | |
| 1266 | 1266 | #[primary_span] |
| 1267 | 1267 | pub span: Span, |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | pub struct NoMainErr { | |
| 1270 | pub(crate) struct NoMainErr { | |
| 1271 | 1271 | pub sp: Span, |
| 1272 | 1272 | pub crate_name: Symbol, |
| 1273 | 1273 | pub has_filename: bool, |
| ... | ... | @@ -1321,7 +1321,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NoMainErr { |
| 1321 | 1321 | } |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | pub struct DuplicateLangItem { | |
| 1324 | pub(crate) struct DuplicateLangItem { | |
| 1325 | 1325 | pub local_span: Option<Span>, |
| 1326 | 1326 | pub lang_item_name: Symbol, |
| 1327 | 1327 | pub crate_name: Symbol, |
| ... | ... | @@ -1386,7 +1386,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for DuplicateLangItem { |
| 1386 | 1386 | |
| 1387 | 1387 | #[derive(Diagnostic)] |
| 1388 | 1388 | #[diag(passes_incorrect_target, code = E0718)] |
| 1389 | pub struct IncorrectTarget<'a> { | |
| 1389 | pub(crate) struct IncorrectTarget<'a> { | |
| 1390 | 1390 | #[primary_span] |
| 1391 | 1391 | pub span: Span, |
| 1392 | 1392 | #[label] |
| ... | ... | @@ -1400,21 +1400,21 @@ pub struct IncorrectTarget<'a> { |
| 1400 | 1400 | |
| 1401 | 1401 | #[derive(LintDiagnostic)] |
| 1402 | 1402 | #[diag(passes_useless_assignment)] |
| 1403 | pub struct UselessAssignment<'a> { | |
| 1403 | pub(crate) struct UselessAssignment<'a> { | |
| 1404 | 1404 | pub is_field_assign: bool, |
| 1405 | 1405 | pub ty: Ty<'a>, |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | #[derive(LintDiagnostic)] |
| 1409 | 1409 | #[diag(passes_only_has_effect_on)] |
| 1410 | pub struct OnlyHasEffectOn { | |
| 1410 | pub(crate) struct OnlyHasEffectOn { | |
| 1411 | 1411 | pub attr_name: Symbol, |
| 1412 | 1412 | pub target_name: String, |
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | #[derive(Diagnostic)] |
| 1416 | 1416 | #[diag(passes_object_lifetime_err)] |
| 1417 | pub struct ObjectLifetimeErr { | |
| 1417 | pub(crate) struct ObjectLifetimeErr { | |
| 1418 | 1418 | #[primary_span] |
| 1419 | 1419 | pub span: Span, |
| 1420 | 1420 | pub repr: String, |
| ... | ... | @@ -1423,13 +1423,13 @@ pub struct ObjectLifetimeErr { |
| 1423 | 1423 | #[derive(Diagnostic)] |
| 1424 | 1424 | #[diag(passes_unrecognized_repr_hint, code = E0552)] |
| 1425 | 1425 | #[help] |
| 1426 | pub struct UnrecognizedReprHint { | |
| 1426 | pub(crate) struct UnrecognizedReprHint { | |
| 1427 | 1427 | #[primary_span] |
| 1428 | 1428 | pub span: Span, |
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | 1431 | #[derive(Diagnostic)] |
| 1432 | pub enum AttrApplication { | |
| 1432 | pub(crate) enum AttrApplication { | |
| 1433 | 1433 | #[diag(passes_attr_application_enum, code = E0517)] |
| 1434 | 1434 | Enum { |
| 1435 | 1435 | #[primary_span] |
| ... | ... | @@ -1469,7 +1469,7 @@ pub enum AttrApplication { |
| 1469 | 1469 | |
| 1470 | 1470 | #[derive(Diagnostic)] |
| 1471 | 1471 | #[diag(passes_transparent_incompatible, code = E0692)] |
| 1472 | pub struct TransparentIncompatible { | |
| 1472 | pub(crate) struct TransparentIncompatible { | |
| 1473 | 1473 | #[primary_span] |
| 1474 | 1474 | pub hint_spans: Vec<Span>, |
| 1475 | 1475 | pub target: String, |
| ... | ... | @@ -1477,14 +1477,14 @@ pub struct TransparentIncompatible { |
| 1477 | 1477 | |
| 1478 | 1478 | #[derive(Diagnostic)] |
| 1479 | 1479 | #[diag(passes_deprecated_attribute, code = E0549)] |
| 1480 | pub struct DeprecatedAttribute { | |
| 1480 | pub(crate) struct DeprecatedAttribute { | |
| 1481 | 1481 | #[primary_span] |
| 1482 | 1482 | pub span: Span, |
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | 1485 | #[derive(Diagnostic)] |
| 1486 | 1486 | #[diag(passes_useless_stability)] |
| 1487 | pub struct UselessStability { | |
| 1487 | pub(crate) struct UselessStability { | |
| 1488 | 1488 | #[primary_span] |
| 1489 | 1489 | #[label] |
| 1490 | 1490 | pub span: Span, |
| ... | ... | @@ -1494,7 +1494,7 @@ pub struct UselessStability { |
| 1494 | 1494 | |
| 1495 | 1495 | #[derive(Diagnostic)] |
| 1496 | 1496 | #[diag(passes_cannot_stabilize_deprecated)] |
| 1497 | pub struct CannotStabilizeDeprecated { | |
| 1497 | pub(crate) struct CannotStabilizeDeprecated { | |
| 1498 | 1498 | #[primary_span] |
| 1499 | 1499 | #[label] |
| 1500 | 1500 | pub span: Span, |
| ... | ... | @@ -1504,7 +1504,7 @@ pub struct CannotStabilizeDeprecated { |
| 1504 | 1504 | |
| 1505 | 1505 | #[derive(Diagnostic)] |
| 1506 | 1506 | #[diag(passes_missing_stability_attr)] |
| 1507 | pub struct MissingStabilityAttr<'a> { | |
| 1507 | pub(crate) struct MissingStabilityAttr<'a> { | |
| 1508 | 1508 | #[primary_span] |
| 1509 | 1509 | pub span: Span, |
| 1510 | 1510 | pub descr: &'a str, |
| ... | ... | @@ -1512,7 +1512,7 @@ pub struct MissingStabilityAttr<'a> { |
| 1512 | 1512 | |
| 1513 | 1513 | #[derive(Diagnostic)] |
| 1514 | 1514 | #[diag(passes_missing_const_stab_attr)] |
| 1515 | pub struct MissingConstStabAttr<'a> { | |
| 1515 | pub(crate) struct MissingConstStabAttr<'a> { | |
| 1516 | 1516 | #[primary_span] |
| 1517 | 1517 | pub span: Span, |
| 1518 | 1518 | pub descr: &'a str, |
| ... | ... | @@ -1521,14 +1521,14 @@ pub struct MissingConstStabAttr<'a> { |
| 1521 | 1521 | #[derive(Diagnostic)] |
| 1522 | 1522 | #[diag(passes_trait_impl_const_stable)] |
| 1523 | 1523 | #[note] |
| 1524 | pub struct TraitImplConstStable { | |
| 1524 | pub(crate) struct TraitImplConstStable { | |
| 1525 | 1525 | #[primary_span] |
| 1526 | 1526 | pub span: Span, |
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | 1529 | #[derive(Diagnostic)] |
| 1530 | 1530 | #[diag(passes_unknown_feature, code = E0635)] |
| 1531 | pub struct UnknownFeature { | |
| 1531 | pub(crate) struct UnknownFeature { | |
| 1532 | 1532 | #[primary_span] |
| 1533 | 1533 | pub span: Span, |
| 1534 | 1534 | pub feature: Symbol, |
| ... | ... | @@ -1536,7 +1536,7 @@ pub struct UnknownFeature { |
| 1536 | 1536 | |
| 1537 | 1537 | #[derive(Diagnostic)] |
| 1538 | 1538 | #[diag(passes_implied_feature_not_exist)] |
| 1539 | pub struct ImpliedFeatureNotExist { | |
| 1539 | pub(crate) struct ImpliedFeatureNotExist { | |
| 1540 | 1540 | #[primary_span] |
| 1541 | 1541 | pub span: Span, |
| 1542 | 1542 | pub feature: Symbol, |
| ... | ... | @@ -1545,14 +1545,14 @@ pub struct ImpliedFeatureNotExist { |
| 1545 | 1545 | |
| 1546 | 1546 | #[derive(Diagnostic)] |
| 1547 | 1547 | #[diag(passes_duplicate_feature_err, code = E0636)] |
| 1548 | pub struct DuplicateFeatureErr { | |
| 1548 | pub(crate) struct DuplicateFeatureErr { | |
| 1549 | 1549 | #[primary_span] |
| 1550 | 1550 | pub span: Span, |
| 1551 | 1551 | pub feature: Symbol, |
| 1552 | 1552 | } |
| 1553 | 1553 | #[derive(Diagnostic)] |
| 1554 | 1554 | #[diag(passes_missing_const_err)] |
| 1555 | pub struct MissingConstErr { | |
| 1555 | pub(crate) struct MissingConstErr { | |
| 1556 | 1556 | #[primary_span] |
| 1557 | 1557 | #[help] |
| 1558 | 1558 | pub fn_sig_span: Span, |
| ... | ... | @@ -1561,7 +1561,7 @@ pub struct MissingConstErr { |
| 1561 | 1561 | } |
| 1562 | 1562 | |
| 1563 | 1563 | #[derive(LintDiagnostic)] |
| 1564 | pub enum MultipleDeadCodes<'tcx> { | |
| 1564 | pub(crate) enum MultipleDeadCodes<'tcx> { | |
| 1565 | 1565 | #[diag(passes_dead_codes)] |
| 1566 | 1566 | DeadCodes { |
| 1567 | 1567 | multiple: bool, |
| ... | ... | @@ -1592,7 +1592,7 @@ pub enum MultipleDeadCodes<'tcx> { |
| 1592 | 1592 | |
| 1593 | 1593 | #[derive(Subdiagnostic)] |
| 1594 | 1594 | #[label(passes_parent_info)] |
| 1595 | pub struct ParentInfo<'tcx> { | |
| 1595 | pub(crate) struct ParentInfo<'tcx> { | |
| 1596 | 1596 | pub num: usize, |
| 1597 | 1597 | pub descr: &'tcx str, |
| 1598 | 1598 | pub parent_descr: &'tcx str, |
| ... | ... | @@ -1602,14 +1602,14 @@ pub struct ParentInfo<'tcx> { |
| 1602 | 1602 | |
| 1603 | 1603 | #[derive(Subdiagnostic)] |
| 1604 | 1604 | #[note(passes_ignored_derived_impls)] |
| 1605 | pub struct IgnoredDerivedImpls { | |
| 1605 | pub(crate) struct IgnoredDerivedImpls { | |
| 1606 | 1606 | pub name: Symbol, |
| 1607 | 1607 | pub trait_list: DiagSymbolList, |
| 1608 | 1608 | pub trait_list_len: usize, |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | 1611 | #[derive(Subdiagnostic)] |
| 1612 | pub enum ChangeFields { | |
| 1612 | pub(crate) enum ChangeFields { | |
| 1613 | 1613 | #[multipart_suggestion( |
| 1614 | 1614 | passes_change_fields_to_be_of_unit_type, |
| 1615 | 1615 | applicability = "has-placeholders" |
| ... | ... | @@ -1633,14 +1633,14 @@ pub(crate) struct ProcMacroBadSig { |
| 1633 | 1633 | |
| 1634 | 1634 | #[derive(Diagnostic)] |
| 1635 | 1635 | #[diag(passes_skipping_const_checks)] |
| 1636 | pub struct SkippingConstChecks { | |
| 1636 | pub(crate) struct SkippingConstChecks { | |
| 1637 | 1637 | #[primary_span] |
| 1638 | 1638 | pub span: Span, |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | #[derive(LintDiagnostic)] |
| 1642 | 1642 | #[diag(passes_unreachable_due_to_uninhabited)] |
| 1643 | pub struct UnreachableDueToUninhabited<'desc, 'tcx> { | |
| 1643 | pub(crate) struct UnreachableDueToUninhabited<'desc, 'tcx> { | |
| 1644 | 1644 | pub descr: &'desc str, |
| 1645 | 1645 | #[label] |
| 1646 | 1646 | pub expr: Span, |
| ... | ... | @@ -1653,20 +1653,20 @@ pub struct UnreachableDueToUninhabited<'desc, 'tcx> { |
| 1653 | 1653 | #[derive(LintDiagnostic)] |
| 1654 | 1654 | #[diag(passes_unused_var_maybe_capture_ref)] |
| 1655 | 1655 | #[help] |
| 1656 | pub struct UnusedVarMaybeCaptureRef { | |
| 1656 | pub(crate) struct UnusedVarMaybeCaptureRef { | |
| 1657 | 1657 | pub name: String, |
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | #[derive(LintDiagnostic)] |
| 1661 | 1661 | #[diag(passes_unused_capture_maybe_capture_ref)] |
| 1662 | 1662 | #[help] |
| 1663 | pub struct UnusedCaptureMaybeCaptureRef { | |
| 1663 | pub(crate) struct UnusedCaptureMaybeCaptureRef { | |
| 1664 | 1664 | pub name: String, |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | #[derive(LintDiagnostic)] |
| 1668 | 1668 | #[diag(passes_unused_var_remove_field)] |
| 1669 | pub struct UnusedVarRemoveField { | |
| 1669 | pub(crate) struct UnusedVarRemoveField { | |
| 1670 | 1670 | pub name: String, |
| 1671 | 1671 | #[subdiagnostic] |
| 1672 | 1672 | pub sugg: UnusedVarRemoveFieldSugg, |
| ... | ... | @@ -1677,7 +1677,7 @@ pub struct UnusedVarRemoveField { |
| 1677 | 1677 | passes_unused_var_remove_field_suggestion, |
| 1678 | 1678 | applicability = "machine-applicable" |
| 1679 | 1679 | )] |
| 1680 | pub struct UnusedVarRemoveFieldSugg { | |
| 1680 | pub(crate) struct UnusedVarRemoveFieldSugg { | |
| 1681 | 1681 | #[suggestion_part(code = "")] |
| 1682 | 1682 | pub spans: Vec<Span>, |
| 1683 | 1683 | } |
| ... | ... | @@ -1685,20 +1685,20 @@ pub struct UnusedVarRemoveFieldSugg { |
| 1685 | 1685 | #[derive(LintDiagnostic)] |
| 1686 | 1686 | #[diag(passes_unused_var_assigned_only)] |
| 1687 | 1687 | #[note] |
| 1688 | pub struct UnusedVarAssignedOnly { | |
| 1688 | pub(crate) struct UnusedVarAssignedOnly { | |
| 1689 | 1689 | pub name: String, |
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | #[derive(LintDiagnostic)] |
| 1693 | 1693 | #[diag(passes_unnecessary_stable_feature)] |
| 1694 | pub struct UnnecessaryStableFeature { | |
| 1694 | pub(crate) struct UnnecessaryStableFeature { | |
| 1695 | 1695 | pub feature: Symbol, |
| 1696 | 1696 | pub since: Symbol, |
| 1697 | 1697 | } |
| 1698 | 1698 | |
| 1699 | 1699 | #[derive(LintDiagnostic)] |
| 1700 | 1700 | #[diag(passes_unnecessary_partial_stable_feature)] |
| 1701 | pub struct UnnecessaryPartialStableFeature { | |
| 1701 | pub(crate) struct UnnecessaryPartialStableFeature { | |
| 1702 | 1702 | #[suggestion(code = "{implies}", applicability = "maybe-incorrect")] |
| 1703 | 1703 | pub span: Span, |
| 1704 | 1704 | #[suggestion(passes_suggestion_remove, code = "", applicability = "maybe-incorrect")] |
| ... | ... | @@ -1711,25 +1711,25 @@ pub struct UnnecessaryPartialStableFeature { |
| 1711 | 1711 | #[derive(LintDiagnostic)] |
| 1712 | 1712 | #[diag(passes_ineffective_unstable_impl)] |
| 1713 | 1713 | #[note] |
| 1714 | pub struct IneffectiveUnstableImpl; | |
| 1714 | pub(crate) struct IneffectiveUnstableImpl; | |
| 1715 | 1715 | |
| 1716 | 1716 | #[derive(LintDiagnostic)] |
| 1717 | 1717 | #[diag(passes_unused_assign)] |
| 1718 | 1718 | #[help] |
| 1719 | pub struct UnusedAssign { | |
| 1719 | pub(crate) struct UnusedAssign { | |
| 1720 | 1720 | pub name: String, |
| 1721 | 1721 | } |
| 1722 | 1722 | |
| 1723 | 1723 | #[derive(LintDiagnostic)] |
| 1724 | 1724 | #[diag(passes_unused_assign_passed)] |
| 1725 | 1725 | #[help] |
| 1726 | pub struct UnusedAssignPassed { | |
| 1726 | pub(crate) struct UnusedAssignPassed { | |
| 1727 | 1727 | pub name: String, |
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | 1730 | #[derive(LintDiagnostic)] |
| 1731 | 1731 | #[diag(passes_unused_variable_try_prefix)] |
| 1732 | pub struct UnusedVariableTryPrefix { | |
| 1732 | pub(crate) struct UnusedVariableTryPrefix { | |
| 1733 | 1733 | #[label] |
| 1734 | 1734 | pub label: Option<Span>, |
| 1735 | 1735 | #[subdiagnostic] |
| ... | ... | @@ -1740,7 +1740,7 @@ pub struct UnusedVariableTryPrefix { |
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | #[derive(Subdiagnostic)] |
| 1743 | pub enum UnusedVariableSugg { | |
| 1743 | pub(crate) enum UnusedVariableSugg { | |
| 1744 | 1744 | #[multipart_suggestion(passes_suggestion, applicability = "maybe-incorrect")] |
| 1745 | 1745 | TryPrefixSugg { |
| 1746 | 1746 | #[suggestion_part(code = "_{name}")] |
| ... | ... | @@ -1755,7 +1755,7 @@ pub enum UnusedVariableSugg { |
| 1755 | 1755 | }, |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | pub struct UnusedVariableStringInterp { | |
| 1758 | pub(crate) struct UnusedVariableStringInterp { | |
| 1759 | 1759 | pub lit: Span, |
| 1760 | 1760 | pub lo: Span, |
| 1761 | 1761 | pub hi: Span, |
| ... | ... | @@ -1778,14 +1778,14 @@ impl Subdiagnostic for UnusedVariableStringInterp { |
| 1778 | 1778 | |
| 1779 | 1779 | #[derive(LintDiagnostic)] |
| 1780 | 1780 | #[diag(passes_unused_variable_try_ignore)] |
| 1781 | pub struct UnusedVarTryIgnore { | |
| 1781 | pub(crate) struct UnusedVarTryIgnore { | |
| 1782 | 1782 | #[subdiagnostic] |
| 1783 | 1783 | pub sugg: UnusedVarTryIgnoreSugg, |
| 1784 | 1784 | } |
| 1785 | 1785 | |
| 1786 | 1786 | #[derive(Subdiagnostic)] |
| 1787 | 1787 | #[multipart_suggestion(passes_suggestion, applicability = "maybe-incorrect")] |
| 1788 | pub struct UnusedVarTryIgnoreSugg { | |
| 1788 | pub(crate) struct UnusedVarTryIgnoreSugg { | |
| 1789 | 1789 | #[suggestion_part(code = "{name}: _")] |
| 1790 | 1790 | pub shorthands: Vec<Span>, |
| 1791 | 1791 | #[suggestion_part(code = "_")] |
| ... | ... | @@ -1796,14 +1796,14 @@ pub struct UnusedVarTryIgnoreSugg { |
| 1796 | 1796 | #[derive(LintDiagnostic)] |
| 1797 | 1797 | #[diag(passes_attr_crate_level)] |
| 1798 | 1798 | #[note] |
| 1799 | pub struct AttrCrateLevelOnly { | |
| 1799 | pub(crate) struct AttrCrateLevelOnly { | |
| 1800 | 1800 | #[subdiagnostic] |
| 1801 | 1801 | pub sugg: Option<AttrCrateLevelOnlySugg>, |
| 1802 | 1802 | } |
| 1803 | 1803 | |
| 1804 | 1804 | #[derive(Subdiagnostic)] |
| 1805 | 1805 | #[suggestion(passes_suggestion, applicability = "maybe-incorrect", code = "!", style = "verbose")] |
| 1806 | pub struct AttrCrateLevelOnlySugg { | |
| 1806 | pub(crate) struct AttrCrateLevelOnlySugg { | |
| 1807 | 1807 | #[primary_span] |
| 1808 | 1808 | pub attr: Span, |
| 1809 | 1809 | } |
compiler/rustc_passes/src/lang_items.rs+1-1| ... | ... | @@ -359,6 +359,6 @@ impl<'ast, 'tcx> visit::Visitor<'ast> for LanguageItemCollector<'ast, 'tcx> { |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | pub fn provide(providers: &mut Providers) { | |
| 362 | pub(crate) fn provide(providers: &mut Providers) { | |
| 363 | 363 | providers.get_lang_items = get_lang_items; |
| 364 | 364 | } |
compiler/rustc_passes/src/lib.rs+1| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #![feature(map_try_insert)] |
| 13 | 13 | #![feature(rustdoc_internals)] |
| 14 | 14 | #![feature(try_blocks)] |
| 15 | #![warn(unreachable_pub)] | |
| 15 | 16 | // tidy-alphabetical-end |
| 16 | 17 | |
| 17 | 18 | use rustc_middle::query::Providers; |
compiler/rustc_passes/src/lib_features.rs+2-2| ... | ... | @@ -16,7 +16,7 @@ use rustc_span::{sym, Span}; |
| 16 | 16 | |
| 17 | 17 | use crate::errors::{FeaturePreviouslyDeclared, FeatureStableTwice}; |
| 18 | 18 | |
| 19 | pub struct LibFeatureCollector<'tcx> { | |
| 19 | struct LibFeatureCollector<'tcx> { | |
| 20 | 20 | tcx: TyCtxt<'tcx>, |
| 21 | 21 | lib_features: LibFeatures, |
| 22 | 22 | } |
| ... | ... | @@ -153,6 +153,6 @@ fn lib_features(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> LibFeatures { |
| 153 | 153 | collector.lib_features |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | pub fn provide(providers: &mut Providers) { | |
| 156 | pub(crate) fn provide(providers: &mut Providers) { | |
| 157 | 157 | providers.lib_features = lib_features; |
| 158 | 158 | } |
compiler/rustc_passes/src/liveness.rs+1-1| ... | ... | @@ -178,7 +178,7 @@ fn check_liveness(tcx: TyCtxt<'_>, def_id: LocalDefId) { |
| 178 | 178 | lsets.warn_about_unused_args(&body, entry_ln); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | pub fn provide(providers: &mut Providers) { | |
| 181 | pub(crate) fn provide(providers: &mut Providers) { | |
| 182 | 182 | *providers = Providers { check_liveness, ..*providers }; |
| 183 | 183 | } |
| 184 | 184 |
compiler/rustc_passes/src/reachable.rs+1-1| ... | ... | @@ -500,6 +500,6 @@ fn reachable_set(tcx: TyCtxt<'_>, (): ()) -> LocalDefIdSet { |
| 500 | 500 | reachable_context.reachable_symbols |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | pub fn provide(providers: &mut Providers) { | |
| 503 | pub(crate) fn provide(providers: &mut Providers) { | |
| 504 | 504 | *providers = Providers { reachable_set, ..*providers }; |
| 505 | 505 | } |
compiler/rustc_passes/src/upvars.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ use rustc_middle::query::Providers; |
| 9 | 9 | use rustc_middle::ty::TyCtxt; |
| 10 | 10 | use rustc_span::Span; |
| 11 | 11 | |
| 12 | pub fn provide(providers: &mut Providers) { | |
| 12 | pub(crate) fn provide(providers: &mut Providers) { | |
| 13 | 13 | providers.upvars_mentioned = |tcx, def_id| { |
| 14 | 14 | if !tcx.is_closure_like(def_id) { |
| 15 | 15 | return None; |
compiler/rustc_passes/src/weak_lang_items.rs+5-1| ... | ... | @@ -15,7 +15,11 @@ use crate::errors::{ |
| 15 | 15 | |
| 16 | 16 | /// Checks the crate for usage of weak lang items, returning a vector of all the |
| 17 | 17 | /// lang items required by this crate, but not defined yet. |
| 18 | pub fn check_crate(tcx: TyCtxt<'_>, items: &mut lang_items::LanguageItems, krate: &ast::Crate) { | |
| 18 | pub(crate) fn check_crate( | |
| 19 | tcx: TyCtxt<'_>, | |
| 20 | items: &mut lang_items::LanguageItems, | |
| 21 | krate: &ast::Crate, | |
| 22 | ) { | |
| 19 | 23 | // These are never called by user code, they're generated by the compiler. |
| 20 | 24 | // They will never implicitly be added to the `missing` array unless we do |
| 21 | 25 | // so here. |
compiler/rustc_pattern_analysis/src/lib.rs+1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | #![allow(rustc::diagnostic_outside_of_impl)] |
| 7 | 7 | #![allow(rustc::untranslatable_diagnostic)] |
| 8 | 8 | #![cfg_attr(feature = "rustc", feature(let_chains))] |
| 9 | #![warn(unreachable_pub)] | |
| 9 | 10 | // tidy-alphabetical-end |
| 10 | 11 | |
| 11 | 12 | pub mod constructor; |
compiler/rustc_privacy/src/errors.rs+9-9| ... | ... | @@ -5,7 +5,7 @@ use rustc_span::{Span, Symbol}; |
| 5 | 5 | |
| 6 | 6 | #[derive(Diagnostic)] |
| 7 | 7 | #[diag(privacy_field_is_private, code = E0451)] |
| 8 | pub struct FieldIsPrivate { | |
| 8 | pub(crate) struct FieldIsPrivate { | |
| 9 | 9 | #[primary_span] |
| 10 | 10 | pub span: Span, |
| 11 | 11 | pub field_name: Symbol, |
| ... | ... | @@ -16,7 +16,7 @@ pub struct FieldIsPrivate { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | #[derive(Subdiagnostic)] |
| 19 | pub enum FieldIsPrivateLabel { | |
| 19 | pub(crate) enum FieldIsPrivateLabel { | |
| 20 | 20 | #[label(privacy_field_is_private_is_update_syntax_label)] |
| 21 | 21 | IsUpdateSyntax { |
| 22 | 22 | #[primary_span] |
| ... | ... | @@ -32,7 +32,7 @@ pub enum FieldIsPrivateLabel { |
| 32 | 32 | |
| 33 | 33 | #[derive(Diagnostic)] |
| 34 | 34 | #[diag(privacy_item_is_private)] |
| 35 | pub struct ItemIsPrivate<'a> { | |
| 35 | pub(crate) struct ItemIsPrivate<'a> { | |
| 36 | 36 | #[primary_span] |
| 37 | 37 | #[label] |
| 38 | 38 | pub span: Span, |
| ... | ... | @@ -42,7 +42,7 @@ pub struct ItemIsPrivate<'a> { |
| 42 | 42 | |
| 43 | 43 | #[derive(Diagnostic)] |
| 44 | 44 | #[diag(privacy_unnamed_item_is_private)] |
| 45 | pub struct UnnamedItemIsPrivate { | |
| 45 | pub(crate) struct UnnamedItemIsPrivate { | |
| 46 | 46 | #[primary_span] |
| 47 | 47 | pub span: Span, |
| 48 | 48 | pub kind: &'static str, |
| ... | ... | @@ -50,7 +50,7 @@ pub struct UnnamedItemIsPrivate { |
| 50 | 50 | |
| 51 | 51 | #[derive(Diagnostic)] |
| 52 | 52 | #[diag(privacy_in_public_interface, code = E0446)] |
| 53 | pub struct InPublicInterface<'a> { | |
| 53 | pub(crate) struct InPublicInterface<'a> { | |
| 54 | 54 | #[primary_span] |
| 55 | 55 | #[label] |
| 56 | 56 | pub span: Span, |
| ... | ... | @@ -63,7 +63,7 @@ pub struct InPublicInterface<'a> { |
| 63 | 63 | |
| 64 | 64 | #[derive(Diagnostic)] |
| 65 | 65 | #[diag(privacy_report_effective_visibility)] |
| 66 | pub struct ReportEffectiveVisibility { | |
| 66 | pub(crate) struct ReportEffectiveVisibility { | |
| 67 | 67 | #[primary_span] |
| 68 | 68 | pub span: Span, |
| 69 | 69 | pub descr: String, |
| ... | ... | @@ -71,7 +71,7 @@ pub struct ReportEffectiveVisibility { |
| 71 | 71 | |
| 72 | 72 | #[derive(LintDiagnostic)] |
| 73 | 73 | #[diag(privacy_from_private_dep_in_public_interface)] |
| 74 | pub struct FromPrivateDependencyInPublicInterface<'a> { | |
| 74 | pub(crate) struct FromPrivateDependencyInPublicInterface<'a> { | |
| 75 | 75 | pub kind: &'a str, |
| 76 | 76 | pub descr: DiagArgFromDisplay<'a>, |
| 77 | 77 | pub krate: Symbol, |
| ... | ... | @@ -79,7 +79,7 @@ pub struct FromPrivateDependencyInPublicInterface<'a> { |
| 79 | 79 | |
| 80 | 80 | #[derive(LintDiagnostic)] |
| 81 | 81 | #[diag(privacy_unnameable_types_lint)] |
| 82 | pub struct UnnameableTypesLint<'a> { | |
| 82 | pub(crate) struct UnnameableTypesLint<'a> { | |
| 83 | 83 | #[label] |
| 84 | 84 | pub span: Span, |
| 85 | 85 | pub kind: &'a str, |
| ... | ... | @@ -93,7 +93,7 @@ pub struct UnnameableTypesLint<'a> { |
| 93 | 93 | // See https://rust-lang.github.io/rfcs/2145-type-privacy.html for more details. |
| 94 | 94 | #[derive(LintDiagnostic)] |
| 95 | 95 | #[diag(privacy_private_interface_or_bounds_lint)] |
| 96 | pub struct PrivateInterfacesOrBoundsLint<'a> { | |
| 96 | pub(crate) struct PrivateInterfacesOrBoundsLint<'a> { | |
| 97 | 97 | #[label(privacy_item_label)] |
| 98 | 98 | pub item_span: Span, |
| 99 | 99 | pub item_kind: &'a str, |
compiler/rustc_privacy/src/lib.rs+2-1| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | #![feature(let_chains)] |
| 7 | 7 | #![feature(rustdoc_internals)] |
| 8 | 8 | #![feature(try_blocks)] |
| 9 | #![warn(unreachable_pub)] | |
| 9 | 10 | // tidy-alphabetical-end |
| 10 | 11 | |
| 11 | 12 | mod errors; |
| ... | ... | @@ -1497,7 +1498,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> { |
| 1497 | 1498 | self.effective_visibilities.effective_vis(def_id).copied() |
| 1498 | 1499 | } |
| 1499 | 1500 | |
| 1500 | pub fn check_item(&mut self, id: ItemId) { | |
| 1501 | fn check_item(&mut self, id: ItemId) { | |
| 1501 | 1502 | let tcx = self.tcx; |
| 1502 | 1503 | let def_id = id.owner_id.def_id; |
| 1503 | 1504 | let item_visibility = tcx.local_visibility(def_id); |
compiler/rustc_query_impl/src/lib.rs+1| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | #![feature(min_specialization)] |
| 9 | 9 | #![feature(rustc_attrs)] |
| 10 | 10 | #![feature(rustdoc_internals)] |
| 11 | #![warn(unreachable_pub)] | |
| 11 | 12 | // tidy-alphabetical-end |
| 12 | 13 | |
| 13 | 14 | use field_offset::offset_of; |
compiler/rustc_query_impl/src/plumbing.rs+26-18| ... | ... | @@ -541,7 +541,7 @@ macro_rules! expand_if_cached { |
| 541 | 541 | /// Don't show the backtrace for query system by default |
| 542 | 542 | /// use `RUST_BACKTRACE=full` to show all the backtraces |
| 543 | 543 | #[inline(never)] |
| 544 | pub fn __rust_begin_short_backtrace<F, T>(f: F) -> T | |
| 544 | pub(crate) fn __rust_begin_short_backtrace<F, T>(f: F) -> T | |
| 545 | 545 | where |
| 546 | 546 | F: FnOnce() -> T, |
| 547 | 547 | { |
| ... | ... | @@ -557,17 +557,17 @@ macro_rules! define_queries { |
| 557 | 557 | $($(#[$attr:meta])* |
| 558 | 558 | [$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => { |
| 559 | 559 | |
| 560 | pub(crate) mod query_impl { $(pub mod $name { | |
| 560 | pub(crate) mod query_impl { $(pub(crate) mod $name { | |
| 561 | 561 | use super::super::*; |
| 562 | 562 | use std::marker::PhantomData; |
| 563 | 563 | |
| 564 | pub mod get_query_incr { | |
| 564 | pub(crate) mod get_query_incr { | |
| 565 | 565 | use super::*; |
| 566 | 566 | |
| 567 | 567 | // Adding `__rust_end_short_backtrace` marker to backtraces so that we emit the frames |
| 568 | 568 | // when `RUST_BACKTRACE=1`, add a new mod with `$name` here is to allow duplicate naming |
| 569 | 569 | #[inline(never)] |
| 570 | pub fn __rust_end_short_backtrace<'tcx>( | |
| 570 | pub(crate) fn __rust_end_short_backtrace<'tcx>( | |
| 571 | 571 | tcx: TyCtxt<'tcx>, |
| 572 | 572 | span: Span, |
| 573 | 573 | key: queries::$name::Key<'tcx>, |
| ... | ... | @@ -585,11 +585,11 @@ macro_rules! define_queries { |
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | pub mod get_query_non_incr { | |
| 588 | pub(crate) mod get_query_non_incr { | |
| 589 | 589 | use super::*; |
| 590 | 590 | |
| 591 | 591 | #[inline(never)] |
| 592 | pub fn __rust_end_short_backtrace<'tcx>( | |
| 592 | pub(crate) fn __rust_end_short_backtrace<'tcx>( | |
| 593 | 593 | tcx: TyCtxt<'tcx>, |
| 594 | 594 | span: Span, |
| 595 | 595 | key: queries::$name::Key<'tcx>, |
| ... | ... | @@ -604,7 +604,9 @@ macro_rules! define_queries { |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | pub fn dynamic_query<'tcx>() -> DynamicQuery<'tcx, queries::$name::Storage<'tcx>> { | |
| 607 | pub(crate) fn dynamic_query<'tcx>() | |
| 608 | -> DynamicQuery<'tcx, queries::$name::Storage<'tcx>> | |
| 609 | { | |
| 608 | 610 | DynamicQuery { |
| 609 | 611 | name: stringify!($name), |
| 610 | 612 | eval_always: is_eval_always!([$($modifiers)*]), |
| ... | ... | @@ -667,7 +669,7 @@ macro_rules! define_queries { |
| 667 | 669 | } |
| 668 | 670 | |
| 669 | 671 | #[derive(Copy, Clone, Default)] |
| 670 | pub struct QueryType<'tcx> { | |
| 672 | pub(crate) struct QueryType<'tcx> { | |
| 671 | 673 | data: PhantomData<&'tcx ()> |
| 672 | 674 | } |
| 673 | 675 | |
| ... | ... | @@ -696,7 +698,7 @@ macro_rules! define_queries { |
| 696 | 698 | } |
| 697 | 699 | } |
| 698 | 700 | |
| 699 | pub fn try_collect_active_jobs<'tcx>(tcx: TyCtxt<'tcx>, qmap: &mut QueryMap) { | |
| 701 | pub(crate) fn try_collect_active_jobs<'tcx>(tcx: TyCtxt<'tcx>, qmap: &mut QueryMap) { | |
| 700 | 702 | let make_query = |tcx, key| { |
| 701 | 703 | let kind = rustc_middle::dep_graph::dep_kinds::$name; |
| 702 | 704 | let name = stringify!($name); |
| ... | ... | @@ -711,11 +713,17 @@ macro_rules! define_queries { |
| 711 | 713 | // don't `unwrap()` here, just manually check for `None` and do best-effort error |
| 712 | 714 | // reporting. |
| 713 | 715 | if res.is_none() { |
| 714 | tracing::warn!("Failed to collect active jobs for query with name `{}`!", stringify!($name)); | |
| 716 | tracing::warn!( | |
| 717 | "Failed to collect active jobs for query with name `{}`!", | |
| 718 | stringify!($name) | |
| 719 | ); | |
| 715 | 720 | } |
| 716 | 721 | } |
| 717 | 722 | |
| 718 | pub fn alloc_self_profile_query_strings<'tcx>(tcx: TyCtxt<'tcx>, string_cache: &mut QueryKeyStringCache) { | |
| 723 | pub(crate) fn alloc_self_profile_query_strings<'tcx>( | |
| 724 | tcx: TyCtxt<'tcx>, | |
| 725 | string_cache: &mut QueryKeyStringCache | |
| 726 | ) { | |
| 719 | 727 | $crate::profiling_support::alloc_self_profile_query_strings_for_query_cache( |
| 720 | 728 | tcx, |
| 721 | 729 | stringify!($name), |
| ... | ... | @@ -725,7 +733,7 @@ macro_rules! define_queries { |
| 725 | 733 | } |
| 726 | 734 | |
| 727 | 735 | item_if_cached! { [$($modifiers)*] { |
| 728 | pub fn encode_query_results<'tcx>( | |
| 736 | pub(crate) fn encode_query_results<'tcx>( | |
| 729 | 737 | tcx: TyCtxt<'tcx>, |
| 730 | 738 | encoder: &mut CacheEncoder<'_, 'tcx>, |
| 731 | 739 | query_result_index: &mut EncodedDepNodeIndex |
| ... | ... | @@ -739,7 +747,7 @@ macro_rules! define_queries { |
| 739 | 747 | } |
| 740 | 748 | }} |
| 741 | 749 | |
| 742 | pub fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) { | |
| 750 | pub(crate) fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) { | |
| 743 | 751 | $crate::plumbing::query_key_hash_verify( |
| 744 | 752 | query_impl::$name::QueryType::config(tcx), |
| 745 | 753 | QueryCtxt::new(tcx), |
| ... | ... | @@ -795,7 +803,7 @@ macro_rules! define_queries { |
| 795 | 803 | use rustc_query_system::dep_graph::FingerprintStyle; |
| 796 | 804 | |
| 797 | 805 | // We use this for most things when incr. comp. is turned off. |
| 798 | pub fn Null<'tcx>() -> DepKindStruct<'tcx> { | |
| 806 | pub(crate) fn Null<'tcx>() -> DepKindStruct<'tcx> { | |
| 799 | 807 | DepKindStruct { |
| 800 | 808 | is_anon: false, |
| 801 | 809 | is_eval_always: false, |
| ... | ... | @@ -807,7 +815,7 @@ macro_rules! define_queries { |
| 807 | 815 | } |
| 808 | 816 | |
| 809 | 817 | // We use this for the forever-red node. |
| 810 | pub fn Red<'tcx>() -> DepKindStruct<'tcx> { | |
| 818 | pub(crate) fn Red<'tcx>() -> DepKindStruct<'tcx> { | |
| 811 | 819 | DepKindStruct { |
| 812 | 820 | is_anon: false, |
| 813 | 821 | is_eval_always: false, |
| ... | ... | @@ -818,7 +826,7 @@ macro_rules! define_queries { |
| 818 | 826 | } |
| 819 | 827 | } |
| 820 | 828 | |
| 821 | pub fn TraitSelect<'tcx>() -> DepKindStruct<'tcx> { | |
| 829 | pub(crate) fn TraitSelect<'tcx>() -> DepKindStruct<'tcx> { | |
| 822 | 830 | DepKindStruct { |
| 823 | 831 | is_anon: true, |
| 824 | 832 | is_eval_always: false, |
| ... | ... | @@ -829,7 +837,7 @@ macro_rules! define_queries { |
| 829 | 837 | } |
| 830 | 838 | } |
| 831 | 839 | |
| 832 | pub fn CompileCodegenUnit<'tcx>() -> DepKindStruct<'tcx> { | |
| 840 | pub(crate) fn CompileCodegenUnit<'tcx>() -> DepKindStruct<'tcx> { | |
| 833 | 841 | DepKindStruct { |
| 834 | 842 | is_anon: false, |
| 835 | 843 | is_eval_always: false, |
| ... | ... | @@ -840,7 +848,7 @@ macro_rules! define_queries { |
| 840 | 848 | } |
| 841 | 849 | } |
| 842 | 850 | |
| 843 | pub fn CompileMonoItem<'tcx>() -> DepKindStruct<'tcx> { | |
| 851 | pub(crate) fn CompileMonoItem<'tcx>() -> DepKindStruct<'tcx> { | |
| 844 | 852 | DepKindStruct { |
| 845 | 853 | is_anon: false, |
| 846 | 854 | is_eval_always: false, |
compiler/rustc_query_system/src/dep_graph/serialized.rs+3-3| ... | ... | @@ -617,14 +617,14 @@ impl<D: Deps> EncoderState<D> { |
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | pub struct GraphEncoder<D: Deps> { | |
| 620 | pub(crate) struct GraphEncoder<D: Deps> { | |
| 621 | 621 | profiler: SelfProfilerRef, |
| 622 | 622 | status: Lock<Option<EncoderState<D>>>, |
| 623 | 623 | record_graph: Option<Lock<DepGraphQuery>>, |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | impl<D: Deps> GraphEncoder<D> { |
| 627 | pub fn new( | |
| 627 | pub(crate) fn new( | |
| 628 | 628 | encoder: FileEncoder, |
| 629 | 629 | prev_node_count: usize, |
| 630 | 630 | record_graph: bool, |
| ... | ... | @@ -723,7 +723,7 @@ impl<D: Deps> GraphEncoder<D> { |
| 723 | 723 | ) |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | pub fn finish(&self) -> FileEncodeResult { | |
| 726 | pub(crate) fn finish(&self) -> FileEncodeResult { | |
| 727 | 727 | let _prof_timer = self.profiler.generic_activity("incr_comp_encode_dep_graph_finish"); |
| 728 | 728 | |
| 729 | 729 | self.status.lock().take().unwrap().finish(&self.profiler) |
compiler/rustc_query_system/src/error.rs+7-7| ... | ... | @@ -5,7 +5,7 @@ use rustc_span::{Span, Symbol}; |
| 5 | 5 | |
| 6 | 6 | #[derive(Subdiagnostic)] |
| 7 | 7 | #[note(query_system_cycle_stack_middle)] |
| 8 | pub struct CycleStack { | |
| 8 | pub(crate) struct CycleStack { | |
| 9 | 9 | #[primary_span] |
| 10 | 10 | pub span: Span, |
| 11 | 11 | pub desc: String, |
| ... | ... | @@ -20,7 +20,7 @@ pub enum HandleCycleError { |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | #[derive(Subdiagnostic)] |
| 23 | pub enum StackCount { | |
| 23 | pub(crate) enum StackCount { | |
| 24 | 24 | #[note(query_system_cycle_stack_single)] |
| 25 | 25 | Single, |
| 26 | 26 | #[note(query_system_cycle_stack_multiple)] |
| ... | ... | @@ -28,7 +28,7 @@ pub enum StackCount { |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | #[derive(Subdiagnostic)] |
| 31 | pub enum Alias { | |
| 31 | pub(crate) enum Alias { | |
| 32 | 32 | #[note(query_system_cycle_recursive_ty_alias)] |
| 33 | 33 | #[help(query_system_cycle_recursive_ty_alias_help1)] |
| 34 | 34 | #[help(query_system_cycle_recursive_ty_alias_help2)] |
| ... | ... | @@ -39,7 +39,7 @@ pub enum Alias { |
| 39 | 39 | |
| 40 | 40 | #[derive(Subdiagnostic)] |
| 41 | 41 | #[note(query_system_cycle_usage)] |
| 42 | pub struct CycleUsage { | |
| 42 | pub(crate) struct CycleUsage { | |
| 43 | 43 | #[primary_span] |
| 44 | 44 | pub span: Span, |
| 45 | 45 | pub usage: String, |
| ... | ... | @@ -47,7 +47,7 @@ pub struct CycleUsage { |
| 47 | 47 | |
| 48 | 48 | #[derive(Diagnostic)] |
| 49 | 49 | #[diag(query_system_cycle, code = E0391)] |
| 50 | pub struct Cycle { | |
| 50 | pub(crate) struct Cycle { | |
| 51 | 51 | #[primary_span] |
| 52 | 52 | pub span: Span, |
| 53 | 53 | pub stack_bottom: String, |
| ... | ... | @@ -65,14 +65,14 @@ pub struct Cycle { |
| 65 | 65 | |
| 66 | 66 | #[derive(Diagnostic)] |
| 67 | 67 | #[diag(query_system_reentrant)] |
| 68 | pub struct Reentrant; | |
| 68 | pub(crate) struct Reentrant; | |
| 69 | 69 | |
| 70 | 70 | #[derive(Diagnostic)] |
| 71 | 71 | #[diag(query_system_increment_compilation)] |
| 72 | 72 | #[help] |
| 73 | 73 | #[note(query_system_increment_compilation_note1)] |
| 74 | 74 | #[note(query_system_increment_compilation_note2)] |
| 75 | pub struct IncrementCompilation { | |
| 75 | pub(crate) struct IncrementCompilation { | |
| 76 | 76 | pub run_cmd: String, |
| 77 | 77 | pub dep_node: String, |
| 78 | 78 | } |
compiler/rustc_query_system/src/lib.rs+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | #![feature(hash_raw_entry)] |
| 6 | 6 | #![feature(let_chains)] |
| 7 | 7 | #![feature(min_specialization)] |
| 8 | #![warn(unreachable_pub)] | |
| 8 | 9 | // tidy-alphabetical-end |
| 9 | 10 | |
| 10 | 11 | pub mod cache; |
compiler/rustc_resolve/src/lib.rs+1| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | #![feature(let_chains)] |
| 22 | 22 | #![feature(rustc_attrs)] |
| 23 | 23 | #![feature(rustdoc_internals)] |
| 24 | #![warn(unreachable_pub)] | |
| 24 | 25 | // tidy-alphabetical-end |
| 25 | 26 | |
| 26 | 27 | use std::cell::{Cell, RefCell}; |
compiler/rustc_session/src/config.rs+22-2| ... | ... | @@ -22,7 +22,9 @@ use rustc_feature::UnstableFeatures; |
| 22 | 22 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; |
| 23 | 23 | use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION}; |
| 24 | 24 | use rustc_span::source_map::FilePathMapping; |
| 25 | use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm}; | |
| 25 | use rustc_span::{ | |
| 26 | sym, FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm, Symbol, | |
| 27 | }; | |
| 26 | 28 | use rustc_target::spec::{ |
| 27 | 29 | FramePointer, LinkSelfContainedComponents, LinkerFeatures, SplitDebuginfo, Target, TargetTriple, |
| 28 | 30 | }; |
| ... | ... | @@ -402,6 +404,23 @@ impl LocationDetail { |
| 402 | 404 | } |
| 403 | 405 | } |
| 404 | 406 | |
| 407 | /// Values for the `-Z fmt-debug` flag. | |
| 408 | #[derive(Copy, Clone, PartialEq, Hash, Debug)] | |
| 409 | pub enum FmtDebug { | |
| 410 | /// Derive fully-featured implementation | |
| 411 | Full, | |
| 412 | /// Print only type name, without fields | |
| 413 | Shallow, | |
| 414 | /// `#[derive(Debug)]` and `{:?}` are no-ops | |
| 415 | None, | |
| 416 | } | |
| 417 | ||
| 418 | impl FmtDebug { | |
| 419 | pub(crate) fn all() -> [Symbol; 3] { | |
| 420 | [sym::full, sym::none, sym::shallow] | |
| 421 | } | |
| 422 | } | |
| 423 | ||
| 405 | 424 | #[derive(Clone, PartialEq, Hash, Debug)] |
| 406 | 425 | pub enum SwitchWithOptPath { |
| 407 | 426 | Enabled(Option<PathBuf>), |
| ... | ... | @@ -2994,7 +3013,7 @@ pub(crate) mod dep_tracking { |
| 2994 | 3013 | |
| 2995 | 3014 | use super::{ |
| 2996 | 3015 | BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions, |
| 2997 | CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FunctionReturn, | |
| 3016 | CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn, | |
| 2998 | 3017 | InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail, |
| 2999 | 3018 | LtoCli, NextSolverConfig, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes, |
| 3000 | 3019 | PatchableFunctionEntry, Polonius, RemapPathScopeComponents, ResolveDocLinks, |
| ... | ... | @@ -3088,6 +3107,7 @@ pub(crate) mod dep_tracking { |
| 3088 | 3107 | OutputType, |
| 3089 | 3108 | RealFileName, |
| 3090 | 3109 | LocationDetail, |
| 3110 | FmtDebug, | |
| 3091 | 3111 | BranchProtection, |
| 3092 | 3112 | OomStrategy, |
| 3093 | 3113 | LanguageIdentifier, |
compiler/rustc_session/src/config/cfg.rs+18-1| ... | ... | @@ -31,7 +31,7 @@ use rustc_span::symbol::{sym, Symbol}; |
| 31 | 31 | use rustc_target::abi::Align; |
| 32 | 32 | use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, Target, TargetTriple, TARGETS}; |
| 33 | 33 | |
| 34 | use crate::config::CrateType; | |
| 34 | use crate::config::{CrateType, FmtDebug}; | |
| 35 | 35 | use crate::Session; |
| 36 | 36 | |
| 37 | 37 | /// The parsed `--cfg` options that define the compilation environment of the |
| ... | ... | @@ -142,6 +142,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) { |
| 142 | 142 | | (sym::target_has_atomic_equal_alignment, Some(_)) |
| 143 | 143 | | (sym::target_has_atomic_load_store, Some(_)) |
| 144 | 144 | | (sym::target_thread_local, None) => disallow(cfg, "--target"), |
| 145 | (sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"), | |
| 145 | 146 | _ => {} |
| 146 | 147 | } |
| 147 | 148 | } |
| ... | ... | @@ -179,6 +180,20 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg { |
| 179 | 180 | ins_none!(sym::debug_assertions); |
| 180 | 181 | } |
| 181 | 182 | |
| 183 | if sess.is_nightly_build() { | |
| 184 | match sess.opts.unstable_opts.fmt_debug { | |
| 185 | FmtDebug::Full => { | |
| 186 | ins_sym!(sym::fmt_debug, sym::full); | |
| 187 | } | |
| 188 | FmtDebug::Shallow => { | |
| 189 | ins_sym!(sym::fmt_debug, sym::shallow); | |
| 190 | } | |
| 191 | FmtDebug::None => { | |
| 192 | ins_sym!(sym::fmt_debug, sym::none); | |
| 193 | } | |
| 194 | } | |
| 195 | } | |
| 196 | ||
| 182 | 197 | if sess.overflow_checks() { |
| 183 | 198 | ins_none!(sym::overflow_checks); |
| 184 | 199 | } |
| ... | ... | @@ -326,6 +341,8 @@ impl CheckCfg { |
| 326 | 341 | |
| 327 | 342 | ins!(sym::debug_assertions, no_values); |
| 328 | 343 | |
| 344 | ins!(sym::fmt_debug, empty_values).extend(FmtDebug::all()); | |
| 345 | ||
| 329 | 346 | // These four are never set by rustc, but we set them anyway; they |
| 330 | 347 | // should not trigger the lint because `cargo clippy`, `cargo doc`, |
| 331 | 348 | // `cargo test`, `cargo miri run` and `cargo fmt` (respectively) |
compiler/rustc_session/src/options.rs+16| ... | ... | @@ -408,6 +408,7 @@ mod desc { |
| 408 | 408 | pub const parse_linker_plugin_lto: &str = |
| 409 | 409 | "either a boolean (`yes`, `no`, `on`, `off`, etc), or the path to the linker plugin"; |
| 410 | 410 | pub const parse_location_detail: &str = "either `none`, or a comma separated list of location details to track: `file`, `line`, or `column`"; |
| 411 | pub const parse_fmt_debug: &str = "either `full`, `shallow`, or `none`"; | |
| 411 | 412 | pub const parse_switch_with_opt_path: &str = |
| 412 | 413 | "an optional path to the profiling data output directory"; |
| 413 | 414 | pub const parse_merge_functions: &str = "one of: `disabled`, `trampolines`, or `aliases`"; |
| ... | ... | @@ -589,6 +590,16 @@ mod parse { |
| 589 | 590 | } |
| 590 | 591 | } |
| 591 | 592 | |
| 593 | pub(crate) fn parse_fmt_debug(opt: &mut FmtDebug, v: Option<&str>) -> bool { | |
| 594 | *opt = match v { | |
| 595 | Some("full") => FmtDebug::Full, | |
| 596 | Some("shallow") => FmtDebug::Shallow, | |
| 597 | Some("none") => FmtDebug::None, | |
| 598 | _ => return false, | |
| 599 | }; | |
| 600 | true | |
| 601 | } | |
| 602 | ||
| 592 | 603 | pub(crate) fn parse_location_detail(ld: &mut LocationDetail, v: Option<&str>) -> bool { |
| 593 | 604 | if let Some(v) = v { |
| 594 | 605 | ld.line = false; |
| ... | ... | @@ -1724,6 +1735,9 @@ options! { |
| 1724 | 1735 | flatten_format_args: bool = (true, parse_bool, [TRACKED], |
| 1725 | 1736 | "flatten nested format_args!() and literals into a simplified format_args!() call \ |
| 1726 | 1737 | (default: yes)"), |
| 1738 | fmt_debug: FmtDebug = (FmtDebug::Full, parse_fmt_debug, [TRACKED], | |
| 1739 | "how detailed `#[derive(Debug)]` should be. `full` prints types recursively, \ | |
| 1740 | `shallow` prints only type names, `none` prints nothing and disables `{:?}`. (default: `full`)"), | |
| 1727 | 1741 | force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED], |
| 1728 | 1742 | "force all crates to be `rustc_private` unstable (default: no)"), |
| 1729 | 1743 | fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED], |
| ... | ... | @@ -1797,6 +1811,8 @@ options! { |
| 1797 | 1811 | "link the `.rlink` file generated by `-Z no-link` (default: no)"), |
| 1798 | 1812 | linker_features: LinkerFeaturesCli = (LinkerFeaturesCli::default(), parse_linker_features, [UNTRACKED], |
| 1799 | 1813 | "a comma-separated list of linker features to enable (+) or disable (-): `lld`"), |
| 1814 | lint_llvm_ir: bool = (false, parse_bool, [TRACKED], | |
| 1815 | "lint LLVM IR (default: no)"), | |
| 1800 | 1816 | lint_mir: bool = (false, parse_bool, [UNTRACKED], |
| 1801 | 1817 | "lint MIR before and after each transformation"), |
| 1802 | 1818 | llvm_module_flag: Vec<(String, u32, String)> = (Vec::new(), parse_llvm_module_flag, [TRACKED], |
compiler/rustc_span/src/symbol.rs+5| ... | ... | @@ -536,6 +536,7 @@ symbols! { |
| 536 | 536 | cfg_attr_multi, |
| 537 | 537 | cfg_doctest, |
| 538 | 538 | cfg_eval, |
| 539 | cfg_fmt_debug, | |
| 539 | 540 | cfg_hide, |
| 540 | 541 | cfg_overflow_checks, |
| 541 | 542 | cfg_panic, |
| ... | ... | @@ -895,6 +896,7 @@ symbols! { |
| 895 | 896 | fmaf32, |
| 896 | 897 | fmaf64, |
| 897 | 898 | fmt, |
| 899 | fmt_debug, | |
| 898 | 900 | fmul_algebraic, |
| 899 | 901 | fmul_fast, |
| 900 | 902 | fn_align, |
| ... | ... | @@ -938,6 +940,7 @@ symbols! { |
| 938 | 940 | fs_create_dir, |
| 939 | 941 | fsub_algebraic, |
| 940 | 942 | fsub_fast, |
| 943 | full, | |
| 941 | 944 | fundamental, |
| 942 | 945 | fused_iterator, |
| 943 | 946 | future, |
| ... | ... | @@ -1281,6 +1284,7 @@ symbols! { |
| 1281 | 1284 | new_binary, |
| 1282 | 1285 | new_const, |
| 1283 | 1286 | new_debug, |
| 1287 | new_debug_noop, | |
| 1284 | 1288 | new_display, |
| 1285 | 1289 | new_lower_exp, |
| 1286 | 1290 | new_lower_hex, |
| ... | ... | @@ -1715,6 +1719,7 @@ symbols! { |
| 1715 | 1719 | semitransparent, |
| 1716 | 1720 | sha512_sm_x86, |
| 1717 | 1721 | shadow_call_stack, |
| 1722 | shallow, | |
| 1718 | 1723 | shl, |
| 1719 | 1724 | shl_assign, |
| 1720 | 1725 | shorter_tail_lifetimes, |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs+1-1| ... | ... | @@ -28,7 +28,7 @@ pub fn target() -> Target { |
| 28 | 28 | code_model: Some(CodeModel::Medium), |
| 29 | 29 | emit_debug_gdb_scripts: false, |
| 30 | 30 | eh_frame_header: false, |
| 31 | supported_sanitizers: SanitizerSet::KERNELADDRESS, | |
| 31 | supported_sanitizers: SanitizerSet::KERNELADDRESS | SanitizerSet::SHADOWCALLSTACK, | |
| 32 | 32 | ..Default::default() |
| 33 | 33 | }, |
| 34 | 34 | } |
compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs+1-1| ... | ... | @@ -27,7 +27,7 @@ pub fn target() -> Target { |
| 27 | 27 | code_model: Some(CodeModel::Medium), |
| 28 | 28 | emit_debug_gdb_scripts: false, |
| 29 | 29 | eh_frame_header: false, |
| 30 | supported_sanitizers: SanitizerSet::KERNELADDRESS, | |
| 30 | supported_sanitizers: SanitizerSet::KERNELADDRESS | SanitizerSet::SHADOWCALLSTACK, | |
| 31 | 31 | ..Default::default() |
| 32 | 32 | }, |
| 33 | 33 | } |
library/core/benches/lib.rs+1| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | #![feature(iter_array_chunks)] |
| 9 | 9 | #![feature(iter_next_chunk)] |
| 10 | 10 | #![feature(iter_advance_by)] |
| 11 | #![feature(isqrt)] | |
| 11 | 12 | |
| 12 | 13 | extern crate test; |
| 13 | 14 |
library/core/benches/num/int_sqrt/mod.rs created+62| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | use rand::Rng; | |
| 2 | use test::{black_box, Bencher}; | |
| 3 | ||
| 4 | macro_rules! int_sqrt_bench { | |
| 5 | ($t:ty, $predictable:ident, $random:ident, $random_small:ident, $random_uniform:ident) => { | |
| 6 | #[bench] | |
| 7 | fn $predictable(bench: &mut Bencher) { | |
| 8 | bench.iter(|| { | |
| 9 | for n in 0..(<$t>::BITS / 8) { | |
| 10 | for i in 1..=(100 as $t) { | |
| 11 | let x = black_box(i << (n * 8)); | |
| 12 | black_box(x.isqrt()); | |
| 13 | } | |
| 14 | } | |
| 15 | }); | |
| 16 | } | |
| 17 | ||
| 18 | #[bench] | |
| 19 | fn $random(bench: &mut Bencher) { | |
| 20 | let mut rng = crate::bench_rng(); | |
| 21 | /* Exponentially distributed random numbers from the whole range of the type. */ | |
| 22 | let numbers: Vec<$t> = | |
| 23 | (0..256).map(|_| rng.gen::<$t>() >> rng.gen_range(0..<$t>::BITS)).collect(); | |
| 24 | bench.iter(|| { | |
| 25 | for x in &numbers { | |
| 26 | black_box(black_box(x).isqrt()); | |
| 27 | } | |
| 28 | }); | |
| 29 | } | |
| 30 | ||
| 31 | #[bench] | |
| 32 | fn $random_small(bench: &mut Bencher) { | |
| 33 | let mut rng = crate::bench_rng(); | |
| 34 | /* Exponentially distributed random numbers from the range 0..256. */ | |
| 35 | let numbers: Vec<$t> = | |
| 36 | (0..256).map(|_| (rng.gen::<u8>() >> rng.gen_range(0..u8::BITS)) as $t).collect(); | |
| 37 | bench.iter(|| { | |
| 38 | for x in &numbers { | |
| 39 | black_box(black_box(x).isqrt()); | |
| 40 | } | |
| 41 | }); | |
| 42 | } | |
| 43 | ||
| 44 | #[bench] | |
| 45 | fn $random_uniform(bench: &mut Bencher) { | |
| 46 | let mut rng = crate::bench_rng(); | |
| 47 | /* Exponentially distributed random numbers from the whole range of the type. */ | |
| 48 | let numbers: Vec<$t> = (0..256).map(|_| rng.gen::<$t>()).collect(); | |
| 49 | bench.iter(|| { | |
| 50 | for x in &numbers { | |
| 51 | black_box(black_box(x).isqrt()); | |
| 52 | } | |
| 53 | }); | |
| 54 | } | |
| 55 | }; | |
| 56 | } | |
| 57 | ||
| 58 | int_sqrt_bench! {u8, u8_sqrt_predictable, u8_sqrt_random, u8_sqrt_random_small, u8_sqrt_uniform} | |
| 59 | int_sqrt_bench! {u16, u16_sqrt_predictable, u16_sqrt_random, u16_sqrt_random_small, u16_sqrt_uniform} | |
| 60 | int_sqrt_bench! {u32, u32_sqrt_predictable, u32_sqrt_random, u32_sqrt_random_small, u32_sqrt_uniform} | |
| 61 | int_sqrt_bench! {u64, u64_sqrt_predictable, u64_sqrt_random, u64_sqrt_random_small, u64_sqrt_uniform} | |
| 62 | int_sqrt_bench! {u128, u128_sqrt_predictable, u128_sqrt_random, u128_sqrt_random_small, u128_sqrt_uniform} |
library/core/benches/num/mod.rs+1| ... | ... | @@ -2,6 +2,7 @@ mod dec2flt; |
| 2 | 2 | mod flt2dec; |
| 3 | 3 | mod int_log; |
| 4 | 4 | mod int_pow; |
| 5 | mod int_sqrt; | |
| 5 | 6 | |
| 6 | 7 | use std::str::FromStr; |
| 7 | 8 |
library/core/src/fmt/rt.rs+4| ... | ... | @@ -118,6 +118,10 @@ impl<'a> Argument<'a> { |
| 118 | 118 | Self::new(x, Debug::fmt) |
| 119 | 119 | } |
| 120 | 120 | #[inline(always)] |
| 121 | pub fn new_debug_noop<'b, T: Debug>(x: &'b T) -> Argument<'_> { | |
| 122 | Self::new(x, |_, _| Ok(())) | |
| 123 | } | |
| 124 | #[inline(always)] | |
| 121 | 125 | pub fn new_octal<'b, T: Octal>(x: &'b T) -> Argument<'_> { |
| 122 | 126 | Self::new(x, Octal::fmt) |
| 123 | 127 | } |
library/core/src/num/int_macros.rs+29-7| ... | ... | @@ -1641,7 +1641,33 @@ macro_rules! int_impl { |
| 1641 | 1641 | if self < 0 { |
| 1642 | 1642 | None |
| 1643 | 1643 | } else { |
| 1644 | Some((self as $UnsignedT).isqrt() as Self) | |
| 1644 | // SAFETY: Input is nonnegative in this `else` branch. | |
| 1645 | let result = unsafe { | |
| 1646 | crate::num::int_sqrt::$ActualT(self as $ActualT) as $SelfT | |
| 1647 | }; | |
| 1648 | ||
| 1649 | // Inform the optimizer what the range of outputs is. If | |
| 1650 | // testing `core` crashes with no panic message and a | |
| 1651 | // `num::int_sqrt::i*` test failed, it's because your edits | |
| 1652 | // caused these assertions to become false. | |
| 1653 | // | |
| 1654 | // SAFETY: Integer square root is a monotonically nondecreasing | |
| 1655 | // function, which means that increasing the input will never | |
| 1656 | // cause the output to decrease. Thus, since the input for | |
| 1657 | // nonnegative signed integers is bounded by | |
| 1658 | // `[0, <$ActualT>::MAX]`, sqrt(n) will be bounded by | |
| 1659 | // `[sqrt(0), sqrt(<$ActualT>::MAX)]`. | |
| 1660 | unsafe { | |
| 1661 | // SAFETY: `<$ActualT>::MAX` is nonnegative. | |
| 1662 | const MAX_RESULT: $SelfT = unsafe { | |
| 1663 | crate::num::int_sqrt::$ActualT(<$ActualT>::MAX) as $SelfT | |
| 1664 | }; | |
| 1665 | ||
| 1666 | crate::hint::assert_unchecked(result >= 0); | |
| 1667 | crate::hint::assert_unchecked(result <= MAX_RESULT); | |
| 1668 | } | |
| 1669 | ||
| 1670 | Some(result) | |
| 1645 | 1671 | } |
| 1646 | 1672 | } |
| 1647 | 1673 | |
| ... | ... | @@ -2862,15 +2888,11 @@ macro_rules! int_impl { |
| 2862 | 2888 | #[must_use = "this returns the result of the operation, \ |
| 2863 | 2889 | without modifying the original"] |
| 2864 | 2890 | #[inline] |
| 2891 | #[track_caller] | |
| 2865 | 2892 | pub const fn isqrt(self) -> Self { |
| 2866 | // I would like to implement it as | |
| 2867 | // ``` | |
| 2868 | // self.checked_isqrt().expect("argument of integer square root must be non-negative") | |
| 2869 | // ``` | |
| 2870 | // but `expect` is not yet stable as a `const fn`. | |
| 2871 | 2893 | match self.checked_isqrt() { |
| 2872 | 2894 | Some(sqrt) => sqrt, |
| 2873 | None => panic!("argument of integer square root must be non-negative"), | |
| 2895 | None => crate::num::int_sqrt::panic_for_negative_argument(), | |
| 2874 | 2896 | } |
| 2875 | 2897 | } |
| 2876 | 2898 |
library/core/src/num/int_sqrt.rs created+316| ... | ... | @@ -0,0 +1,316 @@ |
| 1 | //! These functions use the [Karatsuba square root algorithm][1] to compute the | |
| 2 | //! [integer square root](https://en.wikipedia.org/wiki/Integer_square_root) | |
| 3 | //! for the primitive integer types. | |
| 4 | //! | |
| 5 | //! The signed integer functions can only handle **nonnegative** inputs, so | |
| 6 | //! that must be checked before calling those. | |
| 7 | //! | |
| 8 | //! [1]: <https://web.archive.org/web/20230511212802/https://inria.hal.science/inria-00072854v1/file/RR-3805.pdf> | |
| 9 | //! "Paul Zimmermann. Karatsuba Square Root. \[Research Report\] RR-3805, | |
| 10 | //! INRIA. 1999, pp.8. (inria-00072854)" | |
| 11 | ||
| 12 | /// This array stores the [integer square roots]( | |
| 13 | /// https://en.wikipedia.org/wiki/Integer_square_root) and remainders of each | |
| 14 | /// [`u8`](prim@u8) value. For example, `U8_ISQRT_WITH_REMAINDER[17]` will be | |
| 15 | /// `(4, 1)` because the integer square root of 17 is 4 and because 17 is 1 | |
| 16 | /// higher than 4 squared. | |
| 17 | const U8_ISQRT_WITH_REMAINDER: [(u8, u8); 256] = { | |
| 18 | let mut result = [(0, 0); 256]; | |
| 19 | ||
| 20 | let mut n: usize = 0; | |
| 21 | let mut isqrt_n: usize = 0; | |
| 22 | while n < result.len() { | |
| 23 | result[n] = (isqrt_n as u8, (n - isqrt_n.pow(2)) as u8); | |
| 24 | ||
| 25 | n += 1; | |
| 26 | if n == (isqrt_n + 1).pow(2) { | |
| 27 | isqrt_n += 1; | |
| 28 | } | |
| 29 | } | |
| 30 | ||
| 31 | result | |
| 32 | }; | |
| 33 | ||
| 34 | /// Returns the [integer square root]( | |
| 35 | /// https://en.wikipedia.org/wiki/Integer_square_root) of any [`u8`](prim@u8) | |
| 36 | /// input. | |
| 37 | #[must_use = "this returns the result of the operation, \ | |
| 38 | without modifying the original"] | |
| 39 | #[inline] | |
| 40 | pub const fn u8(n: u8) -> u8 { | |
| 41 | U8_ISQRT_WITH_REMAINDER[n as usize].0 | |
| 42 | } | |
| 43 | ||
| 44 | /// Generates an `i*` function that returns the [integer square root]( | |
| 45 | /// https://en.wikipedia.org/wiki/Integer_square_root) of any **nonnegative** | |
| 46 | /// input of a specific signed integer type. | |
| 47 | macro_rules! signed_fn { | |
| 48 | ($SignedT:ident, $UnsignedT:ident) => { | |
| 49 | /// Returns the [integer square root]( | |
| 50 | /// https://en.wikipedia.org/wiki/Integer_square_root) of any | |
| 51 | /// **nonnegative** | |
| 52 | #[doc = concat!("[`", stringify!($SignedT), "`](prim@", stringify!($SignedT), ")")] | |
| 53 | /// input. | |
| 54 | /// | |
| 55 | /// # Safety | |
| 56 | /// | |
| 57 | /// This results in undefined behavior when the input is negative. | |
| 58 | #[must_use = "this returns the result of the operation, \ | |
| 59 | without modifying the original"] | |
| 60 | #[inline] | |
| 61 | pub const unsafe fn $SignedT(n: $SignedT) -> $SignedT { | |
| 62 | debug_assert!(n >= 0, "Negative input inside `isqrt`."); | |
| 63 | $UnsignedT(n as $UnsignedT) as $SignedT | |
| 64 | } | |
| 65 | }; | |
| 66 | } | |
| 67 | ||
| 68 | signed_fn!(i8, u8); | |
| 69 | signed_fn!(i16, u16); | |
| 70 | signed_fn!(i32, u32); | |
| 71 | signed_fn!(i64, u64); | |
| 72 | signed_fn!(i128, u128); | |
| 73 | ||
| 74 | /// Generates a `u*` function that returns the [integer square root]( | |
| 75 | /// https://en.wikipedia.org/wiki/Integer_square_root) of any input of | |
| 76 | /// a specific unsigned integer type. | |
| 77 | macro_rules! unsigned_fn { | |
| 78 | ($UnsignedT:ident, $HalfBitsT:ident, $stages:ident) => { | |
| 79 | /// Returns the [integer square root]( | |
| 80 | /// https://en.wikipedia.org/wiki/Integer_square_root) of any | |
| 81 | #[doc = concat!("[`", stringify!($UnsignedT), "`](prim@", stringify!($UnsignedT), ")")] | |
| 82 | /// input. | |
| 83 | #[must_use = "this returns the result of the operation, \ | |
| 84 | without modifying the original"] | |
| 85 | #[inline] | |
| 86 | pub const fn $UnsignedT(mut n: $UnsignedT) -> $UnsignedT { | |
| 87 | if n <= <$HalfBitsT>::MAX as $UnsignedT { | |
| 88 | $HalfBitsT(n as $HalfBitsT) as $UnsignedT | |
| 89 | } else { | |
| 90 | // The normalization shift satisfies the Karatsuba square root | |
| 91 | // algorithm precondition "a₃ ≥ b/4" where a₃ is the most | |
| 92 | // significant quarter of `n`'s bits and b is the number of | |
| 93 | // values that can be represented by that quarter of the bits. | |
| 94 | // | |
| 95 | // b/4 would then be all 0s except the second most significant | |
| 96 | // bit (010...0) in binary. Since a₃ must be at least b/4, a₃'s | |
| 97 | // most significant bit or its neighbor must be a 1. Since a₃'s | |
| 98 | // most significant bits are `n`'s most significant bits, the | |
| 99 | // same applies to `n`. | |
| 100 | // | |
| 101 | // The reason to shift by an even number of bits is because an | |
| 102 | // even number of bits produces the square root shifted to the | |
| 103 | // left by half of the normalization shift: | |
| 104 | // | |
| 105 | // sqrt(n << (2 * p)) | |
| 106 | // sqrt(2.pow(2 * p) * n) | |
| 107 | // sqrt(2.pow(2 * p)) * sqrt(n) | |
| 108 | // 2.pow(p) * sqrt(n) | |
| 109 | // sqrt(n) << p | |
| 110 | // | |
| 111 | // Shifting by an odd number of bits leaves an ugly sqrt(2) | |
| 112 | // multiplied in: | |
| 113 | // | |
| 114 | // sqrt(n << (2 * p + 1)) | |
| 115 | // sqrt(2.pow(2 * p + 1) * n) | |
| 116 | // sqrt(2 * 2.pow(2 * p) * n) | |
| 117 | // sqrt(2) * sqrt(2.pow(2 * p)) * sqrt(n) | |
| 118 | // sqrt(2) * 2.pow(p) * sqrt(n) | |
| 119 | // sqrt(2) * (sqrt(n) << p) | |
| 120 | const EVEN_MAKING_BITMASK: u32 = !1; | |
| 121 | let normalization_shift = n.leading_zeros() & EVEN_MAKING_BITMASK; | |
| 122 | n <<= normalization_shift; | |
| 123 | ||
| 124 | let s = $stages(n); | |
| 125 | ||
| 126 | let denormalization_shift = normalization_shift >> 1; | |
| 127 | s >> denormalization_shift | |
| 128 | } | |
| 129 | } | |
| 130 | }; | |
| 131 | } | |
| 132 | ||
| 133 | /// Generates the first stage of the computation after normalization. | |
| 134 | /// | |
| 135 | /// # Safety | |
| 136 | /// | |
| 137 | /// `$n` must be nonzero. | |
| 138 | macro_rules! first_stage { | |
| 139 | ($original_bits:literal, $n:ident) => {{ | |
| 140 | debug_assert!($n != 0, "`$n` is zero in `first_stage!`."); | |
| 141 | ||
| 142 | const N_SHIFT: u32 = $original_bits - 8; | |
| 143 | let n = $n >> N_SHIFT; | |
| 144 | ||
| 145 | let (s, r) = U8_ISQRT_WITH_REMAINDER[n as usize]; | |
| 146 | ||
| 147 | // Inform the optimizer that `s` is nonzero. This will allow it to | |
| 148 | // avoid generating code to handle division-by-zero panics in the next | |
| 149 | // stage. | |
| 150 | // | |
| 151 | // SAFETY: If the original `$n` is zero, the top of the `unsigned_fn` | |
| 152 | // macro recurses instead of continuing to this point, so the original | |
| 153 | // `$n` wasn't a 0 if we've reached here. | |
| 154 | // | |
| 155 | // Then the `unsigned_fn` macro normalizes `$n` so that at least one of | |
| 156 | // its two most-significant bits is a 1. | |
| 157 | // | |
| 158 | // Then this stage puts the eight most-significant bits of `$n` into | |
| 159 | // `n`. This means that `n` here has at least one 1 bit in its two | |
| 160 | // most-significant bits, making `n` nonzero. | |
| 161 | // | |
| 162 | // `U8_ISQRT_WITH_REMAINDER[n as usize]` will give a nonzero `s` when | |
| 163 | // given a nonzero `n`. | |
| 164 | unsafe { crate::hint::assert_unchecked(s != 0) }; | |
| 165 | (s, r) | |
| 166 | }}; | |
| 167 | } | |
| 168 | ||
| 169 | /// Generates a middle stage of the computation. | |
| 170 | /// | |
| 171 | /// # Safety | |
| 172 | /// | |
| 173 | /// `$s` must be nonzero. | |
| 174 | macro_rules! middle_stage { | |
| 175 | ($original_bits:literal, $ty:ty, $n:ident, $s:ident, $r:ident) => {{ | |
| 176 | debug_assert!($s != 0, "`$s` is zero in `middle_stage!`."); | |
| 177 | ||
| 178 | const N_SHIFT: u32 = $original_bits - <$ty>::BITS; | |
| 179 | let n = ($n >> N_SHIFT) as $ty; | |
| 180 | ||
| 181 | const HALF_BITS: u32 = <$ty>::BITS >> 1; | |
| 182 | const QUARTER_BITS: u32 = <$ty>::BITS >> 2; | |
| 183 | const LOWER_HALF_1_BITS: $ty = (1 << HALF_BITS) - 1; | |
| 184 | const LOWEST_QUARTER_1_BITS: $ty = (1 << QUARTER_BITS) - 1; | |
| 185 | ||
| 186 | let lo = n & LOWER_HALF_1_BITS; | |
| 187 | let numerator = (($r as $ty) << QUARTER_BITS) | (lo >> QUARTER_BITS); | |
| 188 | let denominator = ($s as $ty) << 1; | |
| 189 | let q = numerator / denominator; | |
| 190 | let u = numerator % denominator; | |
| 191 | ||
| 192 | let mut s = ($s << QUARTER_BITS) as $ty + q; | |
| 193 | let (mut r, overflow) = | |
| 194 | ((u << QUARTER_BITS) | (lo & LOWEST_QUARTER_1_BITS)).overflowing_sub(q * q); | |
| 195 | if overflow { | |
| 196 | r = r.wrapping_add(2 * s - 1); | |
| 197 | s -= 1; | |
| 198 | } | |
| 199 | ||
| 200 | // Inform the optimizer that `s` is nonzero. This will allow it to | |
| 201 | // avoid generating code to handle division-by-zero panics in the next | |
| 202 | // stage. | |
| 203 | // | |
| 204 | // SAFETY: If the original `$n` is zero, the top of the `unsigned_fn` | |
| 205 | // macro recurses instead of continuing to this point, so the original | |
| 206 | // `$n` wasn't a 0 if we've reached here. | |
| 207 | // | |
| 208 | // Then the `unsigned_fn` macro normalizes `$n` so that at least one of | |
| 209 | // its two most-significant bits is a 1. | |
| 210 | // | |
| 211 | // Then these stages take as many of the most-significant bits of `$n` | |
| 212 | // as will fit in this stage's type. For example, the stage that | |
| 213 | // handles `u32` deals with the 32 most-significant bits of `$n`. This | |
| 214 | // means that each stage has at least one 1 bit in `n`'s two | |
| 215 | // most-significant bits, making `n` nonzero. | |
| 216 | // | |
| 217 | // Then this stage will produce the correct integer square root for | |
| 218 | // that `n` value. Since `n` is nonzero, `s` will also be nonzero. | |
| 219 | unsafe { crate::hint::assert_unchecked(s != 0) }; | |
| 220 | (s, r) | |
| 221 | }}; | |
| 222 | } | |
| 223 | ||
| 224 | /// Generates the last stage of the computation before denormalization. | |
| 225 | /// | |
| 226 | /// # Safety | |
| 227 | /// | |
| 228 | /// `$s` must be nonzero. | |
| 229 | macro_rules! last_stage { | |
| 230 | ($ty:ty, $n:ident, $s:ident, $r:ident) => {{ | |
| 231 | debug_assert!($s != 0, "`$s` is zero in `last_stage!`."); | |
| 232 | ||
| 233 | const HALF_BITS: u32 = <$ty>::BITS >> 1; | |
| 234 | const QUARTER_BITS: u32 = <$ty>::BITS >> 2; | |
| 235 | const LOWER_HALF_1_BITS: $ty = (1 << HALF_BITS) - 1; | |
| 236 | ||
| 237 | let lo = $n & LOWER_HALF_1_BITS; | |
| 238 | let numerator = (($r as $ty) << QUARTER_BITS) | (lo >> QUARTER_BITS); | |
| 239 | let denominator = ($s as $ty) << 1; | |
| 240 | ||
| 241 | let q = numerator / denominator; | |
| 242 | let mut s = ($s << QUARTER_BITS) as $ty + q; | |
| 243 | let (s_squared, overflow) = s.overflowing_mul(s); | |
| 244 | if overflow || s_squared > $n { | |
| 245 | s -= 1; | |
| 246 | } | |
| 247 | s | |
| 248 | }}; | |
| 249 | } | |
| 250 | ||
| 251 | /// Takes the normalized [`u16`](prim@u16) input and gets its normalized | |
| 252 | /// [integer square root](https://en.wikipedia.org/wiki/Integer_square_root). | |
| 253 | /// | |
| 254 | /// # Safety | |
| 255 | /// | |
| 256 | /// `n` must be nonzero. | |
| 257 | #[inline] | |
| 258 | const fn u16_stages(n: u16) -> u16 { | |
| 259 | let (s, r) = first_stage!(16, n); | |
| 260 | last_stage!(u16, n, s, r) | |
| 261 | } | |
| 262 | ||
| 263 | /// Takes the normalized [`u32`](prim@u32) input and gets its normalized | |
| 264 | /// [integer square root](https://en.wikipedia.org/wiki/Integer_square_root). | |
| 265 | /// | |
| 266 | /// # Safety | |
| 267 | /// | |
| 268 | /// `n` must be nonzero. | |
| 269 | #[inline] | |
| 270 | const fn u32_stages(n: u32) -> u32 { | |
| 271 | let (s, r) = first_stage!(32, n); | |
| 272 | let (s, r) = middle_stage!(32, u16, n, s, r); | |
| 273 | last_stage!(u32, n, s, r) | |
| 274 | } | |
| 275 | ||
| 276 | /// Takes the normalized [`u64`](prim@u64) input and gets its normalized | |
| 277 | /// [integer square root](https://en.wikipedia.org/wiki/Integer_square_root). | |
| 278 | /// | |
| 279 | /// # Safety | |
| 280 | /// | |
| 281 | /// `n` must be nonzero. | |
| 282 | #[inline] | |
| 283 | const fn u64_stages(n: u64) -> u64 { | |
| 284 | let (s, r) = first_stage!(64, n); | |
| 285 | let (s, r) = middle_stage!(64, u16, n, s, r); | |
| 286 | let (s, r) = middle_stage!(64, u32, n, s, r); | |
| 287 | last_stage!(u64, n, s, r) | |
| 288 | } | |
| 289 | ||
| 290 | /// Takes the normalized [`u128`](prim@u128) input and gets its normalized | |
| 291 | /// [integer square root](https://en.wikipedia.org/wiki/Integer_square_root). | |
| 292 | /// | |
| 293 | /// # Safety | |
| 294 | /// | |
| 295 | /// `n` must be nonzero. | |
| 296 | #[inline] | |
| 297 | const fn u128_stages(n: u128) -> u128 { | |
| 298 | let (s, r) = first_stage!(128, n); | |
| 299 | let (s, r) = middle_stage!(128, u16, n, s, r); | |
| 300 | let (s, r) = middle_stage!(128, u32, n, s, r); | |
| 301 | let (s, r) = middle_stage!(128, u64, n, s, r); | |
| 302 | last_stage!(u128, n, s, r) | |
| 303 | } | |
| 304 | ||
| 305 | unsigned_fn!(u16, u8, u16_stages); | |
| 306 | unsigned_fn!(u32, u16, u32_stages); | |
| 307 | unsigned_fn!(u64, u32, u64_stages); | |
| 308 | unsigned_fn!(u128, u64, u128_stages); | |
| 309 | ||
| 310 | /// Instantiate this panic logic once, rather than for all the isqrt methods | |
| 311 | /// on every single primitive type. | |
| 312 | #[cold] | |
| 313 | #[track_caller] | |
| 314 | pub const fn panic_for_negative_argument() -> ! { | |
| 315 | panic!("argument of integer square root cannot be negative") | |
| 316 | } |
library/core/src/num/mod.rs+1| ... | ... | @@ -41,6 +41,7 @@ mod uint_macros; // import uint_impl! |
| 41 | 41 | |
| 42 | 42 | mod error; |
| 43 | 43 | mod int_log10; |
| 44 | mod int_sqrt; | |
| 44 | 45 | mod nonzero; |
| 45 | 46 | mod overflow_panic; |
| 46 | 47 | mod saturating; |
library/core/src/num/nonzero.rs+8-25| ... | ... | @@ -7,7 +7,7 @@ use crate::marker::{Freeze, StructuralPartialEq}; |
| 7 | 7 | use crate::ops::{BitOr, BitOrAssign, Div, DivAssign, Neg, Rem, RemAssign}; |
| 8 | 8 | use crate::panic::{RefUnwindSafe, UnwindSafe}; |
| 9 | 9 | use crate::str::FromStr; |
| 10 | use crate::{fmt, hint, intrinsics, ptr, ub_checks}; | |
| 10 | use crate::{fmt, intrinsics, ptr, ub_checks}; | |
| 11 | 11 | |
| 12 | 12 | /// A marker trait for primitive types which can be zero. |
| 13 | 13 | /// |
| ... | ... | @@ -1545,31 +1545,14 @@ macro_rules! nonzero_integer_signedness_dependent_methods { |
| 1545 | 1545 | without modifying the original"] |
| 1546 | 1546 | #[inline] |
| 1547 | 1547 | pub const fn isqrt(self) -> Self { |
| 1548 | // The algorithm is based on the one presented in | |
| 1549 | // <https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_(base_2)> | |
| 1550 | // which cites as source the following C code: | |
| 1551 | // <https://web.archive.org/web/20120306040058/http://medialab.freaknet.org/martin/src/sqrt/sqrt.c>. | |
| 1552 | ||
| 1553 | let mut op = self.get(); | |
| 1554 | let mut res = 0; | |
| 1555 | let mut one = 1 << (self.ilog2() & !1); | |
| 1556 | ||
| 1557 | while one != 0 { | |
| 1558 | if op >= res + one { | |
| 1559 | op -= res + one; | |
| 1560 | res = (res >> 1) + one; | |
| 1561 | } else { | |
| 1562 | res >>= 1; | |
| 1563 | } | |
| 1564 | one >>= 2; | |
| 1565 | } | |
| 1548 | let result = self.get().isqrt(); | |
| 1566 | 1549 | |
| 1567 | // SAFETY: The result fits in an integer with half as many bits. | |
| 1568 | // Inform the optimizer about it. | |
| 1569 | unsafe { hint::assert_unchecked(res < 1 << (Self::BITS / 2)) }; | |
| 1570 | ||
| 1571 | // SAFETY: The square root of an integer >= 1 is always >= 1. | |
| 1572 | unsafe { Self::new_unchecked(res) } | |
| 1550 | // SAFETY: Integer square root is a monotonically nondecreasing | |
| 1551 | // function, which means that increasing the input will never cause | |
| 1552 | // the output to decrease. Thus, since the input for nonzero | |
| 1553 | // unsigned integers has a lower bound of 1, the lower bound of the | |
| 1554 | // results will be sqrt(1), which is 1, so a result can't be zero. | |
| 1555 | unsafe { Self::new_unchecked(result) } | |
| 1573 | 1556 | } |
| 1574 | 1557 | }; |
| 1575 | 1558 |
library/core/src/num/uint_macros.rs+17-3| ... | ... | @@ -2762,10 +2762,24 @@ macro_rules! uint_impl { |
| 2762 | 2762 | without modifying the original"] |
| 2763 | 2763 | #[inline] |
| 2764 | 2764 | pub const fn isqrt(self) -> Self { |
| 2765 | match NonZero::new(self) { | |
| 2766 | Some(x) => x.isqrt().get(), | |
| 2767 | None => 0, | |
| 2765 | let result = crate::num::int_sqrt::$ActualT(self as $ActualT) as $SelfT; | |
| 2766 | ||
| 2767 | // Inform the optimizer what the range of outputs is. If testing | |
| 2768 | // `core` crashes with no panic message and a `num::int_sqrt::u*` | |
| 2769 | // test failed, it's because your edits caused these assertions or | |
| 2770 | // the assertions in `fn isqrt` of `nonzero.rs` to become false. | |
| 2771 | // | |
| 2772 | // SAFETY: Integer square root is a monotonically nondecreasing | |
| 2773 | // function, which means that increasing the input will never | |
| 2774 | // cause the output to decrease. Thus, since the input for unsigned | |
| 2775 | // integers is bounded by `[0, <$ActualT>::MAX]`, sqrt(n) will be | |
| 2776 | // bounded by `[sqrt(0), sqrt(<$ActualT>::MAX)]`. | |
| 2777 | unsafe { | |
| 2778 | const MAX_RESULT: $SelfT = crate::num::int_sqrt::$ActualT(<$ActualT>::MAX) as $SelfT; | |
| 2779 | crate::hint::assert_unchecked(result <= MAX_RESULT); | |
| 2768 | 2780 | } |
| 2781 | ||
| 2782 | result | |
| 2769 | 2783 | } |
| 2770 | 2784 | |
| 2771 | 2785 | /// Performs Euclidean division. |
library/core/tests/num/int_macros.rs-32| ... | ... | @@ -288,38 +288,6 @@ macro_rules! int_module { |
| 288 | 288 | assert_eq!(r.saturating_pow(0), 1 as $T); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | #[test] | |
| 292 | fn test_isqrt() { | |
| 293 | assert_eq!($T::MIN.checked_isqrt(), None); | |
| 294 | assert_eq!((-1 as $T).checked_isqrt(), None); | |
| 295 | assert_eq!((0 as $T).isqrt(), 0 as $T); | |
| 296 | assert_eq!((1 as $T).isqrt(), 1 as $T); | |
| 297 | assert_eq!((2 as $T).isqrt(), 1 as $T); | |
| 298 | assert_eq!((99 as $T).isqrt(), 9 as $T); | |
| 299 | assert_eq!((100 as $T).isqrt(), 10 as $T); | |
| 300 | } | |
| 301 | ||
| 302 | #[cfg(not(miri))] // Miri is too slow | |
| 303 | #[test] | |
| 304 | fn test_lots_of_isqrt() { | |
| 305 | let n_max: $T = (1024 * 1024).min($T::MAX as u128) as $T; | |
| 306 | for n in 0..=n_max { | |
| 307 | let isqrt: $T = n.isqrt(); | |
| 308 | ||
| 309 | assert!(isqrt.pow(2) <= n); | |
| 310 | let (square, overflow) = (isqrt + 1).overflowing_pow(2); | |
| 311 | assert!(overflow || square > n); | |
| 312 | } | |
| 313 | ||
| 314 | for n in ($T::MAX - 127)..=$T::MAX { | |
| 315 | let isqrt: $T = n.isqrt(); | |
| 316 | ||
| 317 | assert!(isqrt.pow(2) <= n); | |
| 318 | let (square, overflow) = (isqrt + 1).overflowing_pow(2); | |
| 319 | assert!(overflow || square > n); | |
| 320 | } | |
| 321 | } | |
| 322 | ||
| 323 | 291 | #[test] |
| 324 | 292 | fn test_div_floor() { |
| 325 | 293 | let a: $T = 8; |
library/core/tests/num/int_sqrt.rs created+248| ... | ... | @@ -0,0 +1,248 @@ |
| 1 | macro_rules! tests { | |
| 2 | ($isqrt_consistency_check_fn_macro:ident : $($T:ident)+) => { | |
| 3 | $( | |
| 4 | mod $T { | |
| 5 | $isqrt_consistency_check_fn_macro!($T); | |
| 6 | ||
| 7 | // Check that the following produce the correct values from | |
| 8 | // `isqrt`: | |
| 9 | // | |
| 10 | // * the first and last 128 nonnegative values | |
| 11 | // * powers of two, minus one | |
| 12 | // * powers of two | |
| 13 | // | |
| 14 | // For signed types, check that `checked_isqrt` and `isqrt` | |
| 15 | // either produce the same numeric value or respectively | |
| 16 | // produce `None` and a panic. Make sure to do a consistency | |
| 17 | // check for `<$T>::MIN` as well, as no nonnegative values | |
| 18 | // negate to it. | |
| 19 | // | |
| 20 | // For unsigned types check that `isqrt` produces the same | |
| 21 | // numeric value for `$T` and `NonZero<$T>`. | |
| 22 | #[test] | |
| 23 | fn isqrt() { | |
| 24 | isqrt_consistency_check(<$T>::MIN); | |
| 25 | ||
| 26 | for n in (0..=127) | |
| 27 | .chain(<$T>::MAX - 127..=<$T>::MAX) | |
| 28 | .chain((0..<$T>::MAX.count_ones()).map(|exponent| (1 << exponent) - 1)) | |
| 29 | .chain((0..<$T>::MAX.count_ones()).map(|exponent| 1 << exponent)) | |
| 30 | { | |
| 31 | isqrt_consistency_check(n); | |
| 32 | ||
| 33 | let isqrt_n = n.isqrt(); | |
| 34 | assert!( | |
| 35 | isqrt_n | |
| 36 | .checked_mul(isqrt_n) | |
| 37 | .map(|isqrt_n_squared| isqrt_n_squared <= n) | |
| 38 | .unwrap_or(false), | |
| 39 | "`{n}.isqrt()` should be lower than {isqrt_n}." | |
| 40 | ); | |
| 41 | assert!( | |
| 42 | (isqrt_n + 1) | |
| 43 | .checked_mul(isqrt_n + 1) | |
| 44 | .map(|isqrt_n_plus_1_squared| n < isqrt_n_plus_1_squared) | |
| 45 | .unwrap_or(true), | |
| 46 | "`{n}.isqrt()` should be higher than {isqrt_n})." | |
| 47 | ); | |
| 48 | } | |
| 49 | } | |
| 50 | ||
| 51 | // Check the square roots of: | |
| 52 | // | |
| 53 | // * the first 1,024 perfect squares | |
| 54 | // * halfway between each of the first 1,024 perfect squares | |
| 55 | // and the next perfect square | |
| 56 | // * the next perfect square after the each of the first 1,024 | |
| 57 | // perfect squares, minus one | |
| 58 | // * the last 1,024 perfect squares | |
| 59 | // * the last 1,024 perfect squares, minus one | |
| 60 | // * halfway between each of the last 1,024 perfect squares | |
| 61 | // and the previous perfect square | |
| 62 | #[test] | |
| 63 | // Skip this test on Miri, as it takes too long to run. | |
| 64 | #[cfg(not(miri))] | |
| 65 | fn isqrt_extended() { | |
| 66 | // The correct value is worked out by using the fact that | |
| 67 | // the nth nonzero perfect square is the sum of the first n | |
| 68 | // odd numbers: | |
| 69 | // | |
| 70 | // 1 = 1 | |
| 71 | // 4 = 1 + 3 | |
| 72 | // 9 = 1 + 3 + 5 | |
| 73 | // 16 = 1 + 3 + 5 + 7 | |
| 74 | // | |
| 75 | // Note also that the last odd number added in is two times | |
| 76 | // the square root of the previous perfect square, plus | |
| 77 | // one: | |
| 78 | // | |
| 79 | // 1 = 2*0 + 1 | |
| 80 | // 3 = 2*1 + 1 | |
| 81 | // 5 = 2*2 + 1 | |
| 82 | // 7 = 2*3 + 1 | |
| 83 | // | |
| 84 | // That means we can add the square root of this perfect | |
| 85 | // square once to get about halfway to the next perfect | |
| 86 | // square, then we can add the square root of this perfect | |
| 87 | // square again to get to the next perfect square, minus | |
| 88 | // one, then we can add one to get to the next perfect | |
| 89 | // square. | |
| 90 | // | |
| 91 | // This allows us to, for each of the first 1,024 perfect | |
| 92 | // squares, test that the square roots of the following are | |
| 93 | // all correct and equal to each other: | |
| 94 | // | |
| 95 | // * the current perfect square | |
| 96 | // * about halfway to the next perfect square | |
| 97 | // * the next perfect square, minus one | |
| 98 | let mut n: $T = 0; | |
| 99 | for sqrt_n in 0..1_024.min((1_u128 << (<$T>::MAX.count_ones()/2)) - 1) as $T { | |
| 100 | isqrt_consistency_check(n); | |
| 101 | assert_eq!( | |
| 102 | n.isqrt(), | |
| 103 | sqrt_n, | |
| 104 | "`{sqrt_n}.pow(2).isqrt()` should be {sqrt_n}." | |
| 105 | ); | |
| 106 | ||
| 107 | n += sqrt_n; | |
| 108 | isqrt_consistency_check(n); | |
| 109 | assert_eq!( | |
| 110 | n.isqrt(), | |
| 111 | sqrt_n, | |
| 112 | "{n} is about halfway between `{sqrt_n}.pow(2)` and `{}.pow(2)`, so `{n}.isqrt()` should be {sqrt_n}.", | |
| 113 | sqrt_n + 1 | |
| 114 | ); | |
| 115 | ||
| 116 | n += sqrt_n; | |
| 117 | isqrt_consistency_check(n); | |
| 118 | assert_eq!( | |
| 119 | n.isqrt(), | |
| 120 | sqrt_n, | |
| 121 | "`({}.pow(2) - 1).isqrt()` should be {sqrt_n}.", | |
| 122 | sqrt_n + 1 | |
| 123 | ); | |
| 124 | ||
| 125 | n += 1; | |
| 126 | } | |
| 127 | ||
| 128 | // Similarly, for each of the last 1,024 perfect squares, | |
| 129 | // check: | |
| 130 | // | |
| 131 | // * the current perfect square | |
| 132 | // * the current perfect square, minus one | |
| 133 | // * about halfway to the previous perfect square | |
| 134 | // | |
| 135 | // `MAX`'s `isqrt` return value is verified in the `isqrt` | |
| 136 | // test function above. | |
| 137 | let maximum_sqrt = <$T>::MAX.isqrt(); | |
| 138 | let mut n = maximum_sqrt * maximum_sqrt; | |
| 139 | ||
| 140 | for sqrt_n in (maximum_sqrt - 1_024.min((1_u128 << (<$T>::MAX.count_ones()/2)) - 1) as $T..maximum_sqrt).rev() { | |
| 141 | isqrt_consistency_check(n); | |
| 142 | assert_eq!( | |
| 143 | n.isqrt(), | |
| 144 | sqrt_n + 1, | |
| 145 | "`{0}.pow(2).isqrt()` should be {0}.", | |
| 146 | sqrt_n + 1 | |
| 147 | ); | |
| 148 | ||
| 149 | n -= 1; | |
| 150 | isqrt_consistency_check(n); | |
| 151 | assert_eq!( | |
| 152 | n.isqrt(), | |
| 153 | sqrt_n, | |
| 154 | "`({}.pow(2) - 1).isqrt()` should be {sqrt_n}.", | |
| 155 | sqrt_n + 1 | |
| 156 | ); | |
| 157 | ||
| 158 | n -= sqrt_n; | |
| 159 | isqrt_consistency_check(n); | |
| 160 | assert_eq!( | |
| 161 | n.isqrt(), | |
| 162 | sqrt_n, | |
| 163 | "{n} is about halfway between `{sqrt_n}.pow(2)` and `{}.pow(2)`, so `{n}.isqrt()` should be {sqrt_n}.", | |
| 164 | sqrt_n + 1 | |
| 165 | ); | |
| 166 | ||
| 167 | n -= sqrt_n; | |
| 168 | } | |
| 169 | } | |
| 170 | } | |
| 171 | )* | |
| 172 | }; | |
| 173 | } | |
| 174 | ||
| 175 | macro_rules! signed_check { | |
| 176 | ($T:ident) => { | |
| 177 | /// This takes an input and, if it's nonnegative or | |
| 178 | #[doc = concat!("`", stringify!($T), "::MIN`,")] | |
| 179 | /// checks that `isqrt` and `checked_isqrt` produce equivalent results | |
| 180 | /// for that input and for the negative of that input. | |
| 181 | /// | |
| 182 | /// # Note | |
| 183 | /// | |
| 184 | /// This cannot check that negative inputs to `isqrt` cause panics if | |
| 185 | /// panics abort instead of unwind. | |
| 186 | fn isqrt_consistency_check(n: $T) { | |
| 187 | // `<$T>::MIN` will be negative, so ignore it in this nonnegative | |
| 188 | // section. | |
| 189 | if n >= 0 { | |
| 190 | assert_eq!( | |
| 191 | Some(n.isqrt()), | |
| 192 | n.checked_isqrt(), | |
| 193 | "`{n}.checked_isqrt()` should match `Some({n}.isqrt())`.", | |
| 194 | ); | |
| 195 | } | |
| 196 | ||
| 197 | // `wrapping_neg` so that `<$T>::MIN` will negate to itself rather | |
| 198 | // than panicking. | |
| 199 | let negative_n = n.wrapping_neg(); | |
| 200 | ||
| 201 | // Zero negated will still be nonnegative, so ignore it in this | |
| 202 | // negative section. | |
| 203 | if negative_n < 0 { | |
| 204 | assert_eq!( | |
| 205 | negative_n.checked_isqrt(), | |
| 206 | None, | |
| 207 | "`({negative_n}).checked_isqrt()` should be `None`, as {negative_n} is negative.", | |
| 208 | ); | |
| 209 | ||
| 210 | // `catch_unwind` only works when panics unwind rather than abort. | |
| 211 | #[cfg(panic = "unwind")] | |
| 212 | { | |
| 213 | std::panic::catch_unwind(core::panic::AssertUnwindSafe(|| (-n).isqrt())).expect_err( | |
| 214 | &format!("`({negative_n}).isqrt()` should have panicked, as {negative_n} is negative.") | |
| 215 | ); | |
| 216 | } | |
| 217 | } | |
| 218 | } | |
| 219 | }; | |
| 220 | } | |
| 221 | ||
| 222 | macro_rules! unsigned_check { | |
| 223 | ($T:ident) => { | |
| 224 | /// This takes an input and, if it's nonzero, checks that `isqrt` | |
| 225 | /// produces the same numeric value for both | |
| 226 | #[doc = concat!("`", stringify!($T), "` and ")] | |
| 227 | #[doc = concat!("`NonZero<", stringify!($T), ">`.")] | |
| 228 | fn isqrt_consistency_check(n: $T) { | |
| 229 | // Zero cannot be turned into a `NonZero` value, so ignore it in | |
| 230 | // this nonzero section. | |
| 231 | if n > 0 { | |
| 232 | assert_eq!( | |
| 233 | n.isqrt(), | |
| 234 | core::num::NonZero::<$T>::new(n) | |
| 235 | .expect( | |
| 236 | "Was not able to create a new `NonZero` value from a nonzero number." | |
| 237 | ) | |
| 238 | .isqrt() | |
| 239 | .get(), | |
| 240 | "`{n}.isqrt` should match `NonZero`'s `{n}.isqrt().get()`.", | |
| 241 | ); | |
| 242 | } | |
| 243 | } | |
| 244 | }; | |
| 245 | } | |
| 246 | ||
| 247 | tests!(signed_check: i8 i16 i32 i64 i128); | |
| 248 | tests!(unsigned_check: u8 u16 u32 u64 u128); |
library/core/tests/num/mod.rs+1| ... | ... | @@ -27,6 +27,7 @@ mod const_from; |
| 27 | 27 | mod dec2flt; |
| 28 | 28 | mod flt2dec; |
| 29 | 29 | mod int_log; |
| 30 | mod int_sqrt; | |
| 30 | 31 | mod ops; |
| 31 | 32 | mod wrapping; |
| 32 | 33 |
src/doc/rustc/src/check-cfg.md+2-1| ... | ... | @@ -99,7 +99,7 @@ the need to specify them manually. |
| 99 | 99 | Well known names and values are implicitly added as long as at least one `--check-cfg` argument |
| 100 | 100 | is present. |
| 101 | 101 | |
| 102 | As of `2024-05-06T`, the list of known names is as follows: | |
| 102 | As of `2024-08-20T`, the list of known names is as follows: | |
| 103 | 103 | |
| 104 | 104 | <!--- See CheckCfg::fill_well_known in compiler/rustc_session/src/config.rs --> |
| 105 | 105 | |
| ... | ... | @@ -107,6 +107,7 @@ As of `2024-05-06T`, the list of known names is as follows: |
| 107 | 107 | - `debug_assertions` |
| 108 | 108 | - `doc` |
| 109 | 109 | - `doctest` |
| 110 | - `fmt_debug` | |
| 110 | 111 | - `miri` |
| 111 | 112 | - `overflow_checks` |
| 112 | 113 | - `panic` |
src/doc/unstable-book/src/compiler-flags/fmt-debug.md created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | # `fmt-debug` | |
| 2 | ||
| 3 | The tracking issue for this feature is: [#129709](https://github.com/rust-lang/rust/issues/129709). | |
| 4 | ||
| 5 | ------------------------ | |
| 6 | ||
| 7 | Option `-Z fmt-debug=val` controls verbosity of derived `Debug` implementations | |
| 8 | and debug formatting in format strings (`{:?}`). | |
| 9 | ||
| 10 | * `full` — `#[derive(Debug)]` prints types recursively. This is the default behavior. | |
| 11 | ||
| 12 | * `shallow` — `#[derive(Debug)]` prints only the type name, or name of a variant of a fieldless enums. Details of the `Debug` implementation are not stable and may change in the future. Behavior of custom `fmt::Debug` implementations is not affected. | |
| 13 | ||
| 14 | * `none` — `#[derive(Debug)]` does not print anything at all. `{:?}` in formatting strings has no effect. | |
| 15 | This option may reduce size of binaries, and remove occurrences of type names in the binary that are not removed by striping symbols. However, it may also cause `panic!` and `assert!` messages to be incomplete. |
src/doc/unstable-book/src/compiler-flags/lint-llvm-ir.md created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | # `lint-llvm-ir` | |
| 2 | ||
| 3 | --------------------- | |
| 4 | ||
| 5 | This flag will add `LintPass` to the start of the pipeline. | |
| 6 | You can use it to check for common errors in the LLVM IR generated by `rustc`. | |
| 7 | You can add `-Cllvm-args=-lint-abort-on-error` to abort the process if errors were found. |
src/doc/unstable-book/src/compiler-flags/sanitizer.md+33-7| ... | ... | @@ -775,22 +775,47 @@ See the [Clang SafeStack documentation][clang-safestack] for more details. |
| 775 | 775 | |
| 776 | 776 | # ShadowCallStack |
| 777 | 777 | |
| 778 | ShadowCallStack provides backward edge control flow protection by storing a function's return address in a separately allocated 'shadow call stack' and loading the return address from that shadow call stack. | |
| 779 | ||
| 780 | ShadowCallStack requires a platform ABI which reserves `x18` as the instrumentation makes use of this register. | |
| 778 | ShadowCallStack provides backward edge control flow protection by storing a function's return address in a separately allocated 'shadow call stack' | |
| 779 | and loading the return address from that shadow call stack. | |
| 780 | AArch64 and RISC-V both have a platform register defined in their ABIs, which is `x18` and `x3`/`gp` respectively, that can optionally be reserved for this purpose. | |
| 781 | Software support from the operating system and runtime may be required depending on the target platform which is detailed in the remaining section. | |
| 782 | See the [Clang ShadowCallStack documentation][clang-scs] for more details. | |
| 781 | 783 | |
| 782 | 784 | ShadowCallStack can be enabled with `-Zsanitizer=shadow-call-stack` option and is supported on the following targets: |
| 783 | 785 | |
| 784 | * `aarch64-linux-android` | |
| 786 | ## AArch64 family | |
| 785 | 787 | |
| 786 | A runtime must be provided by the application or operating system. | |
| 788 | ShadowCallStack requires the use of the ABI defined platform register, `x18`, which is required for code generation purposes. | |
| 789 | When `x18` is not reserved, and is instead used as a scratch register subsequently, enabling ShadowCallStack would lead to undefined behaviour | |
| 790 | due to corruption of return address or invalid memory access when the instrumentation restores return register to the link register `lr` from the | |
| 791 | already clobbered `x18` register. | |
| 792 | In other words, code that is calling into or called by functions instrumented with ShadowCallStack must reserve the `x18` register or preserve its value. | |
| 787 | 793 | |
| 788 | See the [Clang ShadowCallStack documentation][clang-scs] for more details. | |
| 794 | ### `aarch64-linux-android` and `aarch64-unknown-fuchsia`/`aarch64-fuchsia` | |
| 789 | 795 | |
| 790 | * `aarch64-unknown-none` | |
| 796 | This target already reserves the `x18` register. | |
| 797 | A runtime must be provided by the application or operating system. | |
| 798 | If `bionic` is used on this target, the software support is provided. | |
| 799 | Otherwise, a runtime needs to prepare a memory region and points `x18` to the region which serves as the shadow call stack. | |
| 800 | ||
| 801 | ### `aarch64-unknown-none` | |
| 791 | 802 | |
| 792 | 803 | In addition to support from a runtime by the application or operating system, the `-Zfixed-x18` flag is also mandatory. |
| 793 | 804 | |
| 805 | ## RISC-V 64 family | |
| 806 | ||
| 807 | ShadowCallStack uses either the `gp` register for software shadow stack, also known as `x3`, or the `ssp` register if [`Zicfiss`][riscv-zicfiss] extension is available. | |
| 808 | `gp`/`x3` is currently always reserved and available for ShadowCallStack instrumentation, and `ssp` in case of `Zicfiss` is only accessible through its dedicated shadow stack instructions. | |
| 809 | ||
| 810 | Support from the runtime and operating system is required when `gp`/`x3` is used for software shadow stack. | |
| 811 | A runtime must prepare a memory region and point `gp`/`x3` to the region before executing the code. | |
| 812 | ||
| 813 | The following targets support ShadowCallStack. | |
| 814 | ||
| 815 | * `riscv64imac-unknown-none-elf` | |
| 816 | * `riscv64gc-unknown-none-elf` | |
| 817 | * `riscv64gc-unknown-fuchsia` | |
| 818 | ||
| 794 | 819 | # ThreadSanitizer |
| 795 | 820 | |
| 796 | 821 | ThreadSanitizer is a data race detection tool. It is supported on the following |
| ... | ... | @@ -912,3 +937,4 @@ Sanitizers produce symbolized stacktraces when llvm-symbolizer binary is in `PAT |
| 912 | 937 | [clang-tsan]: https://clang.llvm.org/docs/ThreadSanitizer.html |
| 913 | 938 | [linux-kasan]: https://www.kernel.org/doc/html/latest/dev-tools/kasan.html |
| 914 | 939 | [llvm-memtag]: https://llvm.org/docs/MemTagSanitizer.html |
| 940 | [riscv-zicfiss]: https://github.com/riscv/riscv-cfi/blob/3f8e450c481ac303bd5643444f7a89672f24476e/src/cfi_backward.adoc |
src/librustdoc/clean/auto_trait.rs+1-1| ... | ... | @@ -341,7 +341,7 @@ fn clean_region_outlives_constraints<'tcx>( |
| 341 | 341 | .map(|&region| { |
| 342 | 342 | let lifetime = early_bound_region_name(region) |
| 343 | 343 | .inspect(|name| assert!(region_params.contains(name))) |
| 344 | .map(|name| Lifetime(name)) | |
| 344 | .map(Lifetime) | |
| 345 | 345 | .unwrap_or(Lifetime::statik()); |
| 346 | 346 | clean::GenericBound::Outlives(lifetime) |
| 347 | 347 | }) |
src/librustdoc/clean/blanket_impl.rs+1-1| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn synthesize_blanket_impls( |
| 24 | 24 | let mut blanket_impls = Vec::new(); |
| 25 | 25 | for trait_def_id in tcx.all_traits() { |
| 26 | 26 | if !cx.cache.effective_visibilities.is_reachable(tcx, trait_def_id) |
| 27 | || cx.generated_synthetics.get(&(ty.skip_binder(), trait_def_id)).is_some() | |
| 27 | || cx.generated_synthetics.contains(&(ty.skip_binder(), trait_def_id)) | |
| 28 | 28 | { |
| 29 | 29 | continue; |
| 30 | 30 | } |
src/librustdoc/clean/inline.rs+12-16| ... | ... | @@ -54,7 +54,7 @@ pub(crate) fn try_inline( |
| 54 | 54 | debug!("attrs={attrs:?}"); |
| 55 | 55 | |
| 56 | 56 | let attrs_without_docs = attrs.map(|(attrs, def_id)| { |
| 57 | (attrs.into_iter().filter(|a| a.doc_str().is_none()).cloned().collect::<Vec<_>>(), def_id) | |
| 57 | (attrs.iter().filter(|a| a.doc_str().is_none()).cloned().collect::<Vec<_>>(), def_id) | |
| 58 | 58 | }); |
| 59 | 59 | let attrs_without_docs = |
| 60 | 60 | attrs_without_docs.as_ref().map(|(attrs, def_id)| (&attrs[..], *def_id)); |
| ... | ... | @@ -288,10 +288,7 @@ pub(crate) fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean |
| 288 | 288 | clean::Trait { def_id: did, generics, items: trait_items, bounds: supertrait_bounds } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | pub(crate) fn build_function<'tcx>( | |
| 292 | cx: &mut DocContext<'tcx>, | |
| 293 | def_id: DefId, | |
| 294 | ) -> Box<clean::Function> { | |
| 291 | pub(crate) fn build_function(cx: &mut DocContext<'_>, def_id: DefId) -> Box<clean::Function> { | |
| 295 | 292 | let sig = cx.tcx.fn_sig(def_id).instantiate_identity(); |
| 296 | 293 | // The generics need to be cleaned before the signature. |
| 297 | 294 | let mut generics = |
| ... | ... | @@ -425,7 +422,7 @@ pub(crate) fn merge_attrs( |
| 425 | 422 | both.cfg(cx.tcx, &cx.cache.hidden_cfg), |
| 426 | 423 | ) |
| 427 | 424 | } else { |
| 428 | (Attributes::from_ast(&old_attrs), old_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg)) | |
| 425 | (Attributes::from_ast(old_attrs), old_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg)) | |
| 429 | 426 | } |
| 430 | 427 | } |
| 431 | 428 | |
| ... | ... | @@ -791,16 +788,15 @@ fn build_macro( |
| 791 | 788 | /// implementation for `AssociatedType` |
| 792 | 789 | fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean::Generics { |
| 793 | 790 | for pred in &mut g.where_predicates { |
| 794 | match *pred { | |
| 795 | clean::WherePredicate::BoundPredicate { ty: clean::SelfTy, ref mut bounds, .. } => { | |
| 796 | bounds.retain(|bound| match bound { | |
| 797 | clean::GenericBound::TraitBound(clean::PolyTrait { trait_, .. }, _) => { | |
| 798 | trait_.def_id() != trait_did | |
| 799 | } | |
| 800 | _ => true, | |
| 801 | }); | |
| 802 | } | |
| 803 | _ => {} | |
| 791 | if let clean::WherePredicate::BoundPredicate { ty: clean::SelfTy, ref mut bounds, .. } = | |
| 792 | *pred | |
| 793 | { | |
| 794 | bounds.retain(|bound| match bound { | |
| 795 | clean::GenericBound::TraitBound(clean::PolyTrait { trait_, .. }, _) => { | |
| 796 | trait_.def_id() != trait_did | |
| 797 | } | |
| 798 | _ => true, | |
| 799 | }); | |
| 804 | 800 | } |
| 805 | 801 | } |
| 806 | 802 |
src/librustdoc/clean/mod.rs+25-30| ... | ... | @@ -266,7 +266,7 @@ fn clean_poly_trait_ref_with_constraints<'tcx>( |
| 266 | 266 | ) |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) -> Lifetime { | |
| 269 | fn clean_lifetime(lifetime: &hir::Lifetime, cx: &mut DocContext<'_>) -> Lifetime { | |
| 270 | 270 | if let Some( |
| 271 | 271 | rbv::ResolvedArg::EarlyBound(did) |
| 272 | 272 | | rbv::ResolvedArg::LateBound(_, _, did) |
| ... | ... | @@ -274,7 +274,7 @@ fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) -> |
| 274 | 274 | ) = cx.tcx.named_bound_var(lifetime.hir_id) |
| 275 | 275 | && let Some(lt) = cx.args.get(&did.to_def_id()).and_then(|arg| arg.as_lt()) |
| 276 | 276 | { |
| 277 | return lt.clone(); | |
| 277 | return *lt; | |
| 278 | 278 | } |
| 279 | 279 | Lifetime(lifetime.ident.name) |
| 280 | 280 | } |
| ... | ... | @@ -285,7 +285,7 @@ pub(crate) fn clean_const<'tcx>( |
| 285 | 285 | ) -> ConstantKind { |
| 286 | 286 | match &constant.kind { |
| 287 | 287 | hir::ConstArgKind::Path(qpath) => { |
| 288 | ConstantKind::Path { path: qpath_to_string(&qpath).into() } | |
| 288 | ConstantKind::Path { path: qpath_to_string(qpath).into() } | |
| 289 | 289 | } |
| 290 | 290 | hir::ConstArgKind::Anon(anon) => ConstantKind::Anonymous { body: anon.body }, |
| 291 | 291 | } |
| ... | ... | @@ -299,7 +299,7 @@ pub(crate) fn clean_middle_const<'tcx>( |
| 299 | 299 | ConstantKind::TyConst { expr: constant.skip_binder().to_string().into() } |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | pub(crate) fn clean_middle_region<'tcx>(region: ty::Region<'tcx>) -> Option<Lifetime> { | |
| 302 | pub(crate) fn clean_middle_region(region: ty::Region<'_>) -> Option<Lifetime> { | |
| 303 | 303 | match *region { |
| 304 | 304 | ty::ReStatic => Some(Lifetime::statik()), |
| 305 | 305 | _ if !region.has_name() => None, |
| ... | ... | @@ -389,8 +389,8 @@ fn clean_poly_trait_predicate<'tcx>( |
| 389 | 389 | }) |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | fn clean_region_outlives_predicate<'tcx>( | |
| 393 | pred: ty::RegionOutlivesPredicate<'tcx>, | |
| 392 | fn clean_region_outlives_predicate( | |
| 393 | pred: ty::RegionOutlivesPredicate<'_>, | |
| 394 | 394 | ) -> Option<WherePredicate> { |
| 395 | 395 | let ty::OutlivesPredicate(a, b) = pred; |
| 396 | 396 | |
| ... | ... | @@ -513,10 +513,10 @@ fn projection_to_path_segment<'tcx>( |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | fn clean_generic_param_def<'tcx>( | |
| 516 | fn clean_generic_param_def( | |
| 517 | 517 | def: &ty::GenericParamDef, |
| 518 | 518 | defaults: ParamDefaults, |
| 519 | cx: &mut DocContext<'tcx>, | |
| 519 | cx: &mut DocContext<'_>, | |
| 520 | 520 | ) -> GenericParamDef { |
| 521 | 521 | let (name, kind) = match def.kind { |
| 522 | 522 | ty::GenericParamDefKind::Lifetime => { |
| ... | ... | @@ -1303,10 +1303,7 @@ pub(crate) fn clean_impl_item<'tcx>( |
| 1303 | 1303 | }) |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | pub(crate) fn clean_middle_assoc_item<'tcx>( | |
| 1307 | assoc_item: &ty::AssocItem, | |
| 1308 | cx: &mut DocContext<'tcx>, | |
| 1309 | ) -> Item { | |
| 1306 | pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocContext<'_>) -> Item { | |
| 1310 | 1307 | let tcx = cx.tcx; |
| 1311 | 1308 | let kind = match assoc_item.kind { |
| 1312 | 1309 | ty::AssocKind::Const => { |
| ... | ... | @@ -1459,7 +1456,7 @@ pub(crate) fn clean_middle_assoc_item<'tcx>( |
| 1459 | 1456 | // which only has one associated type, which is not a GAT, so whatever. |
| 1460 | 1457 | } |
| 1461 | 1458 | } |
| 1462 | bounds.extend(mem::replace(pred_bounds, Vec::new())); | |
| 1459 | bounds.extend(mem::take(pred_bounds)); | |
| 1463 | 1460 | false |
| 1464 | 1461 | } |
| 1465 | 1462 | _ => true, |
| ... | ... | @@ -1661,7 +1658,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type |
| 1661 | 1658 | expanded |
| 1662 | 1659 | } else { |
| 1663 | 1660 | // First we check if it's a private re-export. |
| 1664 | let path = if let Some(path) = first_non_private(cx, hir_id, &path) { | |
| 1661 | let path = if let Some(path) = first_non_private(cx, hir_id, path) { | |
| 1665 | 1662 | path |
| 1666 | 1663 | } else { |
| 1667 | 1664 | clean_path(path, cx) |
| ... | ... | @@ -1796,7 +1793,7 @@ fn maybe_expand_private_type_alias<'tcx>( |
| 1796 | 1793 | } |
| 1797 | 1794 | |
| 1798 | 1795 | Some(cx.enter_alias(args, def_id.to_def_id(), |cx| { |
| 1799 | cx.with_param_env(def_id.to_def_id(), |cx| clean_ty(&ty, cx)) | |
| 1796 | cx.with_param_env(def_id.to_def_id(), |cx| clean_ty(ty, cx)) | |
| 1800 | 1797 | })) |
| 1801 | 1798 | } |
| 1802 | 1799 | |
| ... | ... | @@ -1806,8 +1803,8 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T |
| 1806 | 1803 | match ty.kind { |
| 1807 | 1804 | TyKind::Never => Primitive(PrimitiveType::Never), |
| 1808 | 1805 | TyKind::Ptr(ref m) => RawPointer(m.mutbl, Box::new(clean_ty(m.ty, cx))), |
| 1809 | TyKind::Ref(ref l, ref m) => { | |
| 1810 | let lifetime = if l.is_anonymous() { None } else { Some(clean_lifetime(*l, cx)) }; | |
| 1806 | TyKind::Ref(l, ref m) => { | |
| 1807 | let lifetime = if l.is_anonymous() { None } else { Some(clean_lifetime(l, cx)) }; | |
| 1811 | 1808 | BorrowedRef { lifetime, mutability: m.mutbl, type_: Box::new(clean_ty(m.ty, cx)) } |
| 1812 | 1809 | } |
| 1813 | 1810 | TyKind::Slice(ty) => Slice(Box::new(clean_ty(ty, cx))), |
| ... | ... | @@ -1843,17 +1840,17 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T |
| 1843 | 1840 | TyKind::Tup(tys) => Tuple(tys.iter().map(|ty| clean_ty(ty, cx)).collect()), |
| 1844 | 1841 | TyKind::OpaqueDef(item_id, _, _) => { |
| 1845 | 1842 | let item = cx.tcx.hir().item(item_id); |
| 1846 | if let hir::ItemKind::OpaqueTy(ref ty) = item.kind { | |
| 1843 | if let hir::ItemKind::OpaqueTy(ty) = item.kind { | |
| 1847 | 1844 | ImplTrait(ty.bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect()) |
| 1848 | 1845 | } else { |
| 1849 | 1846 | unreachable!() |
| 1850 | 1847 | } |
| 1851 | 1848 | } |
| 1852 | 1849 | TyKind::Path(_) => clean_qpath(ty, cx), |
| 1853 | TyKind::TraitObject(bounds, ref lifetime, _) => { | |
| 1850 | TyKind::TraitObject(bounds, lifetime, _) => { | |
| 1854 | 1851 | let bounds = bounds.iter().map(|(bound, _)| clean_poly_trait_ref(bound, cx)).collect(); |
| 1855 | 1852 | let lifetime = |
| 1856 | if !lifetime.is_elided() { Some(clean_lifetime(*lifetime, cx)) } else { None }; | |
| 1853 | if !lifetime.is_elided() { Some(clean_lifetime(lifetime, cx)) } else { None }; | |
| 1857 | 1854 | DynTrait(bounds, lifetime) |
| 1858 | 1855 | } |
| 1859 | 1856 | TyKind::BareFn(barefn) => BareFunction(Box::new(clean_bare_fn_ty(barefn, cx))), |
| ... | ... | @@ -2355,7 +2352,7 @@ pub(crate) fn clean_field<'tcx>(field: &hir::FieldDef<'tcx>, cx: &mut DocContext |
| 2355 | 2352 | clean_field_with_def_id(field.def_id.to_def_id(), field.ident.name, clean_ty(field.ty, cx), cx) |
| 2356 | 2353 | } |
| 2357 | 2354 | |
| 2358 | pub(crate) fn clean_middle_field<'tcx>(field: &ty::FieldDef, cx: &mut DocContext<'tcx>) -> Item { | |
| 2355 | pub(crate) fn clean_middle_field(field: &ty::FieldDef, cx: &mut DocContext<'_>) -> Item { | |
| 2359 | 2356 | clean_field_with_def_id( |
| 2360 | 2357 | field.did, |
| 2361 | 2358 | field.name, |
| ... | ... | @@ -2378,7 +2375,7 @@ pub(crate) fn clean_field_with_def_id( |
| 2378 | 2375 | Item::from_def_id_and_parts(def_id, Some(name), StructFieldItem(ty), cx) |
| 2379 | 2376 | } |
| 2380 | 2377 | |
| 2381 | pub(crate) fn clean_variant_def<'tcx>(variant: &ty::VariantDef, cx: &mut DocContext<'tcx>) -> Item { | |
| 2378 | pub(crate) fn clean_variant_def(variant: &ty::VariantDef, cx: &mut DocContext<'_>) -> Item { | |
| 2382 | 2379 | let discriminant = match variant.discr { |
| 2383 | 2380 | ty::VariantDiscr::Explicit(def_id) => Some(Discriminant { expr: None, value: def_id }), |
| 2384 | 2381 | ty::VariantDiscr::Relative(_) => None, |
| ... | ... | @@ -2526,7 +2523,7 @@ fn clean_generic_args<'tcx>( |
| 2526 | 2523 | .filter_map(|arg| { |
| 2527 | 2524 | Some(match arg { |
| 2528 | 2525 | hir::GenericArg::Lifetime(lt) if !lt.is_anonymous() => { |
| 2529 | GenericArg::Lifetime(clean_lifetime(*lt, cx)) | |
| 2526 | GenericArg::Lifetime(clean_lifetime(lt, cx)) | |
| 2530 | 2527 | } |
| 2531 | 2528 | hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()), |
| 2532 | 2529 | hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)), |
| ... | ... | @@ -2579,11 +2576,11 @@ fn clean_bare_fn_ty<'tcx>( |
| 2579 | 2576 | BareFunctionDecl { safety: bare_fn.safety, abi: bare_fn.abi, decl, generic_params } |
| 2580 | 2577 | } |
| 2581 | 2578 | |
| 2582 | pub(crate) fn reexport_chain<'tcx>( | |
| 2583 | tcx: TyCtxt<'tcx>, | |
| 2579 | pub(crate) fn reexport_chain( | |
| 2580 | tcx: TyCtxt<'_>, | |
| 2584 | 2581 | import_def_id: LocalDefId, |
| 2585 | 2582 | target_def_id: DefId, |
| 2586 | ) -> &'tcx [Reexport] { | |
| 2583 | ) -> &[Reexport] { | |
| 2587 | 2584 | for child in tcx.module_children_local(tcx.local_parent(import_def_id)) { |
| 2588 | 2585 | if child.res.opt_def_id() == Some(target_def_id) |
| 2589 | 2586 | && child.reexport_chain.first().and_then(|r| r.id()) == Some(import_def_id.to_def_id()) |
| ... | ... | @@ -2803,7 +2800,7 @@ fn clean_maybe_renamed_item<'tcx>( |
| 2803 | 2800 | fields: variant_data.fields().iter().map(|x| clean_field(x, cx)).collect(), |
| 2804 | 2801 | }), |
| 2805 | 2802 | ItemKind::Impl(impl_) => return clean_impl(impl_, item.owner_id.def_id, cx), |
| 2806 | ItemKind::Macro(ref macro_def, MacroKind::Bang) => { | |
| 2803 | ItemKind::Macro(macro_def, MacroKind::Bang) => { | |
| 2807 | 2804 | let ty_vis = cx.tcx.visibility(def_id); |
| 2808 | 2805 | MacroItem(Macro { |
| 2809 | 2806 | // FIXME this shouldn't be false |
| ... | ... | @@ -3134,9 +3131,7 @@ fn clean_assoc_item_constraint<'tcx>( |
| 3134 | 3131 | } |
| 3135 | 3132 | } |
| 3136 | 3133 | |
| 3137 | fn clean_bound_vars<'tcx>( | |
| 3138 | bound_vars: &'tcx ty::List<ty::BoundVariableKind>, | |
| 3139 | ) -> Vec<GenericParamDef> { | |
| 3134 | fn clean_bound_vars(bound_vars: &ty::List<ty::BoundVariableKind>) -> Vec<GenericParamDef> { | |
| 3140 | 3135 | bound_vars |
| 3141 | 3136 | .into_iter() |
| 3142 | 3137 | .filter_map(|var| match var { |
src/librustdoc/clean/simplify.rs+1-1| ... | ... | @@ -70,7 +70,7 @@ pub(crate) fn where_clauses(cx: &DocContext<'_>, clauses: ThinVec<WP>) -> ThinVe |
| 70 | 70 | |
| 71 | 71 | pub(crate) fn merge_bounds( |
| 72 | 72 | cx: &clean::DocContext<'_>, |
| 73 | bounds: &mut Vec<clean::GenericBound>, | |
| 73 | bounds: &mut [clean::GenericBound], | |
| 74 | 74 | trait_did: DefId, |
| 75 | 75 | assoc: clean::PathSegment, |
| 76 | 76 | rhs: &clean::Term, |
src/librustdoc/clean/types.rs+14-17| ... | ... | @@ -368,11 +368,11 @@ fn is_field_vis_inherited(tcx: TyCtxt<'_>, def_id: DefId) -> bool { |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | impl Item { |
| 371 | pub(crate) fn stability<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<Stability> { | |
| 371 | pub(crate) fn stability(&self, tcx: TyCtxt<'_>) -> Option<Stability> { | |
| 372 | 372 | self.def_id().and_then(|did| tcx.lookup_stability(did)) |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | pub(crate) fn const_stability<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<ConstStability> { | |
| 375 | pub(crate) fn const_stability(&self, tcx: TyCtxt<'_>) -> Option<ConstStability> { | |
| 376 | 376 | self.def_id().and_then(|did| tcx.lookup_const_stability(did)) |
| 377 | 377 | } |
| 378 | 378 | |
| ... | ... | @@ -945,9 +945,9 @@ pub(crate) trait AttributesExt { |
| 945 | 945 | where |
| 946 | 946 | Self: 'a; |
| 947 | 947 | |
| 948 | fn lists<'a>(&'a self, name: Symbol) -> Self::AttributeIterator<'a>; | |
| 948 | fn lists(&self, name: Symbol) -> Self::AttributeIterator<'_>; | |
| 949 | 949 | |
| 950 | fn iter<'a>(&'a self) -> Self::Attributes<'a>; | |
| 950 | fn iter(&self) -> Self::Attributes<'_>; | |
| 951 | 951 | |
| 952 | 952 | fn cfg(&self, tcx: TyCtxt<'_>, hidden_cfg: &FxHashSet<Cfg>) -> Option<Arc<Cfg>> { |
| 953 | 953 | let sess = tcx.sess; |
| ... | ... | @@ -1043,15 +1043,15 @@ impl AttributesExt for [ast::Attribute] { |
| 1043 | 1043 | type AttributeIterator<'a> = impl Iterator<Item = ast::NestedMetaItem> + 'a; |
| 1044 | 1044 | type Attributes<'a> = impl Iterator<Item = &'a ast::Attribute> + 'a; |
| 1045 | 1045 | |
| 1046 | fn lists<'a>(&'a self, name: Symbol) -> Self::AttributeIterator<'a> { | |
| 1046 | fn lists(&self, name: Symbol) -> Self::AttributeIterator<'_> { | |
| 1047 | 1047 | self.iter() |
| 1048 | 1048 | .filter(move |attr| attr.has_name(name)) |
| 1049 | 1049 | .filter_map(ast::Attribute::meta_item_list) |
| 1050 | 1050 | .flatten() |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | fn iter<'a>(&'a self) -> Self::Attributes<'a> { | |
| 1054 | self.into_iter() | |
| 1053 | fn iter(&self) -> Self::Attributes<'_> { | |
| 1054 | self.iter() | |
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| ... | ... | @@ -1061,15 +1061,15 @@ impl AttributesExt for [(Cow<'_, ast::Attribute>, Option<DefId>)] { |
| 1061 | 1061 | type Attributes<'a> = impl Iterator<Item = &'a ast::Attribute> + 'a |
| 1062 | 1062 | where Self: 'a; |
| 1063 | 1063 | |
| 1064 | fn lists<'a>(&'a self, name: Symbol) -> Self::AttributeIterator<'a> { | |
| 1064 | fn lists(&self, name: Symbol) -> Self::AttributeIterator<'_> { | |
| 1065 | 1065 | AttributesExt::iter(self) |
| 1066 | 1066 | .filter(move |attr| attr.has_name(name)) |
| 1067 | 1067 | .filter_map(ast::Attribute::meta_item_list) |
| 1068 | 1068 | .flatten() |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | fn iter<'a>(&'a self) -> Self::Attributes<'a> { | |
| 1072 | self.into_iter().map(move |(attr, _)| match attr { | |
| 1071 | fn iter(&self) -> Self::Attributes<'_> { | |
| 1072 | self.iter().map(move |(attr, _)| match attr { | |
| 1073 | 1073 | Cow::Borrowed(attr) => *attr, |
| 1074 | 1074 | Cow::Owned(attr) => attr, |
| 1075 | 1075 | }) |
| ... | ... | @@ -1389,7 +1389,7 @@ pub(crate) struct FnDecl { |
| 1389 | 1389 | |
| 1390 | 1390 | impl FnDecl { |
| 1391 | 1391 | pub(crate) fn receiver_type(&self) -> Option<&Type> { |
| 1392 | self.inputs.values.get(0).and_then(|v| v.to_receiver()) | |
| 1392 | self.inputs.values.first().and_then(|v| v.to_receiver()) | |
| 1393 | 1393 | } |
| 1394 | 1394 | } |
| 1395 | 1395 | |
| ... | ... | @@ -1502,7 +1502,7 @@ impl Type { |
| 1502 | 1502 | pub(crate) fn without_borrowed_ref(&self) -> &Type { |
| 1503 | 1503 | let mut result = self; |
| 1504 | 1504 | while let Type::BorrowedRef { type_, .. } = result { |
| 1505 | result = &*type_; | |
| 1505 | result = type_; | |
| 1506 | 1506 | } |
| 1507 | 1507 | result |
| 1508 | 1508 | } |
| ... | ... | @@ -1631,10 +1631,7 @@ impl Type { |
| 1631 | 1631 | } |
| 1632 | 1632 | |
| 1633 | 1633 | pub(crate) fn is_self_type(&self) -> bool { |
| 1634 | match *self { | |
| 1635 | SelfTy => true, | |
| 1636 | _ => false, | |
| 1637 | } | |
| 1634 | matches!(*self, Type::SelfTy) | |
| 1638 | 1635 | } |
| 1639 | 1636 | |
| 1640 | 1637 | pub(crate) fn generic_args(&self) -> Option<&GenericArgs> { |
| ... | ... | @@ -1673,7 +1670,7 @@ impl Type { |
| 1673 | 1670 | pub(crate) fn def_id(&self, cache: &Cache) -> Option<DefId> { |
| 1674 | 1671 | let t: PrimitiveType = match *self { |
| 1675 | 1672 | Type::Path { ref path } => return Some(path.def_id()), |
| 1676 | DynTrait(ref bounds, _) => return bounds.get(0).map(|b| b.trait_.def_id()), | |
| 1673 | DynTrait(ref bounds, _) => return bounds.first().map(|b| b.trait_.def_id()), | |
| 1677 | 1674 | Primitive(p) => return cache.primitive_locations.get(&p).cloned(), |
| 1678 | 1675 | BorrowedRef { type_: box Generic(..), .. } => PrimitiveType::Reference, |
| 1679 | 1676 | BorrowedRef { ref type_, .. } => return type_.def_id(cache), |
src/librustdoc/clean/utils.rs+6-6| ... | ... | @@ -321,9 +321,9 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol { |
| 321 | 321 | "({})", |
| 322 | 322 | elts.iter().map(|p| name_from_pat(p).to_string()).collect::<Vec<String>>().join(", ") |
| 323 | 323 | ), |
| 324 | PatKind::Box(p) => return name_from_pat(&*p), | |
| 325 | PatKind::Deref(p) => format!("deref!({})", name_from_pat(&*p)), | |
| 326 | PatKind::Ref(p, _) => return name_from_pat(&*p), | |
| 324 | PatKind::Box(p) => return name_from_pat(p), | |
| 325 | PatKind::Deref(p) => format!("deref!({})", name_from_pat(p)), | |
| 326 | PatKind::Ref(p, _) => return name_from_pat(p), | |
| 327 | 327 | PatKind::Lit(..) => { |
| 328 | 328 | warn!( |
| 329 | 329 | "tried to get argument name from PatKind::Lit, which is silly in function arguments" |
| ... | ... | @@ -333,7 +333,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol { |
| 333 | 333 | PatKind::Range(..) => return kw::Underscore, |
| 334 | 334 | PatKind::Slice(begin, ref mid, end) => { |
| 335 | 335 | let begin = begin.iter().map(|p| name_from_pat(p).to_string()); |
| 336 | let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(&**p))).into_iter(); | |
| 336 | let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(p))).into_iter(); | |
| 337 | 337 | let end = end.iter().map(|p| name_from_pat(p).to_string()); |
| 338 | 338 | format!("[{}]", begin.chain(mid).chain(end).collect::<Vec<_>>().join(", ")) |
| 339 | 339 | } |
| ... | ... | @@ -344,7 +344,7 @@ pub(crate) fn print_const(cx: &DocContext<'_>, n: ty::Const<'_>) -> String { |
| 344 | 344 | match n.kind() { |
| 345 | 345 | ty::ConstKind::Unevaluated(ty::UnevaluatedConst { def, args: _ }) => { |
| 346 | 346 | let s = if let Some(def) = def.as_local() { |
| 347 | rendered_const(cx.tcx, &cx.tcx.hir().body_owned_by(def), def) | |
| 347 | rendered_const(cx.tcx, cx.tcx.hir().body_owned_by(def), def) | |
| 348 | 348 | } else { |
| 349 | 349 | inline::print_inlined_const(cx.tcx, def) |
| 350 | 350 | }; |
| ... | ... | @@ -383,7 +383,7 @@ pub(crate) fn print_evaluated_const( |
| 383 | 383 | |
| 384 | 384 | fn format_integer_with_underscore_sep(num: &str) -> String { |
| 385 | 385 | let num_chars: Vec<_> = num.chars().collect(); |
| 386 | let mut num_start_index = if num_chars.get(0) == Some(&'-') { 1 } else { 0 }; | |
| 386 | let mut num_start_index = if num_chars.first() == Some(&'-') { 1 } else { 0 }; | |
| 387 | 387 | let chunk_size = match num[num_start_index..].as_bytes() { |
| 388 | 388 | [b'0', b'b' | b'x', ..] => { |
| 389 | 389 | num_start_index += 2; |
src/librustdoc/config.rs+3-3| ... | ... | @@ -360,7 +360,7 @@ impl Options { |
| 360 | 360 | return None; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | if rustc_driver::describe_flag_categories(early_dcx, &matches) { | |
| 363 | if rustc_driver::describe_flag_categories(early_dcx, matches) { | |
| 364 | 364 | return None; |
| 365 | 365 | } |
| 366 | 366 | |
| ... | ... | @@ -374,7 +374,7 @@ impl Options { |
| 374 | 374 | let codegen_options = CodegenOptions::build(early_dcx, matches); |
| 375 | 375 | let unstable_opts = UnstableOptions::build(early_dcx, matches); |
| 376 | 376 | |
| 377 | let remap_path_prefix = match parse_remap_path_prefix(&matches) { | |
| 377 | let remap_path_prefix = match parse_remap_path_prefix(matches) { | |
| 378 | 378 | Ok(prefix_mappings) => prefix_mappings, |
| 379 | 379 | Err(err) => { |
| 380 | 380 | early_dcx.early_fatal(err); |
| ... | ... | @@ -486,7 +486,7 @@ impl Options { |
| 486 | 486 | _ => dcx.fatal("too many file operands"), |
| 487 | 487 | } |
| 488 | 488 | }; |
| 489 | let input = make_input(early_dcx, &input); | |
| 489 | let input = make_input(early_dcx, input); | |
| 490 | 490 | |
| 491 | 491 | let externs = parse_externs(early_dcx, matches, &unstable_opts); |
| 492 | 492 | let extern_html_root_urls = match parse_extern_html_roots(matches) { |
src/librustdoc/core.rs+1-1| ... | ... | @@ -288,7 +288,7 @@ pub(crate) fn create_config( |
| 288 | 288 | let hir = tcx.hir(); |
| 289 | 289 | let body = hir.body_owned_by(def_id); |
| 290 | 290 | debug!("visiting body for {def_id:?}"); |
| 291 | EmitIgnoredResolutionErrors::new(tcx).visit_body(&body); | |
| 291 | EmitIgnoredResolutionErrors::new(tcx).visit_body(body); | |
| 292 | 292 | (rustc_interface::DEFAULT_QUERY_PROVIDERS.typeck)(tcx, def_id) |
| 293 | 293 | }; |
| 294 | 294 | }), |
src/librustdoc/doctest.rs+8-8| ... | ... | @@ -272,7 +272,7 @@ pub(crate) fn run_tests( |
| 272 | 272 | let mut tests_runner = runner::DocTestRunner::new(); |
| 273 | 273 | |
| 274 | 274 | let rustdoc_test_options = IndividualTestOptions::new( |
| 275 | &rustdoc_options, | |
| 275 | rustdoc_options, | |
| 276 | 276 | &Some(format!("merged_doctest_{edition}")), |
| 277 | 277 | PathBuf::from(format!("doctest_{edition}.rs")), |
| 278 | 278 | ); |
| ... | ... | @@ -307,7 +307,7 @@ pub(crate) fn run_tests( |
| 307 | 307 | doctest, |
| 308 | 308 | scraped_test, |
| 309 | 309 | opts.clone(), |
| 310 | Arc::clone(&rustdoc_options), | |
| 310 | Arc::clone(rustdoc_options), | |
| 311 | 311 | unused_extern_reports.clone(), |
| 312 | 312 | )); |
| 313 | 313 | } |
| ... | ... | @@ -316,7 +316,7 @@ pub(crate) fn run_tests( |
| 316 | 316 | // We need to call `test_main` even if there is no doctest to run to get the output |
| 317 | 317 | // `running 0 tests...`. |
| 318 | 318 | if ran_edition_tests == 0 || !standalone_tests.is_empty() { |
| 319 | standalone_tests.sort_by(|a, b| a.desc.name.as_slice().cmp(&b.desc.name.as_slice())); | |
| 319 | standalone_tests.sort_by(|a, b| a.desc.name.as_slice().cmp(b.desc.name.as_slice())); | |
| 320 | 320 | test::test_main(&test_args, standalone_tests, None); |
| 321 | 321 | } |
| 322 | 322 | if nb_errors != 0 { |
| ... | ... | @@ -421,7 +421,7 @@ fn add_exe_suffix(input: String, target: &TargetTriple) -> String { |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | fn wrapped_rustc_command(rustc_wrappers: &[PathBuf], rustc_binary: &Path) -> Command { |
| 424 | let mut args = rustc_wrappers.iter().map(PathBuf::as_path).chain([rustc_binary].into_iter()); | |
| 424 | let mut args = rustc_wrappers.iter().map(PathBuf::as_path).chain([rustc_binary]); | |
| 425 | 425 | |
| 426 | 426 | let exe = args.next().expect("unable to create rustc command"); |
| 427 | 427 | let mut command = Command::new(exe); |
| ... | ... | @@ -452,7 +452,7 @@ pub(crate) struct RunnableDocTest { |
| 452 | 452 | |
| 453 | 453 | impl RunnableDocTest { |
| 454 | 454 | fn path_for_merged_doctest(&self) -> PathBuf { |
| 455 | self.test_opts.outdir.path().join(&format!("doctest_{}.rs", self.edition)) | |
| 455 | self.test_opts.outdir.path().join(format!("doctest_{}.rs", self.edition)) | |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
| ... | ... | @@ -477,13 +477,13 @@ fn run_test( |
| 477 | 477 | .unwrap_or_else(|| rustc_interface::util::rustc_path().expect("found rustc")); |
| 478 | 478 | let mut compiler = wrapped_rustc_command(&rustdoc_options.test_builder_wrappers, rustc_binary); |
| 479 | 479 | |
| 480 | compiler.arg(&format!("@{}", doctest.global_opts.args_file.display())); | |
| 480 | compiler.arg(format!("@{}", doctest.global_opts.args_file.display())); | |
| 481 | 481 | |
| 482 | 482 | if let Some(sysroot) = &rustdoc_options.maybe_sysroot { |
| 483 | 483 | compiler.arg(format!("--sysroot={}", sysroot.display())); |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | compiler.arg("--edition").arg(&doctest.edition.to_string()); | |
| 486 | compiler.arg("--edition").arg(doctest.edition.to_string()); | |
| 487 | 487 | if !doctest.is_multiple_tests { |
| 488 | 488 | // Setting these environment variables is unneeded if this is a merged doctest. |
| 489 | 489 | compiler.env("UNSTABLE_RUSTDOC_TEST_PATH", &doctest.test_opts.path); |
| ... | ... | @@ -692,7 +692,7 @@ impl IndividualTestOptions { |
| 692 | 692 | fn new(options: &RustdocOptions, test_id: &Option<String>, test_path: PathBuf) -> Self { |
| 693 | 693 | let outdir = if let Some(ref path) = options.persist_doctests { |
| 694 | 694 | let mut path = path.clone(); |
| 695 | path.push(&test_id.as_deref().unwrap_or_else(|| "<doctest>")); | |
| 695 | path.push(&test_id.as_deref().unwrap_or("<doctest>")); | |
| 696 | 696 | |
| 697 | 697 | if let Err(err) = std::fs::create_dir_all(&path) { |
| 698 | 698 | eprintln!("Couldn't create directory for doctest executables: {err}"); |
src/librustdoc/doctest/make.rs+1-1| ... | ... | @@ -311,7 +311,7 @@ fn parse_source( |
| 311 | 311 | } |
| 312 | 312 | ast::ItemKind::ExternCrate(original) => { |
| 313 | 313 | if !info.found_extern_crate |
| 314 | && let Some(ref crate_name) = crate_name | |
| 314 | && let Some(crate_name) = crate_name | |
| 315 | 315 | { |
| 316 | 316 | info.found_extern_crate = match original { |
| 317 | 317 | Some(name) => name.as_str() == *crate_name, |
src/librustdoc/doctest/markdown.rs+1-1| ... | ... | @@ -73,7 +73,7 @@ pub(crate) fn test(options: Options) -> Result<(), String> { |
| 73 | 73 | use rustc_session::config::Input; |
| 74 | 74 | let input_str = match &options.input { |
| 75 | 75 | Input::File(path) => { |
| 76 | read_to_string(&path).map_err(|err| format!("{}: {err}", path.display()))? | |
| 76 | read_to_string(path).map_err(|err| format!("{}: {err}", path.display()))? | |
| 77 | 77 | } |
| 78 | 78 | Input::Str { name: _, input } => input.clone(), |
| 79 | 79 | }; |
src/librustdoc/doctest/runner.rs+4-2| ... | ... | @@ -98,8 +98,10 @@ impl DocTestRunner { |
| 98 | 98 | |
| 99 | 99 | code.push_str("extern crate test;\n"); |
| 100 | 100 | |
| 101 | let test_args = | |
| 102 | test_args.iter().map(|arg| format!("{arg:?}.to_string(),")).collect::<String>(); | |
| 101 | let test_args = test_args.iter().fold(String::new(), |mut x, arg| { | |
| 102 | write!(x, "{arg:?}.to_string(),").unwrap(); | |
| 103 | x | |
| 104 | }); | |
| 103 | 105 | write!( |
| 104 | 106 | code, |
| 105 | 107 | "\ |
src/librustdoc/error.rs+1-1| ... | ... | @@ -39,7 +39,7 @@ macro_rules! try_none { |
| 39 | 39 | match $e { |
| 40 | 40 | Some(e) => e, |
| 41 | 41 | None => { |
| 42 | return Err(<crate::error::Error as crate::docfs::PathError>::new( | |
| 42 | return Err(<$crate::error::Error as $crate::docfs::PathError>::new( | |
| 43 | 43 | io::Error::new(io::ErrorKind::Other, "not found"), |
| 44 | 44 | $file, |
| 45 | 45 | )); |
src/librustdoc/formats/cache.rs+6-6| ... | ... | @@ -274,7 +274,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { |
| 274 | 274 | None |
| 275 | 275 | }; |
| 276 | 276 | if let Some(name) = search_name { |
| 277 | add_item_to_search_index(self.tcx, &mut self.cache, &item, name) | |
| 277 | add_item_to_search_index(self.tcx, self.cache, &item, name) | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // Keep track of the fully qualified path for this item. |
| ... | ... | @@ -452,7 +452,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It |
| 452 | 452 | // or if item is tuple struct/variant field (name is a number -> not useful for search). |
| 453 | 453 | if cache.stripped_mod |
| 454 | 454 | || item.type_() == ItemType::StructField |
| 455 | && name.as_str().chars().all(|c| c.is_digit(10)) | |
| 455 | && name.as_str().chars().all(|c| c.is_ascii_digit()) | |
| 456 | 456 | { |
| 457 | 457 | return; |
| 458 | 458 | } |
| ... | ... | @@ -463,7 +463,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It |
| 463 | 463 | } |
| 464 | 464 | clean::MethodItem(..) | clean::AssocConstItem(..) | clean::AssocTypeItem(..) => { |
| 465 | 465 | let last = cache.parent_stack.last().expect("parent_stack is empty 2"); |
| 466 | let parent_did = match &*last { | |
| 466 | let parent_did = match last { | |
| 467 | 467 | // impl Trait for &T { fn method(self); } |
| 468 | 468 | // |
| 469 | 469 | // When generating a function index with the above shape, we want it |
| ... | ... | @@ -471,9 +471,9 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It |
| 471 | 471 | // show up as `T::method`, rather than `reference::method`, in the search |
| 472 | 472 | // results page. |
| 473 | 473 | ParentStackItem::Impl { for_: clean::Type::BorrowedRef { type_, .. }, .. } => { |
| 474 | type_.def_id(&cache) | |
| 474 | type_.def_id(cache) | |
| 475 | 475 | } |
| 476 | ParentStackItem::Impl { for_, .. } => for_.def_id(&cache), | |
| 476 | ParentStackItem::Impl { for_, .. } => for_.def_id(cache), | |
| 477 | 477 | ParentStackItem::Type(item_id) => item_id.as_def_id(), |
| 478 | 478 | }; |
| 479 | 479 | let Some(parent_did) = parent_did else { return }; |
| ... | ... | @@ -538,7 +538,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It |
| 538 | 538 | None |
| 539 | 539 | }; |
| 540 | 540 | let search_type = get_function_type_for_search( |
| 541 | &item, | |
| 541 | item, | |
| 542 | 542 | tcx, |
| 543 | 543 | clean_impl_generics(cache.parent_stack.last()).as_ref(), |
| 544 | 544 | parent_did, |
src/librustdoc/html/format.rs+9-10| ... | ... | @@ -633,7 +633,7 @@ fn generate_item_def_id_path( |
| 633 | 633 | let module_fqp = to_module_fqp(shortty, &fqp); |
| 634 | 634 | let mut is_remote = false; |
| 635 | 635 | |
| 636 | let url_parts = url_parts(cx.cache(), def_id, &module_fqp, &cx.current, &mut is_remote)?; | |
| 636 | let url_parts = url_parts(cx.cache(), def_id, module_fqp, &cx.current, &mut is_remote)?; | |
| 637 | 637 | let (url_parts, shortty, fqp) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?; |
| 638 | 638 | if def_id == original_def_id { |
| 639 | 639 | return Ok((url_parts, shortty, fqp)); |
| ... | ... | @@ -811,7 +811,7 @@ pub(crate) fn link_tooltip(did: DefId, fragment: &Option<UrlFragment>, cx: &Cont |
| 811 | 811 | // primitives are documented in a crate, but not actually part of it |
| 812 | 812 | &fqp[fqp.len() - 1..] |
| 813 | 813 | } else { |
| 814 | &fqp | |
| 814 | fqp | |
| 815 | 815 | }; |
| 816 | 816 | if let &Some(UrlFragment::Item(id)) = fragment { |
| 817 | 817 | write!(buf, "{} ", cx.tcx().def_descr(id)); |
| ... | ... | @@ -820,7 +820,7 @@ pub(crate) fn link_tooltip(did: DefId, fragment: &Option<UrlFragment>, cx: &Cont |
| 820 | 820 | } |
| 821 | 821 | write!(buf, "{}", cx.tcx().item_name(id)); |
| 822 | 822 | } else if !fqp.is_empty() { |
| 823 | let mut fqp_it = fqp.into_iter(); | |
| 823 | let mut fqp_it = fqp.iter(); | |
| 824 | 824 | write!(buf, "{shortty} {}", fqp_it.next().unwrap()); |
| 825 | 825 | for component in fqp_it { |
| 826 | 826 | write!(buf, "::{component}"); |
| ... | ... | @@ -830,13 +830,13 @@ pub(crate) fn link_tooltip(did: DefId, fragment: &Option<UrlFragment>, cx: &Cont |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /// Used to render a [`clean::Path`]. |
| 833 | fn resolved_path<'cx>( | |
| 833 | fn resolved_path( | |
| 834 | 834 | w: &mut fmt::Formatter<'_>, |
| 835 | 835 | did: DefId, |
| 836 | 836 | path: &clean::Path, |
| 837 | 837 | print_all: bool, |
| 838 | 838 | use_absolute: bool, |
| 839 | cx: &'cx Context<'_>, | |
| 839 | cx: &Context<'_>, | |
| 840 | 840 | ) -> fmt::Result { |
| 841 | 841 | let last = path.segments.last().unwrap(); |
| 842 | 842 | |
| ... | ... | @@ -996,11 +996,11 @@ pub(crate) fn anchor<'a, 'cx: 'a>( |
| 996 | 996 | }) |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | fn fmt_type<'cx>( | |
| 999 | fn fmt_type( | |
| 1000 | 1000 | t: &clean::Type, |
| 1001 | 1001 | f: &mut fmt::Formatter<'_>, |
| 1002 | 1002 | use_absolute: bool, |
| 1003 | cx: &'cx Context<'_>, | |
| 1003 | cx: &Context<'_>, | |
| 1004 | 1004 | ) -> fmt::Result { |
| 1005 | 1005 | trace!("fmt_type(t = {t:?})"); |
| 1006 | 1006 | |
| ... | ... | @@ -1493,9 +1493,8 @@ impl clean::FnDecl { |
| 1493 | 1493 | } |
| 1494 | 1494 | clean::BorrowedRef { lifetime, mutability, type_: box clean::SelfTy } => { |
| 1495 | 1495 | write!(f, "{amp}")?; |
| 1496 | match lifetime { | |
| 1497 | Some(lt) => write!(f, "{lt} ", lt = lt.print())?, | |
| 1498 | None => {} | |
| 1496 | if let Some(lt) = lifetime { | |
| 1497 | write!(f, "{lt} ", lt = lt.print())?; | |
| 1499 | 1498 | } |
| 1500 | 1499 | write!(f, "{mutability}self", mutability = mutability.print_with_space())?; |
| 1501 | 1500 | } |
tests/codegen/cast-target-abi.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | // ignore-tidy-linelength |
| 2 | 2 | //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64 |
| 3 | // FIXME: Add `-Cllvm-args=--lint-abort-on-error` after LLVM 19 | |
| 4 | //@ compile-flags: -O -C no-prepopulate-passes -C passes=lint | |
| 3 | //@ min-llvm-version: 19 | |
| 4 | //@ compile-flags: -O -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error | |
| 5 | 5 | |
| 6 | 6 | //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu |
| 7 | 7 | //@[aarch64] needs-llvm-components: arm |
tests/codegen/cffi/ffi-out-of-bounds-loads.rs+2-1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ revisions: linux apple |
| 2 | //@ compile-flags: -C opt-level=0 -C no-prepopulate-passes -C passes=lint | |
| 2 | //@ min-llvm-version: 19 | |
| 3 | //@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error | |
| 3 | 4 | |
| 4 | 5 | //@[linux] compile-flags: --target x86_64-unknown-linux-gnu |
| 5 | 6 | //@[linux] needs-llvm-components: x86 |
tests/codegen/sanitizer/riscv64-shadow-call-stack.rs created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | //@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack | |
| 2 | //@ needs-llvm-components: riscv | |
| 3 | ||
| 4 | #![allow(internal_features)] | |
| 5 | #![crate_type = "rlib"] | |
| 6 | #![feature(no_core, lang_items)] | |
| 7 | #![no_core] | |
| 8 | ||
| 9 | #[lang = "sized"] | |
| 10 | trait Sized {} | |
| 11 | ||
| 12 | // CHECK: ; Function Attrs:{{.*}}shadowcallstack | |
| 13 | // CHECK: define dso_local void @foo() unnamed_addr #0 | |
| 14 | #[no_mangle] | |
| 15 | pub fn foo() {} | |
| 16 | ||
| 17 | // CHECK: attributes #0 = {{.*}}shadowcallstack{{.*}} |
tests/run-make/dos-device-input/rmake.rs+2-4| ... | ... | @@ -1,13 +1,11 @@ |
| 1 | 1 | //@ only-windows |
| 2 | 2 | // Reason: dos devices are a Windows thing |
| 3 | 3 | |
| 4 | use std::path::Path; | |
| 5 | ||
| 6 | use run_make_support::{rustc, static_lib_name}; | |
| 4 | use run_make_support::{path, rustc, static_lib_name}; | |
| 7 | 5 | |
| 8 | 6 | fn main() { |
| 9 | 7 | rustc().input(r"\\.\NUL").crate_type("staticlib").run(); |
| 10 | 8 | rustc().input(r"\\?\NUL").crate_type("staticlib").run(); |
| 11 | 9 | |
| 12 | assert!(Path::new(&static_lib_name("rust_out")).exists()); | |
| 10 | assert!(path(&static_lib_name("rust_out")).exists()); | |
| 13 | 11 | } |
tests/run-make/emit-shared-files/rmake.rs+21-23| ... | ... | @@ -5,9 +5,7 @@ |
| 5 | 5 | // `all-shared` should only emit files that can be shared between crates. |
| 6 | 6 | // See https://github.com/rust-lang/rust/pull/83478 |
| 7 | 7 | |
| 8 | use std::path::Path; | |
| 9 | ||
| 10 | use run_make_support::{has_extension, has_prefix, rustdoc, shallow_find_files}; | |
| 8 | use run_make_support::{has_extension, has_prefix, path, rustdoc, shallow_find_files}; | |
| 11 | 9 | |
| 12 | 10 | fn main() { |
| 13 | 11 | rustdoc() |
| ... | ... | @@ -19,18 +17,18 @@ fn main() { |
| 19 | 17 | .args(&["--extend-css", "z.css"]) |
| 20 | 18 | .input("x.rs") |
| 21 | 19 | .run(); |
| 22 | assert!(Path::new("invocation-only/search-index-xxx.js").exists()); | |
| 23 | assert!(Path::new("invocation-only/crates-xxx.js").exists()); | |
| 24 | assert!(Path::new("invocation-only/settings.html").exists()); | |
| 25 | assert!(Path::new("invocation-only/x/all.html").exists()); | |
| 26 | assert!(Path::new("invocation-only/x/index.html").exists()); | |
| 27 | assert!(Path::new("invocation-only/theme-xxx.css").exists()); // generated from z.css | |
| 28 | assert!(!Path::new("invocation-only/storage-xxx.js").exists()); | |
| 29 | assert!(!Path::new("invocation-only/SourceSerif4-It.ttf.woff2").exists()); | |
| 20 | assert!(path("invocation-only/search-index-xxx.js").exists()); | |
| 21 | assert!(path("invocation-only/crates-xxx.js").exists()); | |
| 22 | assert!(path("invocation-only/settings.html").exists()); | |
| 23 | assert!(path("invocation-only/x/all.html").exists()); | |
| 24 | assert!(path("invocation-only/x/index.html").exists()); | |
| 25 | assert!(path("invocation-only/theme-xxx.css").exists()); // generated from z.css | |
| 26 | assert!(!path("invocation-only/storage-xxx.js").exists()); | |
| 27 | assert!(!path("invocation-only/SourceSerif4-It.ttf.woff2").exists()); | |
| 30 | 28 | // FIXME: this probably shouldn't have a suffix |
| 31 | assert!(Path::new("invocation-only/y-xxx.css").exists()); | |
| 29 | assert!(path("invocation-only/y-xxx.css").exists()); | |
| 32 | 30 | // FIXME: this is technically incorrect (see `write_shared`) |
| 33 | assert!(!Path::new("invocation-only/main-xxx.js").exists()); | |
| 31 | assert!(!path("invocation-only/main-xxx.js").exists()); | |
| 34 | 32 | |
| 35 | 33 | rustdoc() |
| 36 | 34 | .arg("-Zunstable-options") |
| ... | ... | @@ -61,10 +59,10 @@ fn main() { |
| 61 | 59 | .len(), |
| 62 | 60 | 1 |
| 63 | 61 | ); |
| 64 | assert!(!Path::new("toolchain-only/search-index-xxx.js").exists()); | |
| 65 | assert!(!Path::new("toolchain-only/x/index.html").exists()); | |
| 66 | assert!(!Path::new("toolchain-only/theme.css").exists()); | |
| 67 | assert!(!Path::new("toolchain-only/y-xxx.css").exists()); | |
| 62 | assert!(!path("toolchain-only/search-index-xxx.js").exists()); | |
| 63 | assert!(!path("toolchain-only/x/index.html").exists()); | |
| 64 | assert!(!path("toolchain-only/theme.css").exists()); | |
| 65 | assert!(!path("toolchain-only/y-xxx.css").exists()); | |
| 68 | 66 | |
| 69 | 67 | rustdoc() |
| 70 | 68 | .arg("-Zunstable-options") |
| ... | ... | @@ -88,11 +86,11 @@ fn main() { |
| 88 | 86 | .len(), |
| 89 | 87 | 1 |
| 90 | 88 | ); |
| 91 | assert!(!Path::new("all-shared/search-index-xxx.js").exists()); | |
| 92 | assert!(!Path::new("all-shared/settings.html").exists()); | |
| 93 | assert!(!Path::new("all-shared/x").exists()); | |
| 94 | assert!(!Path::new("all-shared/src").exists()); | |
| 95 | assert!(!Path::new("all-shared/theme.css").exists()); | |
| 89 | assert!(!path("all-shared/search-index-xxx.js").exists()); | |
| 90 | assert!(!path("all-shared/settings.html").exists()); | |
| 91 | assert!(!path("all-shared/x").exists()); | |
| 92 | assert!(!path("all-shared/src").exists()); | |
| 93 | assert!(!path("all-shared/theme.css").exists()); | |
| 96 | 94 | assert_eq!( |
| 97 | 95 | shallow_find_files("all-shared/static.files", |path| { |
| 98 | 96 | has_prefix(path, "main-") && has_extension(path, "js") |
| ... | ... | @@ -100,5 +98,5 @@ fn main() { |
| 100 | 98 | .len(), |
| 101 | 99 | 1 |
| 102 | 100 | ); |
| 103 | assert!(!Path::new("all-shared/y-xxx.css").exists()); | |
| 101 | assert!(!path("all-shared/y-xxx.css").exists()); | |
| 104 | 102 | } |
tests/run-make/libtest-thread-limit/rmake.rs+3| ... | ... | @@ -11,6 +11,9 @@ |
| 11 | 11 | // Reason: thread limit modification |
| 12 | 12 | //@ ignore-cross-compile |
| 13 | 13 | // Reason: this test fails armhf-gnu, reasons unknown |
| 14 | //@ needs-unwind | |
| 15 | // Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere | |
| 16 | // else that uses panic=abort. | |
| 14 | 17 | |
| 15 | 18 | use std::ffi::{self, CStr, CString}; |
| 16 | 19 | use std::path::PathBuf; |
tests/run-make/manual-crate-name/rmake.rs+2-4| ... | ... | @@ -1,8 +1,6 @@ |
| 1 | use std::path::Path; | |
| 2 | ||
| 3 | use run_make_support::rustc; | |
| 1 | use run_make_support::{path, rustc}; | |
| 4 | 2 | |
| 5 | 3 | fn main() { |
| 6 | 4 | rustc().input("bar.rs").crate_name("foo").run(); |
| 7 | assert!(Path::new("libfoo.rlib").is_file()); | |
| 5 | assert!(path("libfoo.rlib").is_file()); | |
| 8 | 6 | } |
tests/run-make/pretty-print-with-dep-file/rmake.rs+2-4| ... | ... | @@ -5,14 +5,12 @@ |
| 5 | 5 | // does not get an unexpected dep-info file. |
| 6 | 6 | // See https://github.com/rust-lang/rust/issues/112898 |
| 7 | 7 | |
| 8 | use std::path::Path; | |
| 9 | ||
| 10 | use run_make_support::{invalid_utf8_contains, rfs, rustc}; | |
| 8 | use run_make_support::{invalid_utf8_contains, path, rfs, rustc}; | |
| 11 | 9 | |
| 12 | 10 | fn main() { |
| 13 | 11 | rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run(); |
| 14 | 12 | invalid_utf8_contains("with-dep.d", "with-dep.rs"); |
| 15 | 13 | rfs::remove_file("with-dep.d"); |
| 16 | 14 | rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run(); |
| 17 | assert!(!Path::new("with-dep.d").exists()); | |
| 15 | assert!(!path("with-dep.d").exists()); | |
| 18 | 16 | } |
tests/run-make/profile/rmake.rs+4-6| ... | ... | @@ -8,16 +8,14 @@ |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | 9 | //@ needs-profiler-support |
| 10 | 10 | |
| 11 | use std::path::Path; | |
| 12 | ||
| 13 | use run_make_support::{run, rustc}; | |
| 11 | use run_make_support::{path, run, rustc}; | |
| 14 | 12 | |
| 15 | 13 | fn main() { |
| 16 | 14 | rustc().arg("-g").arg("-Zprofile").input("test.rs").run(); |
| 17 | 15 | run("test"); |
| 18 | assert!(Path::new("test.gcno").exists(), "no .gcno file"); | |
| 19 | assert!(Path::new("test.gcda").exists(), "no .gcda file"); | |
| 16 | assert!(path("test.gcno").exists(), "no .gcno file"); | |
| 17 | assert!(path("test.gcda").exists(), "no .gcda file"); | |
| 20 | 18 | rustc().arg("-g").arg("-Zprofile").arg("-Zprofile-emit=abc/abc.gcda").input("test.rs").run(); |
| 21 | 19 | run("test"); |
| 22 | assert!(Path::new("abc/abc.gcda").exists(), "gcda file not emitted to defined path"); | |
| 20 | assert!(path("abc/abc.gcda").exists(), "gcda file not emitted to defined path"); | |
| 23 | 21 | } |
tests/run-make/reset-codegen-1/rmake.rs+4-6| ... | ... | @@ -7,9 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | 9 | |
| 10 | use std::path::Path; | |
| 11 | ||
| 12 | use run_make_support::{bin_name, rustc}; | |
| 10 | use run_make_support::{bin_name, path, rustc}; | |
| 13 | 11 | |
| 14 | 12 | fn compile(output_file: &str, emit: Option<&str>) { |
| 15 | 13 | let mut rustc = rustc(); |
| ... | ... | @@ -34,10 +32,10 @@ fn main() { |
| 34 | 32 | // In the None case, bin_name is required for successful Windows compilation. |
| 35 | 33 | let output_file = &bin_name(output_file); |
| 36 | 34 | compile(output_file, emit); |
| 37 | assert!(Path::new(output_file).is_file()); | |
| 35 | assert!(path(output_file).is_file()); | |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | 38 | compile("multi-output", Some("asm,obj")); |
| 41 | assert!(Path::new("multi-output.s").is_file()); | |
| 42 | assert!(Path::new("multi-output.o").is_file()); | |
| 39 | assert!(path("multi-output.s").is_file()); | |
| 40 | assert!(path("multi-output.o").is_file()); | |
| 43 | 41 | } |
tests/run-make/rustdoc-determinism/rmake.rs+3-5| ... | ... | @@ -1,16 +1,14 @@ |
| 1 | 1 | // Assert that the search index is generated deterministically, regardless of the |
| 2 | 2 | // order that crates are documented in. |
| 3 | 3 | |
| 4 | use std::path::Path; | |
| 5 | ||
| 6 | use run_make_support::{diff, rustdoc}; | |
| 4 | use run_make_support::{diff, path, rustdoc}; | |
| 7 | 5 | |
| 8 | 6 | fn main() { |
| 9 | let foo_first = Path::new("foo_first"); | |
| 7 | let foo_first = path("foo_first"); | |
| 10 | 8 | rustdoc().input("foo.rs").out_dir(&foo_first).run(); |
| 11 | 9 | rustdoc().input("bar.rs").out_dir(&foo_first).run(); |
| 12 | 10 | |
| 13 | let bar_first = Path::new("bar_first"); | |
| 11 | let bar_first = path("bar_first"); | |
| 14 | 12 | rustdoc().input("bar.rs").out_dir(&bar_first).run(); |
| 15 | 13 | rustdoc().input("foo.rs").out_dir(&bar_first).run(); |
| 16 | 14 |
tests/run-make/rustdoc-output-path/rmake.rs+2-4| ... | ... | @@ -1,11 +1,9 @@ |
| 1 | 1 | // Checks that if the output folder doesn't exist, rustdoc will create it. |
| 2 | 2 | |
| 3 | use std::path::Path; | |
| 4 | ||
| 5 | use run_make_support::rustdoc; | |
| 3 | use run_make_support::{path, rustdoc}; | |
| 6 | 4 | |
| 7 | 5 | fn main() { |
| 8 | let out_dir = Path::new("foo/bar/doc"); | |
| 6 | let out_dir = path("foo/bar/doc"); | |
| 9 | 7 | rustdoc().input("foo.rs").out_dir(&out_dir).run(); |
| 10 | 8 | assert!(out_dir.exists()); |
| 11 | 9 | } |
tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | error: unexpected `--cfg fmt_debug="shallow"` flag | |
| 2 | | | |
| 3 | = note: config `fmt_debug` is only supposed to be controlled by `-Z fmt-debug` | |
| 4 | = note: manually setting a built-in cfg can and does create incoherent behaviors | |
| 5 | = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 |
tests/ui/cfg/disallowed-cli-cfgs.rs+2| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | //@ revisions: target_pointer_width_ target_vendor_ target_has_atomic_ |
| 7 | 7 | //@ revisions: target_has_atomic_equal_alignment_ target_has_atomic_load_store_ |
| 8 | 8 | //@ revisions: target_thread_local_ relocation_model_ |
| 9 | //@ revisions: fmt_debug_ | |
| 9 | 10 | |
| 10 | 11 | //@ [overflow_checks_]compile-flags: --cfg overflow_checks |
| 11 | 12 | //@ [debug_assertions_]compile-flags: --cfg debug_assertions |
| ... | ... | @@ -31,5 +32,6 @@ |
| 31 | 32 | //@ [target_has_atomic_load_store_]compile-flags: --cfg target_has_atomic_load_store="32" |
| 32 | 33 | //@ [target_thread_local_]compile-flags: --cfg target_thread_local |
| 33 | 34 | //@ [relocation_model_]compile-flags: --cfg relocation_model="a" |
| 35 | //@ [fmt_debug_]compile-flags: --cfg fmt_debug="shallow" | |
| 34 | 36 | |
| 35 | 37 | fn main() {} |
tests/ui/check-cfg/allow-same-level.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE` |
| 4 | 4 | LL | #[cfg(FALSE)] |
| 5 | 5 | | ^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(FALSE)` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/cargo-build-script.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo` |
| 4 | 4 | LL | #[cfg(has_foo)] |
| 5 | 5 | | ^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: consider using a Cargo feature instead |
| 9 | 9 | = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: |
| 10 | 10 | [lints.rust] |
tests/ui/check-cfg/cargo-feature.none.stderr+1-1| ... | ... | @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` |
| 25 | 25 | LL | #[cfg(tokio_unstable)] |
| 26 | 26 | | ^^^^^^^^^^^^^^ |
| 27 | 27 | | |
| 28 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 28 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 29 | 29 | = help: consider using a Cargo feature instead |
| 30 | 30 | = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: |
| 31 | 31 | [lints.rust] |
tests/ui/check-cfg/cargo-feature.some.stderr+1-1| ... | ... | @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` |
| 25 | 25 | LL | #[cfg(tokio_unstable)] |
| 26 | 26 | | ^^^^^^^^^^^^^^ |
| 27 | 27 | | |
| 28 | = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 28 | = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 29 | 29 | = help: consider using a Cargo feature instead |
| 30 | 30 | = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: |
| 31 | 31 | [lints.rust] |
tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` |
| 4 | 4 | LL | #[cfg(value)] |
| 5 | 5 | | ^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(value)` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` |
| 4 | 4 | LL | #[cfg(my_value)] |
| 5 | 5 | | ^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(my_value)` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/cfg-value-for-cfg-name.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `linux` |
| 4 | 4 | LL | #[cfg(linux)] |
| 5 | 5 | | ^^^^^ help: found config with similar value: `target_os = "linux"` |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(linux)` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/compact-names.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `target_architecture` |
| 4 | 4 | LL | #[cfg(target(os = "linux", architecture = "arm"))] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` |
| 4 | 4 | LL | #[cfg(unknown_key = "value")] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/exhaustive-names-values.feature.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` |
| 4 | 4 | LL | #[cfg(unknown_key = "value")] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/exhaustive-names-values.full.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` |
| 4 | 4 | LL | #[cfg(unknown_key = "value")] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/exhaustive-names.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` |
| 4 | 4 | LL | #[cfg(unknown_key = "value")] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/mix.stderr+1-1| ... | ... | @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` |
| 44 | 44 | LL | #[cfg_attr(uu, test)] |
| 45 | 45 | | ^^ |
| 46 | 46 | | |
| 47 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 47 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 48 | 48 | = help: to expect this configuration use `--check-cfg=cfg(uu)` |
| 49 | 49 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 50 | 50 |
tests/ui/check-cfg/stmt-no-ice.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `crossbeam_loom` |
| 4 | 4 | LL | #[cfg(crossbeam_loom)] |
| 5 | 5 | | ^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 7 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 8 | 8 | = help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)` |
| 9 | 9 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 10 | 10 | = note: `#[warn(unexpected_cfgs)]` on by default |
tests/ui/check-cfg/well-known-names.stderr+1-1| ... | ... | @@ -18,7 +18,7 @@ warning: unexpected `cfg` condition name: `features` |
| 18 | 18 | LL | #[cfg(features = "foo")] |
| 19 | 19 | | ^^^^^^^^^^^^^^^^ |
| 20 | 20 | | |
| 21 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 21 | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` | |
| 22 | 22 | = help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))` |
| 23 | 23 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 24 | 24 |
tests/ui/check-cfg/well-known-values.rs+3| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #![feature(cfg_target_has_atomic_equal_alignment)] |
| 17 | 17 | #![feature(cfg_target_thread_local)] |
| 18 | 18 | #![feature(cfg_ub_checks)] |
| 19 | #![feature(fmt_debug)] | |
| 19 | 20 | |
| 20 | 21 | // This part makes sure that none of the well known names are |
| 21 | 22 | // unexpected. |
| ... | ... | @@ -33,6 +34,8 @@ |
| 33 | 34 | //~^ WARN unexpected `cfg` condition value |
| 34 | 35 | doctest = "_UNEXPECTED_VALUE", |
| 35 | 36 | //~^ WARN unexpected `cfg` condition value |
| 37 | fmt_debug = "_UNEXPECTED_VALUE", | |
| 38 | //~^ WARN unexpected `cfg` condition value | |
| 36 | 39 | miri = "_UNEXPECTED_VALUE", |
| 37 | 40 | //~^ WARN unexpected `cfg` condition value |
| 38 | 41 | overflow_checks = "_UNEXPECTED_VALUE", |
tests/ui/check-cfg/well-known-values.stderr+39-30| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 2 | --> $DIR/well-known-values.rs:28:5 | |
| 2 | --> $DIR/well-known-values.rs:29:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | clippy = "_UNEXPECTED_VALUE", |
| 5 | 5 | | ^^^^^^---------------------- |
| ... | ... | @@ -11,7 +11,7 @@ LL | clippy = "_UNEXPECTED_VALUE", |
| 11 | 11 | = note: `#[warn(unexpected_cfgs)]` on by default |
| 12 | 12 | |
| 13 | 13 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 14 | --> $DIR/well-known-values.rs:30:5 | |
| 14 | --> $DIR/well-known-values.rs:31:5 | |
| 15 | 15 | | |
| 16 | 16 | LL | debug_assertions = "_UNEXPECTED_VALUE", |
| 17 | 17 | | ^^^^^^^^^^^^^^^^---------------------- |
| ... | ... | @@ -22,7 +22,7 @@ LL | debug_assertions = "_UNEXPECTED_VALUE", |
| 22 | 22 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 23 | 23 | |
| 24 | 24 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 25 | --> $DIR/well-known-values.rs:32:5 | |
| 25 | --> $DIR/well-known-values.rs:33:5 | |
| 26 | 26 | | |
| 27 | 27 | LL | doc = "_UNEXPECTED_VALUE", |
| 28 | 28 | | ^^^---------------------- |
| ... | ... | @@ -33,7 +33,7 @@ LL | doc = "_UNEXPECTED_VALUE", |
| 33 | 33 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 34 | 34 | |
| 35 | 35 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 36 | --> $DIR/well-known-values.rs:34:5 | |
| 36 | --> $DIR/well-known-values.rs:35:5 | |
| 37 | 37 | | |
| 38 | 38 | LL | doctest = "_UNEXPECTED_VALUE", |
| 39 | 39 | | ^^^^^^^---------------------- |
| ... | ... | @@ -44,7 +44,16 @@ LL | doctest = "_UNEXPECTED_VALUE", |
| 44 | 44 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 45 | 45 | |
| 46 | 46 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 47 | --> $DIR/well-known-values.rs:36:5 | |
| 47 | --> $DIR/well-known-values.rs:37:5 | |
| 48 | | | |
| 49 | LL | fmt_debug = "_UNEXPECTED_VALUE", | |
| 50 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 51 | | | |
| 52 | = note: expected values for `fmt_debug` are: `full`, `none`, and `shallow` | |
| 53 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | |
| 54 | ||
| 55 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` | |
| 56 | --> $DIR/well-known-values.rs:39:5 | |
| 48 | 57 | | |
| 49 | 58 | LL | miri = "_UNEXPECTED_VALUE", |
| 50 | 59 | | ^^^^---------------------- |
| ... | ... | @@ -55,7 +64,7 @@ LL | miri = "_UNEXPECTED_VALUE", |
| 55 | 64 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 56 | 65 | |
| 57 | 66 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 58 | --> $DIR/well-known-values.rs:38:5 | |
| 67 | --> $DIR/well-known-values.rs:41:5 | |
| 59 | 68 | | |
| 60 | 69 | LL | overflow_checks = "_UNEXPECTED_VALUE", |
| 61 | 70 | | ^^^^^^^^^^^^^^^---------------------- |
| ... | ... | @@ -66,7 +75,7 @@ LL | overflow_checks = "_UNEXPECTED_VALUE", |
| 66 | 75 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 67 | 76 | |
| 68 | 77 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 69 | --> $DIR/well-known-values.rs:40:5 | |
| 78 | --> $DIR/well-known-values.rs:43:5 | |
| 70 | 79 | | |
| 71 | 80 | LL | panic = "_UNEXPECTED_VALUE", |
| 72 | 81 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -75,7 +84,7 @@ LL | panic = "_UNEXPECTED_VALUE", |
| 75 | 84 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 76 | 85 | |
| 77 | 86 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 78 | --> $DIR/well-known-values.rs:42:5 | |
| 87 | --> $DIR/well-known-values.rs:45:5 | |
| 79 | 88 | | |
| 80 | 89 | LL | proc_macro = "_UNEXPECTED_VALUE", |
| 81 | 90 | | ^^^^^^^^^^---------------------- |
| ... | ... | @@ -86,7 +95,7 @@ LL | proc_macro = "_UNEXPECTED_VALUE", |
| 86 | 95 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 87 | 96 | |
| 88 | 97 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 89 | --> $DIR/well-known-values.rs:44:5 | |
| 98 | --> $DIR/well-known-values.rs:47:5 | |
| 90 | 99 | | |
| 91 | 100 | LL | relocation_model = "_UNEXPECTED_VALUE", |
| 92 | 101 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -95,7 +104,7 @@ LL | relocation_model = "_UNEXPECTED_VALUE", |
| 95 | 104 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 96 | 105 | |
| 97 | 106 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 98 | --> $DIR/well-known-values.rs:46:5 | |
| 107 | --> $DIR/well-known-values.rs:49:5 | |
| 99 | 108 | | |
| 100 | 109 | LL | rustfmt = "_UNEXPECTED_VALUE", |
| 101 | 110 | | ^^^^^^^---------------------- |
| ... | ... | @@ -106,7 +115,7 @@ LL | rustfmt = "_UNEXPECTED_VALUE", |
| 106 | 115 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 107 | 116 | |
| 108 | 117 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 109 | --> $DIR/well-known-values.rs:48:5 | |
| 118 | --> $DIR/well-known-values.rs:51:5 | |
| 110 | 119 | | |
| 111 | 120 | LL | sanitize = "_UNEXPECTED_VALUE", |
| 112 | 121 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -115,7 +124,7 @@ LL | sanitize = "_UNEXPECTED_VALUE", |
| 115 | 124 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 116 | 125 | |
| 117 | 126 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 118 | --> $DIR/well-known-values.rs:50:5 | |
| 127 | --> $DIR/well-known-values.rs:53:5 | |
| 119 | 128 | | |
| 120 | 129 | LL | target_abi = "_UNEXPECTED_VALUE", |
| 121 | 130 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -124,7 +133,7 @@ LL | target_abi = "_UNEXPECTED_VALUE", |
| 124 | 133 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 125 | 134 | |
| 126 | 135 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 127 | --> $DIR/well-known-values.rs:52:5 | |
| 136 | --> $DIR/well-known-values.rs:55:5 | |
| 128 | 137 | | |
| 129 | 138 | LL | target_arch = "_UNEXPECTED_VALUE", |
| 130 | 139 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -133,7 +142,7 @@ LL | target_arch = "_UNEXPECTED_VALUE", |
| 133 | 142 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 134 | 143 | |
| 135 | 144 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 136 | --> $DIR/well-known-values.rs:54:5 | |
| 145 | --> $DIR/well-known-values.rs:57:5 | |
| 137 | 146 | | |
| 138 | 147 | LL | target_endian = "_UNEXPECTED_VALUE", |
| 139 | 148 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -142,7 +151,7 @@ LL | target_endian = "_UNEXPECTED_VALUE", |
| 142 | 151 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 143 | 152 | |
| 144 | 153 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 145 | --> $DIR/well-known-values.rs:56:5 | |
| 154 | --> $DIR/well-known-values.rs:59:5 | |
| 146 | 155 | | |
| 147 | 156 | LL | target_env = "_UNEXPECTED_VALUE", |
| 148 | 157 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -151,7 +160,7 @@ LL | target_env = "_UNEXPECTED_VALUE", |
| 151 | 160 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 152 | 161 | |
| 153 | 162 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 154 | --> $DIR/well-known-values.rs:58:5 | |
| 163 | --> $DIR/well-known-values.rs:61:5 | |
| 155 | 164 | | |
| 156 | 165 | LL | target_family = "_UNEXPECTED_VALUE", |
| 157 | 166 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -160,7 +169,7 @@ LL | target_family = "_UNEXPECTED_VALUE", |
| 160 | 169 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 161 | 170 | |
| 162 | 171 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 163 | --> $DIR/well-known-values.rs:60:5 | |
| 172 | --> $DIR/well-known-values.rs:63:5 | |
| 164 | 173 | | |
| 165 | 174 | LL | target_feature = "_UNEXPECTED_VALUE", |
| 166 | 175 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -169,7 +178,7 @@ LL | target_feature = "_UNEXPECTED_VALUE", |
| 169 | 178 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 170 | 179 | |
| 171 | 180 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 172 | --> $DIR/well-known-values.rs:62:5 | |
| 181 | --> $DIR/well-known-values.rs:65:5 | |
| 173 | 182 | | |
| 174 | 183 | LL | target_has_atomic = "_UNEXPECTED_VALUE", |
| 175 | 184 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -178,7 +187,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE", |
| 178 | 187 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 179 | 188 | |
| 180 | 189 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 181 | --> $DIR/well-known-values.rs:64:5 | |
| 190 | --> $DIR/well-known-values.rs:67:5 | |
| 182 | 191 | | |
| 183 | 192 | LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", |
| 184 | 193 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -187,7 +196,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", |
| 187 | 196 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 188 | 197 | |
| 189 | 198 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 190 | --> $DIR/well-known-values.rs:66:5 | |
| 199 | --> $DIR/well-known-values.rs:69:5 | |
| 191 | 200 | | |
| 192 | 201 | LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", |
| 193 | 202 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -196,7 +205,7 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", |
| 196 | 205 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 197 | 206 | |
| 198 | 207 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 199 | --> $DIR/well-known-values.rs:68:5 | |
| 208 | --> $DIR/well-known-values.rs:71:5 | |
| 200 | 209 | | |
| 201 | 210 | LL | target_os = "_UNEXPECTED_VALUE", |
| 202 | 211 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -205,7 +214,7 @@ LL | target_os = "_UNEXPECTED_VALUE", |
| 205 | 214 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 206 | 215 | |
| 207 | 216 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 208 | --> $DIR/well-known-values.rs:70:5 | |
| 217 | --> $DIR/well-known-values.rs:73:5 | |
| 209 | 218 | | |
| 210 | 219 | LL | target_pointer_width = "_UNEXPECTED_VALUE", |
| 211 | 220 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -214,7 +223,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE", |
| 214 | 223 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 215 | 224 | |
| 216 | 225 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 217 | --> $DIR/well-known-values.rs:72:5 | |
| 226 | --> $DIR/well-known-values.rs:75:5 | |
| 218 | 227 | | |
| 219 | 228 | LL | target_thread_local = "_UNEXPECTED_VALUE", |
| 220 | 229 | | ^^^^^^^^^^^^^^^^^^^---------------------- |
| ... | ... | @@ -225,7 +234,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE", |
| 225 | 234 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 226 | 235 | |
| 227 | 236 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 228 | --> $DIR/well-known-values.rs:74:5 | |
| 237 | --> $DIR/well-known-values.rs:77:5 | |
| 229 | 238 | | |
| 230 | 239 | LL | target_vendor = "_UNEXPECTED_VALUE", |
| 231 | 240 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -234,7 +243,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE", |
| 234 | 243 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 235 | 244 | |
| 236 | 245 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 237 | --> $DIR/well-known-values.rs:76:5 | |
| 246 | --> $DIR/well-known-values.rs:79:5 | |
| 238 | 247 | | |
| 239 | 248 | LL | test = "_UNEXPECTED_VALUE", |
| 240 | 249 | | ^^^^---------------------- |
| ... | ... | @@ -245,7 +254,7 @@ LL | test = "_UNEXPECTED_VALUE", |
| 245 | 254 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 246 | 255 | |
| 247 | 256 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 248 | --> $DIR/well-known-values.rs:78:5 | |
| 257 | --> $DIR/well-known-values.rs:81:5 | |
| 249 | 258 | | |
| 250 | 259 | LL | ub_checks = "_UNEXPECTED_VALUE", |
| 251 | 260 | | ^^^^^^^^^---------------------- |
| ... | ... | @@ -256,7 +265,7 @@ LL | ub_checks = "_UNEXPECTED_VALUE", |
| 256 | 265 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 257 | 266 | |
| 258 | 267 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 259 | --> $DIR/well-known-values.rs:80:5 | |
| 268 | --> $DIR/well-known-values.rs:83:5 | |
| 260 | 269 | | |
| 261 | 270 | LL | unix = "_UNEXPECTED_VALUE", |
| 262 | 271 | | ^^^^---------------------- |
| ... | ... | @@ -267,7 +276,7 @@ LL | unix = "_UNEXPECTED_VALUE", |
| 267 | 276 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 268 | 277 | |
| 269 | 278 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 270 | --> $DIR/well-known-values.rs:82:5 | |
| 279 | --> $DIR/well-known-values.rs:85:5 | |
| 271 | 280 | | |
| 272 | 281 | LL | windows = "_UNEXPECTED_VALUE", |
| 273 | 282 | | ^^^^^^^---------------------- |
| ... | ... | @@ -278,7 +287,7 @@ LL | windows = "_UNEXPECTED_VALUE", |
| 278 | 287 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 279 | 288 | |
| 280 | 289 | warning: unexpected `cfg` condition value: `linuz` |
| 281 | --> $DIR/well-known-values.rs:88:7 | |
| 290 | --> $DIR/well-known-values.rs:91:7 | |
| 282 | 291 | | |
| 283 | 292 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` |
| 284 | 293 | | ^^^^^^^^^^^^------- |
| ... | ... | @@ -288,5 +297,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` |
| 288 | 297 | = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` |
| 289 | 298 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 290 | 299 | |
| 291 | warning: 29 warnings emitted | |
| 300 | warning: 30 warnings emitted | |
| 292 | 301 |
tests/ui/feature-gates/feature-gate-fmt-debug.rs created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | #[cfg(fmt_debug = "full")] | |
| 2 | //~^ ERROR is experimental | |
| 3 | fn main() { | |
| 4 | ||
| 5 | } |
tests/ui/feature-gates/feature-gate-fmt-debug.stderr created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | error[E0658]: `cfg(fmt_debug)` is experimental and subject to change | |
| 2 | --> $DIR/feature-gate-fmt-debug.rs:1:7 | |
| 3 | | | |
| 4 | LL | #[cfg(fmt_debug = "full")] | |
| 5 | | ^^^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: see issue #129709 <https://github.com/rust-lang/rust/issues/129709> for more information | |
| 8 | = help: add `#![feature(fmt_debug)]` to the crate attributes to enable | |
| 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 10 | ||
| 11 | error: aborting due to 1 previous error | |
| 12 | ||
| 13 | For more information about this error, try `rustc --explain E0658`. |
tests/ui/fmt/fmt_debug/full.rs created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | //@ compile-flags: -Zfmt-debug=full | |
| 2 | //@ run-pass | |
| 3 | #![feature(fmt_debug)] | |
| 4 | #![allow(dead_code)] | |
| 5 | #![allow(unused)] | |
| 6 | ||
| 7 | #[derive(Debug)] | |
| 8 | struct Foo { | |
| 9 | bar: u32, | |
| 10 | } | |
| 11 | ||
| 12 | fn main() { | |
| 13 | let s = format!("Still works: {:?} '{:?}'", cfg!(fmt_debug = "full"), Foo { bar: 1 }); | |
| 14 | assert_eq!("Still works: true 'Foo { bar: 1 }'", s); | |
| 15 | } |
tests/ui/fmt/fmt_debug/invalid.rs created+4| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | //@ compile-flags: -Zfmt-debug=invalid-value | |
| 2 | //@ failure-status: 1 | |
| 3 | fn main() { | |
| 4 | } |
tests/ui/fmt/fmt_debug/invalid.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: incorrect value `invalid-value` for unstable option `fmt-debug` - either `full`, `shallow`, or `none` was expected | |
| 2 |
tests/ui/fmt/fmt_debug/none.rs created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | //@ compile-flags: -Zfmt-debug=none | |
| 2 | //@ run-pass | |
| 3 | #![feature(fmt_debug)] | |
| 4 | #![allow(dead_code)] | |
| 5 | #![allow(unused)] | |
| 6 | ||
| 7 | #[derive(Debug)] | |
| 8 | struct Foo { | |
| 9 | bar: u32, | |
| 10 | } | |
| 11 | ||
| 12 | #[derive(Debug)] | |
| 13 | enum Baz { | |
| 14 | Quz, | |
| 15 | } | |
| 16 | ||
| 17 | #[cfg(fmt_debug = "full")] | |
| 18 | compile_error!("nope"); | |
| 19 | ||
| 20 | #[cfg(fmt_debug = "none")] | |
| 21 | struct Custom; | |
| 22 | ||
| 23 | impl std::fmt::Debug for Custom { | |
| 24 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | |
| 25 | f.write_str("custom_fmt") | |
| 26 | } | |
| 27 | } | |
| 28 | ||
| 29 | fn main() { | |
| 30 | let c = Custom; | |
| 31 | let s = format!("Debug is '{:?}', '{:#?}', and '{c:?}'", Foo { bar: 1 }, Baz::Quz); | |
| 32 | assert_eq!("Debug is '', '', and ''", s); | |
| 33 | ||
| 34 | let f = 3.0; | |
| 35 | let s = format_args!("{:?}x{:#?}y{f:?}", 1234, "can't debug this").to_string(); | |
| 36 | assert_eq!("xy", s); | |
| 37 | } |
tests/ui/fmt/fmt_debug/shallow.rs created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | //@ compile-flags: -Zfmt-debug=shallow | |
| 2 | //@ run-pass | |
| 3 | #![feature(fmt_debug)] | |
| 4 | #![allow(dead_code)] | |
| 5 | #![allow(unused)] | |
| 6 | ||
| 7 | #[derive(Debug)] | |
| 8 | struct Foo { | |
| 9 | bar: u32, | |
| 10 | bomb: Bomb, | |
| 11 | } | |
| 12 | ||
| 13 | #[derive(Debug)] | |
| 14 | enum Baz { | |
| 15 | Quz, | |
| 16 | } | |
| 17 | ||
| 18 | struct Bomb; | |
| 19 | ||
| 20 | impl std::fmt::Debug for Bomb { | |
| 21 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | |
| 22 | panic!() | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | fn main() { | |
| 27 | let s = format!("Debug is '{:?}' and '{:#?}'", Foo { bar: 1, bomb: Bomb }, Baz::Quz); | |
| 28 | assert_eq!("Debug is 'Foo' and 'Quz'", s); | |
| 29 | ||
| 30 | let f = 3.0; | |
| 31 | let s = format_args!("{:?}{:#?}{f:?}", 1234, cfg!(fmt_debug = "shallow")).to_string(); | |
| 32 | assert_eq!("1234true3.0", s); | |
| 33 | } |