Skip to main content

rustc_hir_typeck/
lib.rs

1// tidy-alphabetical-start
2#![feature(assert_matches)]
3#![feature(box_patterns)]
4#![feature(if_let_guard)]
5#![feature(iter_intersperse)]
6#![feature(iter_order_by)]
7#![feature(never_type)]
8#![feature(trim_prefix_suffix)]
9// tidy-alphabetical-end
10
11mod _match;
12mod autoderef;
13mod callee;
14// Used by clippy;
15pub mod cast;
16mod check;
17mod closure;
18mod coercion;
19mod demand;
20mod diverges;
21mod errors;
22mod expectation;
23mod expr;
24mod inline_asm;
25// Used by clippy;
26pub mod expr_use_visitor;
27mod fallback;
28mod fn_ctxt;
29mod gather_locals;
30mod intrinsicck;
31mod loops;
32mod method;
33mod naked_functions;
34mod op;
35mod opaque_types;
36mod pat;
37mod place_op;
38mod typeck_root_ctxt;
39mod upvar;
40mod writeback;
41
42pub use coercion::can_coerce;
43use fn_ctxt::FnCtxt;
44use rustc_data_structures::unord::UnordSet;
45use rustc_errors::codes::*;
46use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
47use rustc_hir as hir;
48use rustc_hir::def::{DefKind, Res};
49use rustc_hir::{HirId, HirIdMap, Node};
50use rustc_hir_analysis::check::{check_abi, check_custom_abi};
51use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer;
52use rustc_infer::traits::{ObligationCauseCode, ObligationInspector, WellFormedLoc};
53use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
54use rustc_middle::query::Providers;
55use rustc_middle::ty::{self, Ty, TyCtxt};
56use rustc_middle::{bug, span_bug};
57use rustc_session::config;
58use rustc_span::Span;
59use rustc_span::def_id::LocalDefId;
60use tracing::{debug, instrument};
61use typeck_root_ctxt::TypeckRootCtxt;
62
63use crate::check::check_fn;
64use crate::coercion::CoerceMany;
65use crate::diverges::Diverges;
66use crate::expectation::Expectation;
67use crate::fn_ctxt::LoweredTy;
68use crate::gather_locals::GatherLocalsVisitor;
69
70#[allow(non_upper_case_globals)]
#[doc(hidden)]
#[doc =
r" Auto-generated constants for type-checked references to Fluent messages."]
pub(crate) mod fluent_generated {
    #[doc =
    "Constant referring to Fluent message `hir_typeck_abi_cannot_be_called` from `hir_typeck`"]
    pub const hir_typeck_abi_cannot_be_called: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_abi_cannot_be_called"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_abi_cannot_be_called.note` from `hir_typeck`"]
    pub const hir_typeck_note: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("note"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_add_missing_parentheses_in_range` from `hir_typeck`"]
    pub const hir_typeck_add_missing_parentheses_in_range:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_add_missing_parentheses_in_range"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_add_return_type_add` from `hir_typeck`"]
    pub const hir_typeck_add_return_type_add: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_add_return_type_add"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_add_return_type_missing_here` from `hir_typeck`"]
    pub const hir_typeck_add_return_type_missing_here:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_add_return_type_missing_here"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_address_of_temporary_taken` from `hir_typeck`"]
    pub const hir_typeck_address_of_temporary_taken: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_address_of_temporary_taken"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_address_of_temporary_taken.label` from `hir_typeck`"]
    pub const hir_typeck_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_arg_mismatch_indeterminate` from `hir_typeck`"]
    pub const hir_typeck_arg_mismatch_indeterminate: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_arg_mismatch_indeterminate"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_as_deref_suggestion` from `hir_typeck`"]
    pub const hir_typeck_as_deref_suggestion: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_as_deref_suggestion"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_base_expression_double_dot` from `hir_typeck`"]
    pub const hir_typeck_base_expression_double_dot: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_base_expression_double_dot"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_base_expression_double_dot_add_expr` from `hir_typeck`"]
    pub const hir_typeck_base_expression_double_dot_add_expr:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_base_expression_double_dot_add_expr"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_base_expression_double_dot_enable_default_field_values` from `hir_typeck`"]
    pub const
        hir_typeck_base_expression_double_dot_enable_default_field_values:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_base_expression_double_dot_enable_default_field_values"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_base_expression_double_dot_remove` from `hir_typeck`"]
    pub const hir_typeck_base_expression_double_dot_remove:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_base_expression_double_dot_remove"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_inside_closure` from `hir_typeck`"]
    pub const hir_typeck_break_inside_closure: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_break_inside_closure"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_inside_closure.closure_label` from `hir_typeck`"]
    pub const hir_typeck_closure_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("closure_label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_inside_coroutine` from `hir_typeck`"]
    pub const hir_typeck_break_inside_coroutine: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_break_inside_coroutine"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_inside_coroutine.coroutine_label` from `hir_typeck`"]
    pub const hir_typeck_coroutine_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("coroutine_label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_non_loop` from `hir_typeck`"]
    pub const hir_typeck_break_non_loop: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_break_non_loop"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_non_loop.label2` from `hir_typeck`"]
    pub const hir_typeck_label2: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label2"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_non_loop.suggestion` from `hir_typeck`"]
    pub const hir_typeck_suggestion: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("suggestion"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_break_non_loop.break_expr_suggestion` from `hir_typeck`"]
    pub const hir_typeck_break_expr_suggestion: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("break_expr_suggestion"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_candidate_trait_note` from `hir_typeck`"]
    pub const hir_typeck_candidate_trait_note: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_candidate_trait_note"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cannot_cast_to_bool` from `hir_typeck`"]
    pub const hir_typeck_cannot_cast_to_bool: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_cannot_cast_to_bool"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cannot_cast_to_bool.help` from `hir_typeck`"]
    pub const hir_typeck_help: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("help"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cant_dereference` from `hir_typeck`"]
    pub const hir_typeck_cant_dereference: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_cant_dereference"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cant_dereference_label` from `hir_typeck`"]
    pub const hir_typeck_cant_dereference_label: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_cant_dereference_label"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cast_enum_drop` from `hir_typeck`"]
    pub const hir_typeck_cast_enum_drop: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_cast_enum_drop"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cast_thin_pointer_to_wide_pointer` from `hir_typeck`"]
    pub const hir_typeck_cast_thin_pointer_to_wide_pointer:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_cast_thin_pointer_to_wide_pointer"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cast_thin_pointer_to_wide_pointer.teach_help` from `hir_typeck`"]
    pub const hir_typeck_teach_help: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("teach_help"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cast_unknown_pointer` from `hir_typeck`"]
    pub const hir_typeck_cast_unknown_pointer: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_cast_unknown_pointer"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cast_unknown_pointer.label_to` from `hir_typeck`"]
    pub const hir_typeck_label_to: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label_to"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_cast_unknown_pointer.label_from` from `hir_typeck`"]
    pub const hir_typeck_label_from: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label_from"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_const_continue_bad_label` from `hir_typeck`"]
    pub const hir_typeck_const_continue_bad_label: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_const_continue_bad_label"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_continue_labeled_block` from `hir_typeck`"]
    pub const hir_typeck_continue_labeled_block: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_continue_labeled_block"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_continue_labeled_block.block_label` from `hir_typeck`"]
    pub const hir_typeck_block_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("block_label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_convert_to_str` from `hir_typeck`"]
    pub const hir_typeck_convert_to_str: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_convert_to_str"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_convert_using_method` from `hir_typeck`"]
    pub const hir_typeck_convert_using_method: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_convert_using_method"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_ctor_is_private` from `hir_typeck`"]
    pub const hir_typeck_ctor_is_private: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_ctor_is_private"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_dependency_on_unit_never_type_fallback` from `hir_typeck`"]
    pub const hir_typeck_dependency_on_unit_never_type_fallback:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_dependency_on_unit_never_type_fallback"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_deref_is_empty` from `hir_typeck`"]
    pub const hir_typeck_deref_is_empty: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_deref_is_empty"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_expected_array_or_slice` from `hir_typeck`"]
    pub const hir_typeck_expected_array_or_slice: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_expected_array_or_slice"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_expected_array_or_slice_label` from `hir_typeck`"]
    pub const hir_typeck_expected_array_or_slice_label:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_expected_array_or_slice_label"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_expected_default_return_type` from `hir_typeck`"]
    pub const hir_typeck_expected_default_return_type:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_expected_default_return_type"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_expected_return_type` from `hir_typeck`"]
    pub const hir_typeck_expected_return_type: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_expected_return_type"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_explicit_destructor` from `hir_typeck`"]
    pub const hir_typeck_explicit_destructor: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_explicit_destructor"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_field_multiply_specified_in_initializer` from `hir_typeck`"]
    pub const hir_typeck_field_multiply_specified_in_initializer:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_field_multiply_specified_in_initializer"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_field_multiply_specified_in_initializer.previous_use_label` from `hir_typeck`"]
    pub const hir_typeck_previous_use_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("previous_use_label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_fn_item_to_variadic_function` from `hir_typeck`"]
    pub const hir_typeck_fn_item_to_variadic_function:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_fn_item_to_variadic_function"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_fru_expr` from `hir_typeck`"]
    pub const hir_typeck_fru_expr: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_fru_expr"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_fru_expr2` from `hir_typeck`"]
    pub const hir_typeck_fru_expr2: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_fru_expr2"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_fru_note` from `hir_typeck`"]
    pub const hir_typeck_fru_note: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_fru_note"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_fru_suggestion` from `hir_typeck`"]
    pub const hir_typeck_fru_suggestion: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_fru_suggestion"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_functional_record_update_on_non_struct` from `hir_typeck`"]
    pub const hir_typeck_functional_record_update_on_non_struct:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_functional_record_update_on_non_struct"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_gpu_kernel_abi_cannot_be_called` from `hir_typeck`"]
    pub const hir_typeck_gpu_kernel_abi_cannot_be_called:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_gpu_kernel_abi_cannot_be_called"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_help_set_edition_cargo` from `hir_typeck`"]
    pub const hir_typeck_help_set_edition_cargo: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_help_set_edition_cargo"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_help_set_edition_standalone` from `hir_typeck`"]
    pub const hir_typeck_help_set_edition_standalone:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_help_set_edition_standalone"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_int_to_fat` from `hir_typeck`"]
    pub const hir_typeck_int_to_fat: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_int_to_fat"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_int_to_fat_label` from `hir_typeck`"]
    pub const hir_typeck_int_to_fat_label: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_int_to_fat_label"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_int_to_fat_label_nightly` from `hir_typeck`"]
    pub const hir_typeck_int_to_fat_label_nightly: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_int_to_fat_label_nightly"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_invalid_callee` from `hir_typeck`"]
    pub const hir_typeck_invalid_callee: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_invalid_callee"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_invalid_defined` from `hir_typeck`"]
    pub const hir_typeck_invalid_defined: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_invalid_defined"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_invalid_defined_kind` from `hir_typeck`"]
    pub const hir_typeck_invalid_defined_kind: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_invalid_defined_kind"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_invalid_fn_defined` from `hir_typeck`"]
    pub const hir_typeck_invalid_fn_defined: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_invalid_fn_defined"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_invalid_local` from `hir_typeck`"]
    pub const hir_typeck_invalid_local: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_invalid_local"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_lossy_provenance_int2ptr` from `hir_typeck`"]
    pub const hir_typeck_lossy_provenance_int2ptr: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_lossy_provenance_int2ptr"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_lossy_provenance_ptr2int` from `hir_typeck`"]
    pub const hir_typeck_lossy_provenance_ptr2int: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_lossy_provenance_ptr2int"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_missing_parentheses_in_range` from `hir_typeck`"]
    pub const hir_typeck_missing_parentheses_in_range:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_missing_parentheses_in_range"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_naked_asm_outside_naked_fn` from `hir_typeck`"]
    pub const hir_typeck_naked_asm_outside_naked_fn: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_naked_asm_outside_naked_fn"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_naked_functions_asm_block` from `hir_typeck`"]
    pub const hir_typeck_naked_functions_asm_block: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_naked_functions_asm_block"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_naked_functions_asm_block.label_multiple_asm` from `hir_typeck`"]
    pub const hir_typeck_label_multiple_asm: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label_multiple_asm"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_naked_functions_asm_block.label_non_asm` from `hir_typeck`"]
    pub const hir_typeck_label_non_asm: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label_non_asm"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_naked_functions_must_naked_asm` from `hir_typeck`"]
    pub const hir_typeck_naked_functions_must_naked_asm:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_naked_functions_must_naked_asm"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_never_type_fallback_flowing_into_unsafe_call` from `hir_typeck`"]
    pub const hir_typeck_never_type_fallback_flowing_into_unsafe_call:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_never_type_fallback_flowing_into_unsafe_call"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_never_type_fallback_flowing_into_unsafe_deref` from `hir_typeck`"]
    pub const hir_typeck_never_type_fallback_flowing_into_unsafe_deref:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_never_type_fallback_flowing_into_unsafe_deref"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_never_type_fallback_flowing_into_unsafe_method` from `hir_typeck`"]
    pub const hir_typeck_never_type_fallback_flowing_into_unsafe_method:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_never_type_fallback_flowing_into_unsafe_method"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_never_type_fallback_flowing_into_unsafe_path` from `hir_typeck`"]
    pub const hir_typeck_never_type_fallback_flowing_into_unsafe_path:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_never_type_fallback_flowing_into_unsafe_path"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_never_type_fallback_flowing_into_unsafe_union_field` from `hir_typeck`"]
    pub const hir_typeck_never_type_fallback_flowing_into_unsafe_union_field:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_never_type_fallback_flowing_into_unsafe_union_field"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_no_associated_item` from `hir_typeck`"]
    pub const hir_typeck_no_associated_item: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_no_associated_item"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_no_field_on_type` from `hir_typeck`"]
    pub const hir_typeck_no_field_on_type: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_no_field_on_type"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_no_field_on_variant` from `hir_typeck`"]
    pub const hir_typeck_no_field_on_variant: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_no_field_on_variant"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_no_field_on_variant_enum` from `hir_typeck`"]
    pub const hir_typeck_no_field_on_variant_enum: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_no_field_on_variant_enum"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_no_field_on_variant_field` from `hir_typeck`"]
    pub const hir_typeck_no_field_on_variant_field: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_no_field_on_variant_field"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_no_patterns` from `hir_typeck`"]
    pub const hir_typeck_no_patterns: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_no_patterns"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_note_caller_chooses_ty_for_ty_param` from `hir_typeck`"]
    pub const hir_typeck_note_caller_chooses_ty_for_ty_param:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_note_caller_chooses_ty_for_ty_param"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_note_edition_guide` from `hir_typeck`"]
    pub const hir_typeck_note_edition_guide: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_note_edition_guide"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_option_result_asref` from `hir_typeck`"]
    pub const hir_typeck_option_result_asref: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_option_result_asref"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_option_result_cloned` from `hir_typeck`"]
    pub const hir_typeck_option_result_cloned: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_option_result_cloned"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_option_result_copied` from `hir_typeck`"]
    pub const hir_typeck_option_result_copied: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_option_result_copied"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_outside_loop` from `hir_typeck`"]
    pub const hir_typeck_outside_loop: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_outside_loop"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_outside_loop_suggestion` from `hir_typeck`"]
    pub const hir_typeck_outside_loop_suggestion: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_outside_loop_suggestion"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_params_not_allowed` from `hir_typeck`"]
    pub const hir_typeck_params_not_allowed: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_params_not_allowed"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_pass_to_variadic_function` from `hir_typeck`"]
    pub const hir_typeck_pass_to_variadic_function: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_pass_to_variadic_function"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_project_on_non_pin_project_type` from `hir_typeck`"]
    pub const hir_typeck_project_on_non_pin_project_type:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_project_on_non_pin_project_type"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_ptr_cast_add_auto_to_object` from `hir_typeck`"]
    pub const hir_typeck_ptr_cast_add_auto_to_object:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_ptr_cast_add_auto_to_object"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_register_type_unstable` from `hir_typeck`"]
    pub const hir_typeck_register_type_unstable: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_register_type_unstable"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_remove_semi_for_coerce` from `hir_typeck`"]
    pub const hir_typeck_remove_semi_for_coerce: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_remove_semi_for_coerce"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_remove_semi_for_coerce_expr` from `hir_typeck`"]
    pub const hir_typeck_remove_semi_for_coerce_expr:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_remove_semi_for_coerce_expr"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_remove_semi_for_coerce_ret` from `hir_typeck`"]
    pub const hir_typeck_remove_semi_for_coerce_ret: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_remove_semi_for_coerce_ret"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_remove_semi_for_coerce_semi` from `hir_typeck`"]
    pub const hir_typeck_remove_semi_for_coerce_semi:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_remove_semi_for_coerce_semi"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_remove_semi_for_coerce_suggestion` from `hir_typeck`"]
    pub const hir_typeck_remove_semi_for_coerce_suggestion:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_remove_semi_for_coerce_suggestion"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_replace_comma_with_semicolon` from `hir_typeck`"]
    pub const hir_typeck_replace_comma_with_semicolon:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_replace_comma_with_semicolon"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_return_stmt_outside_of_fn_body` from `hir_typeck`"]
    pub const hir_typeck_return_stmt_outside_of_fn_body:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_return_stmt_outside_of_fn_body"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_return_stmt_outside_of_fn_body.encl_body_label` from `hir_typeck`"]
    pub const hir_typeck_encl_body_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("encl_body_label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_return_stmt_outside_of_fn_body.encl_fn_label` from `hir_typeck`"]
    pub const hir_typeck_encl_fn_label: rustc_errors::SubdiagMessage =
        rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("encl_fn_label"));
    #[doc =
    "Constant referring to Fluent message `hir_typeck_rpit_box_return_expr` from `hir_typeck`"]
    pub const hir_typeck_rpit_box_return_expr: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_rpit_box_return_expr"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_rpit_change_return_type` from `hir_typeck`"]
    pub const hir_typeck_rpit_change_return_type: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_rpit_change_return_type"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_rustcall_incorrect_args` from `hir_typeck`"]
    pub const hir_typeck_rustcall_incorrect_args: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_rustcall_incorrect_args"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_self_ctor_from_outer_item` from `hir_typeck`"]
    pub const hir_typeck_self_ctor_from_outer_item: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_self_ctor_from_outer_item"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_self_ctor_from_outer_item_inner_item` from `hir_typeck`"]
    pub const hir_typeck_self_ctor_from_outer_item_inner_item:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_self_ctor_from_outer_item_inner_item"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_slicing_suggestion` from `hir_typeck`"]
    pub const hir_typeck_slicing_suggestion: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_slicing_suggestion"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_struct_expr_non_exhaustive` from `hir_typeck`"]
    pub const hir_typeck_struct_expr_non_exhaustive: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_struct_expr_non_exhaustive"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_suggest_boxing_note` from `hir_typeck`"]
    pub const hir_typeck_suggest_boxing_note: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_suggest_boxing_note"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_suggest_boxing_when_appropriate` from `hir_typeck`"]
    pub const hir_typeck_suggest_boxing_when_appropriate:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_suggest_boxing_when_appropriate"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_suggest_ptr_null_mut` from `hir_typeck`"]
    pub const hir_typeck_suggest_ptr_null_mut: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_suggest_ptr_null_mut"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_supertrait_item_multiple_shadowee` from `hir_typeck`"]
    pub const hir_typeck_supertrait_item_multiple_shadowee:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_supertrait_item_multiple_shadowee"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_supertrait_item_shadowee` from `hir_typeck`"]
    pub const hir_typeck_supertrait_item_shadowee: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_supertrait_item_shadowee"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_supertrait_item_shadower` from `hir_typeck`"]
    pub const hir_typeck_supertrait_item_shadower: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_supertrait_item_shadower"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_supertrait_item_shadowing` from `hir_typeck`"]
    pub const hir_typeck_supertrait_item_shadowing: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_supertrait_item_shadowing"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_trivial_cast` from `hir_typeck`"]
    pub const hir_typeck_trivial_cast: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_trivial_cast"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_union_pat_dotdot` from `hir_typeck`"]
    pub const hir_typeck_union_pat_dotdot: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_union_pat_dotdot"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_union_pat_multiple_fields` from `hir_typeck`"]
    pub const hir_typeck_union_pat_multiple_fields: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_union_pat_multiple_fields"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_unlabeled_cf_in_while_condition` from `hir_typeck`"]
    pub const hir_typeck_unlabeled_cf_in_while_condition:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_unlabeled_cf_in_while_condition"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_unlabeled_in_labeled_block` from `hir_typeck`"]
    pub const hir_typeck_unlabeled_in_labeled_block: rustc_errors::DiagMessage
        =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_unlabeled_in_labeled_block"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_use_is_empty` from `hir_typeck`"]
    pub const hir_typeck_use_is_empty: rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_use_is_empty"),
            None);
    #[doc =
    "Constant referring to Fluent message `hir_typeck_yield_expr_outside_of_coroutine` from `hir_typeck`"]
    pub const hir_typeck_yield_expr_outside_of_coroutine:
        rustc_errors::DiagMessage =
        rustc_errors::DiagMessage::FluentIdentifier(std::borrow::Cow::Borrowed("hir_typeck_yield_expr_outside_of_coroutine"),
            None);
    #[doc =
    r" Constants expected to exist by the diagnostic derive macros to use as default Fluent"]
    #[doc = r" identifiers for different subdiagnostic kinds."]
    pub mod _subdiag {
        #[doc = r" Default for `#[help]`"]
        pub const help: rustc_errors::SubdiagMessage =
            rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("help"));
        #[doc = r" Default for `#[note]`"]
        pub const note: rustc_errors::SubdiagMessage =
            rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("note"));
        #[doc = r" Default for `#[warn]`"]
        pub const warn: rustc_errors::SubdiagMessage =
            rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("warn"));
        #[doc = r" Default for `#[label]`"]
        pub const label: rustc_errors::SubdiagMessage =
            rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("label"));
        #[doc = r" Default for `#[suggestion]`"]
        pub const suggestion: rustc_errors::SubdiagMessage =
            rustc_errors::SubdiagMessage::FluentAttr(std::borrow::Cow::Borrowed("suggestion"));
    }
}rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
71
72#[macro_export]
73macro_rules! type_error_struct {
74    ($dcx:expr, $span:expr, $typ:expr, $code:expr, $($message:tt)*) => ({
75        let mut err = rustc_errors::struct_span_code_err!($dcx, $span, $code, $($message)*);
76
77        if $typ.references_error() {
78            err.downgrade_to_delayed_bug();
79        }
80
81        err
82    })
83}
84
85fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDefId> {
86    &tcx.typeck(def_id).used_trait_imports
87}
88
89fn typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
90    typeck_with_inspect(tcx, def_id, None)
91}
92
93/// Same as `typeck` but `inspect` is invoked on evaluation of each root obligation.
94/// Inspecting obligations only works with the new trait solver.
95/// This function is *only to be used* by external tools, it should not be
96/// called from within rustc. Note, this is not a query, and thus is not cached.
97pub fn inspect_typeck<'tcx>(
98    tcx: TyCtxt<'tcx>,
99    def_id: LocalDefId,
100    inspect: ObligationInspector<'tcx>,
101) -> &'tcx ty::TypeckResults<'tcx> {
102    typeck_with_inspect(tcx, def_id, Some(inspect))
103}
104
105x;#[instrument(level = "debug", skip(tcx, inspector), ret)]
106fn typeck_with_inspect<'tcx>(
107    tcx: TyCtxt<'tcx>,
108    def_id: LocalDefId,
109    inspector: Option<ObligationInspector<'tcx>>,
110) -> &'tcx ty::TypeckResults<'tcx> {
111    // Closures' typeck results come from their outermost function,
112    // as they are part of the same "inference environment".
113    let typeck_root_def_id = tcx.typeck_root_def_id(def_id.to_def_id()).expect_local();
114    if typeck_root_def_id != def_id {
115        return tcx.typeck(typeck_root_def_id);
116    }
117
118    let id = tcx.local_def_id_to_hir_id(def_id);
119    let node = tcx.hir_node(id);
120    let span = tcx.def_span(def_id);
121
122    // Figure out what primary body this item has.
123    let body_id = node.body_id().unwrap_or_else(|| {
124        span_bug!(span, "can't type-check body of {:?}", def_id);
125    });
126    let body = tcx.hir_body(body_id);
127
128    let param_env = tcx.param_env(def_id);
129
130    let root_ctxt = TypeckRootCtxt::new(tcx, def_id);
131    if let Some(inspector) = inspector {
132        root_ctxt.infcx.attach_obligation_inspector(inspector);
133    }
134    let mut fcx = FnCtxt::new(&root_ctxt, param_env, def_id);
135
136    if let hir::Node::Item(hir::Item { kind: hir::ItemKind::GlobalAsm { .. }, .. }) = node {
137        // Check the fake body of a global ASM. There's not much to do here except
138        // for visit the asm expr of the body.
139        let ty = fcx.check_expr(body.value);
140        fcx.write_ty(id, ty);
141    } else if let Some(hir::FnSig { header, decl, span: fn_sig_span }) = node.fn_sig() {
142        let fn_sig = if decl.output.is_suggestable_infer_ty().is_some() {
143            // In the case that we're recovering `fn() -> W<_>` or some other return
144            // type that has an infer in it, lower the type directly so that it'll
145            // be correctly filled with infer. We'll use this inference to provide
146            // a suggestion later on.
147            fcx.lowerer().lower_fn_ty(id, header.safety(), header.abi, decl, None, None)
148        } else {
149            tcx.fn_sig(def_id).instantiate_identity()
150        };
151
152        check_abi(tcx, id, span, fn_sig.abi());
153        check_custom_abi(tcx, def_id, fn_sig.skip_binder(), *fn_sig_span);
154
155        loops::check(tcx, def_id, body);
156
157        // Compute the function signature from point of view of inside the fn.
158        let mut fn_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), fn_sig);
159
160        // Normalize the input and output types one at a time, using a different
161        // `WellFormedLoc` for each. We cannot call `normalize_associated_types`
162        // on the entire `FnSig`, since this would use the same `WellFormedLoc`
163        // for each type, preventing the HIR wf check from generating
164        // a nice error message.
165        let arg_span =
166            |idx| decl.inputs.get(idx).map_or(decl.output.span(), |arg: &hir::Ty<'_>| arg.span);
167
168        fn_sig.inputs_and_output = tcx.mk_type_list_from_iter(
169            fn_sig
170                .inputs_and_output
171                .iter()
172                .enumerate()
173                .map(|(idx, ty)| fcx.normalize(arg_span(idx), ty)),
174        );
175
176        if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NAKED) {
177            naked_functions::typeck_naked_fn(tcx, def_id, body);
178        }
179
180        check_fn(&mut fcx, fn_sig, None, decl, def_id, body, tcx.features().unsized_fn_params());
181    } else {
182        let expected_type = if let Some(infer_ty) = infer_type_if_missing(&fcx, node) {
183            infer_ty
184        } else if let Some(ty) = node.ty()
185            && ty.is_suggestable_infer_ty()
186        {
187            // In the case that we're recovering `const X: [T; _]` or some other
188            // type that has an infer in it, lower the type directly so that it'll
189            // be correctly filled with infer. We'll use this inference to provide
190            // a suggestion later on.
191            fcx.lowerer().lower_ty(ty)
192        } else {
193            tcx.type_of(def_id).instantiate_identity()
194        };
195
196        loops::check(tcx, def_id, body);
197
198        let expected_type = fcx.normalize(body.value.span, expected_type);
199
200        let wf_code = ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(def_id)));
201        fcx.register_wf_obligation(expected_type.into(), body.value.span, wf_code);
202
203        if let hir::Node::AnonConst(_) = node {
204            fcx.require_type_is_sized(
205                expected_type,
206                body.value.span,
207                ObligationCauseCode::SizedConstOrStatic,
208            );
209        }
210
211        fcx.check_expr_coercible_to_type(body.value, expected_type, None);
212
213        fcx.write_ty(id, expected_type);
214    };
215
216    // Whether to check repeat exprs before/after inference fallback is somewhat
217    // arbitrary of a decision as neither option is strictly more permissive than
218    // the other. However, we opt to check repeat exprs first as errors from not
219    // having inferred array lengths yet seem less confusing than errors from inference
220    // fallback arbitrarily inferring something incompatible with `Copy` inference
221    // side effects.
222    //
223    // FIXME(#140855): This should also be forwards compatible with moving
224    // repeat expr checks to a custom goal kind or using marker traits in
225    // the future.
226    fcx.check_repeat_exprs();
227
228    // We need to handle opaque types before emitting ambiguity errors as applying
229    // defining uses may guide type inference.
230    if fcx.next_trait_solver() {
231        fcx.try_handle_opaque_type_uses_next();
232    }
233
234    fcx.type_inference_fallback();
235
236    // Even though coercion casts provide type hints, we check casts after fallback for
237    // backwards compatibility. This makes fallback a stronger type hint than a cast coercion.
238    fcx.check_casts();
239    fcx.select_obligations_where_possible(|_| {});
240
241    // Closure and coroutine analysis may run after fallback
242    // because they don't constrain other type variables.
243    fcx.closure_analyze(body);
244    assert!(fcx.deferred_call_resolutions.borrow().is_empty());
245
246    for (ty, span, code) in fcx.deferred_sized_obligations.borrow_mut().drain(..) {
247        let ty = fcx.normalize(span, ty);
248        fcx.require_type_is_sized(ty, span, code);
249    }
250
251    fcx.select_obligations_where_possible(|_| {});
252
253    debug!(pending_obligations = ?fcx.fulfillment_cx.borrow().pending_obligations());
254
255    // We need to handle opaque types before emitting ambiguity errors as applying
256    // defining uses may guide type inference.
257    if fcx.next_trait_solver() {
258        fcx.handle_opaque_type_uses_next();
259    }
260
261    // This must be the last thing before `report_ambiguity_errors` below except `select_obligations_where_possible`.
262    // So don't put anything after this.
263    fcx.drain_stalled_coroutine_obligations();
264    if fcx.infcx.tainted_by_errors().is_none() {
265        fcx.report_ambiguity_errors();
266    }
267
268    fcx.check_asms();
269
270    let typeck_results = fcx.resolve_type_vars_in_body(body);
271
272    fcx.detect_opaque_types_added_during_writeback();
273
274    // Consistency check our TypeckResults instance can hold all ItemLocalIds
275    // it will need to hold.
276    assert_eq!(typeck_results.hir_owner, id.owner);
277
278    typeck_results
279}
280
281fn infer_type_if_missing<'tcx>(fcx: &FnCtxt<'_, 'tcx>, node: Node<'tcx>) -> Option<Ty<'tcx>> {
282    let tcx = fcx.tcx;
283    let def_id = fcx.body_id;
284    let expected_type = if let Some(&hir::Ty { kind: hir::TyKind::Infer(()), span, .. }) = node.ty()
285    {
286        if let Some(item) = tcx.opt_associated_item(def_id.into())
287            && let ty::AssocKind::Const { .. } = item.kind
288            && let ty::AssocContainer::TraitImpl(Ok(trait_item_def_id)) = item.container
289        {
290            let impl_def_id = item.container_id(tcx);
291            let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).instantiate_identity();
292            let args = ty::GenericArgs::identity_for_item(tcx, def_id).rebase_onto(
293                tcx,
294                impl_def_id,
295                impl_trait_ref.args,
296            );
297            tcx.check_args_compatible(trait_item_def_id, args)
298                .then(|| tcx.type_of(trait_item_def_id).instantiate(tcx, args))
299        } else {
300            Some(fcx.next_ty_var(span))
301        }
302    } else if let Node::AnonConst(_) = node {
303        let id = tcx.local_def_id_to_hir_id(def_id);
304        match tcx.parent_hir_node(id) {
305            Node::Expr(&hir::Expr { kind: hir::ExprKind::InlineAsm(asm), span, .. })
306            | Node::Item(&hir::Item { kind: hir::ItemKind::GlobalAsm { asm, .. }, span, .. }) => {
307                asm.operands.iter().find_map(|(op, _op_sp)| match op {
308                    hir::InlineAsmOperand::Const { anon_const } if anon_const.hir_id == id => {
309                        Some(fcx.next_ty_var(span))
310                    }
311                    _ => None,
312                })
313            }
314            _ => None,
315        }
316    } else {
317        None
318    };
319    expected_type
320}
321
322/// When `check_fn` is invoked on a coroutine (i.e., a body that
323/// includes yield), it returns back some information about the yield
324/// points.
325#[derive(#[automatically_derived]
impl<'tcx> ::core::fmt::Debug for CoroutineTypes<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "CoroutineTypes", "resume_ty", &self.resume_ty, "yield_ty",
            &&self.yield_ty)
    }
}Debug, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for CoroutineTypes<'tcx> {
    #[inline]
    fn eq(&self, other: &CoroutineTypes<'tcx>) -> bool {
        self.resume_ty == other.resume_ty && self.yield_ty == other.yield_ty
    }
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::marker::Copy for CoroutineTypes<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineTypes<'tcx> {
    #[inline]
    fn clone(&self) -> CoroutineTypes<'tcx> {
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        *self
    }
}Clone)]
326struct CoroutineTypes<'tcx> {
327    /// Type of coroutine argument / values returned by `yield`.
328    resume_ty: Ty<'tcx>,
329
330    /// Type of value that is yielded.
331    yield_ty: Ty<'tcx>,
332}
333
334#[derive(#[automatically_derived]
impl ::core::marker::Copy for Needs { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Needs {
    #[inline]
    fn clone(&self) -> Needs { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Needs {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                Needs::MutPlace => "MutPlace",
                Needs::None => "None",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for Needs {
    #[inline]
    fn eq(&self, other: &Needs) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Needs {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {}
}Eq)]
335pub enum Needs {
336    MutPlace,
337    None,
338}
339
340impl Needs {
341    fn maybe_mut_place(m: hir::Mutability) -> Self {
342        match m {
343            hir::Mutability::Mut => Needs::MutPlace,
344            hir::Mutability::Not => Needs::None,
345        }
346    }
347}
348
349#[derive(#[automatically_derived]
impl ::core::fmt::Debug for PlaceOp {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                PlaceOp::Deref => "Deref",
                PlaceOp::Index => "Index",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for PlaceOp { }Copy, #[automatically_derived]
impl ::core::clone::Clone for PlaceOp {
    #[inline]
    fn clone(&self) -> PlaceOp { *self }
}Clone)]
350pub enum PlaceOp {
351    Deref,
352    Index,
353}
354
355pub struct BreakableCtxt<'tcx> {
356    may_break: bool,
357
358    // this is `null` for loops where break with a value is illegal,
359    // such as `while`, `for`, and `while let`
360    coerce: Option<CoerceMany<'tcx>>,
361}
362
363pub struct EnclosingBreakables<'tcx> {
364    stack: Vec<BreakableCtxt<'tcx>>,
365    by_id: HirIdMap<usize>,
366}
367
368impl<'tcx> EnclosingBreakables<'tcx> {
369    fn find_breakable(&mut self, target_id: HirId) -> &mut BreakableCtxt<'tcx> {
370        self.opt_find_breakable(target_id).unwrap_or_else(|| {
371            ::rustc_middle::util::bug::bug_fmt(format_args!("could not find enclosing breakable with id {0}",
        target_id));bug!("could not find enclosing breakable with id {}", target_id);
372        })
373    }
374
375    fn opt_find_breakable(&mut self, target_id: HirId) -> Option<&mut BreakableCtxt<'tcx>> {
376        match self.by_id.get(&target_id) {
377            Some(ix) => Some(&mut self.stack[*ix]),
378            None => None,
379        }
380    }
381}
382
383fn report_unexpected_variant_res(
384    tcx: TyCtxt<'_>,
385    res: Res,
386    expr: Option<&hir::Expr<'_>>,
387    qpath: &hir::QPath<'_>,
388    span: Span,
389    err_code: ErrCode,
390    expected: &str,
391) -> ErrorGuaranteed {
392    let res_descr = match res {
393        Res::Def(DefKind::Variant, _) => "struct variant",
394        _ => res.descr(),
395    };
396    let path_str = rustc_hir_pretty::qpath_to_string(&tcx, qpath);
397    let mut err = tcx
398        .dcx()
399        .struct_span_err(span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("expected {0}, found {1} `{2}`",
                expected, res_descr, path_str))
    })format!("expected {expected}, found {res_descr} `{path_str}`"))
400        .with_code(err_code);
401    match res {
402        Res::Def(DefKind::Fn | DefKind::AssocFn, _) if err_code == E0164 => {
403            let patterns_url = "https://doc.rust-lang.org/book/ch19-00-patterns.html";
404            err.with_span_label(span, "`fn` calls are not allowed in patterns")
405                .with_help(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("for more information, visit {0}",
                patterns_url))
    })format!("for more information, visit {patterns_url}"))
406        }
407        Res::Def(DefKind::Variant, _) if let Some(expr) = expr => {
408            err.span_label(span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("not a {0}", expected))
    })format!("not a {expected}"));
409            let variant = tcx.expect_variant_res(res);
410            let sugg = if variant.fields.is_empty() {
411                " {}".to_string()
412            } else {
413                ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!(" {{ {0} }}",
                variant.fields.iter().map(|f|
                                ::alloc::__export::must_use({
                                        ::alloc::fmt::format(format_args!("{0}: /* value */",
                                                f.name))
                                    })).collect::<Vec<_>>().join(", ")))
    })format!(
414                    " {{ {} }}",
415                    variant
416                        .fields
417                        .iter()
418                        .map(|f| format!("{}: /* value */", f.name))
419                        .collect::<Vec<_>>()
420                        .join(", ")
421                )
422            };
423            let descr = "you might have meant to create a new value of the struct";
424            let mut suggestion = ::alloc::vec::Vec::new()vec![];
425            match tcx.parent_hir_node(expr.hir_id) {
426                hir::Node::Expr(hir::Expr {
427                    kind: hir::ExprKind::Call(..),
428                    span: call_span,
429                    ..
430                }) => {
431                    suggestion.push((span.shrink_to_hi().with_hi(call_span.hi()), sugg));
432                }
433                hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Binary(..), hir_id, .. }) => {
434                    suggestion.push((expr.span.shrink_to_lo(), "(".to_string()));
435                    if let hir::Node::Expr(parent) = tcx.parent_hir_node(*hir_id)
436                        && let hir::ExprKind::If(condition, block, None) = parent.kind
437                        && condition.hir_id == *hir_id
438                        && let hir::ExprKind::Block(block, _) = block.kind
439                        && block.stmts.is_empty()
440                        && let Some(expr) = block.expr
441                        && let hir::ExprKind::Path(..) = expr.kind
442                    {
443                        // Special case: you can incorrectly write an equality condition:
444                        // if foo == Struct { field } { /* if body */ }
445                        // which should have been written
446                        // if foo == (Struct { field }) { /* if body */ }
447                        suggestion.push((block.span.shrink_to_hi(), ")".to_string()));
448                    } else {
449                        suggestion.push((span.shrink_to_hi().with_hi(expr.span.hi()), sugg));
450                    }
451                }
452                _ => {
453                    suggestion.push((span.shrink_to_hi(), sugg));
454                }
455            }
456
457            err.multipart_suggestion_verbose(descr, suggestion, Applicability::HasPlaceholders);
458            err
459        }
460        Res::Def(DefKind::Variant, _) if expr.is_none() => {
461            err.span_label(span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("not a {0}", expected))
    })format!("not a {expected}"));
462
463            let fields = &tcx.expect_variant_res(res).fields.raw;
464            let span = qpath.span().shrink_to_hi().to(span.shrink_to_hi());
465            let (msg, sugg) = if fields.is_empty() {
466                ("use the struct variant pattern syntax".to_string(), " {}".to_string())
467            } else {
468                let msg = ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("the struct variant\'s field{0} {1} being ignored",
                if fields.len() == 1 { "" } else { "s" },
                if fields.len() == 1 { "is" } else { "are" }))
    })format!(
469                    "the struct variant's field{s} {are} being ignored",
470                    s = pluralize!(fields.len()),
471                    are = pluralize!("is", fields.len())
472                );
473                let fields = fields
474                    .iter()
475                    .map(|field| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}: _", field.ident(tcx)))
    })format!("{}: _", field.ident(tcx)))
476                    .collect::<Vec<_>>()
477                    .join(", ");
478                let sugg = ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!(" {{ {0} }}", fields))
    })format!(" {{ {} }}", fields);
479                (msg, sugg)
480            };
481
482            err.span_suggestion_verbose(
483                qpath.span().shrink_to_hi().to(span.shrink_to_hi()),
484                msg,
485                sugg,
486                Applicability::HasPlaceholders,
487            );
488            err
489        }
490        _ => err.with_span_label(span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("not a {0}", expected))
    })format!("not a {expected}")),
491    }
492    .emit()
493}
494
495/// Controls whether the arguments are tupled. This is used for the call
496/// operator.
497///
498/// Tupling means that all call-side arguments are packed into a tuple and
499/// passed as a single parameter. For example, if tupling is enabled, this
500/// function:
501/// ```
502/// fn f(x: (isize, isize)) {}
503/// ```
504/// Can be called as:
505/// ```ignore UNSOLVED (can this be done in user code?)
506/// # fn f(x: (isize, isize)) {}
507/// f(1, 2);
508/// ```
509/// Instead of:
510/// ```
511/// # fn f(x: (isize, isize)) {}
512/// f((1, 2));
513/// ```
514#[derive(#[automatically_derived]
impl ::core::marker::Copy for TupleArgumentsFlag { }Copy, #[automatically_derived]
impl ::core::clone::Clone for TupleArgumentsFlag {
    #[inline]
    fn clone(&self) -> TupleArgumentsFlag { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::Eq for TupleArgumentsFlag {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for TupleArgumentsFlag {
    #[inline]
    fn eq(&self, other: &TupleArgumentsFlag) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
515enum TupleArgumentsFlag {
516    DontTupleArguments,
517    TupleArguments,
518}
519
520fn fatally_break_rust(tcx: TyCtxt<'_>, span: Span) -> ! {
521    let dcx = tcx.dcx();
522    let mut diag = dcx.struct_span_bug(
523        span,
524        "It looks like you're trying to break rust; would you like some ICE?",
525    );
526    diag.note("the compiler expectedly panicked. this is a feature.");
527    diag.note(
528        "we would appreciate a joke overview: \
529         https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675",
530    );
531    diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("rustc {0} running on {1}",
                tcx.sess.cfg_version, config::host_tuple()))
    })format!("rustc {} running on {}", tcx.sess.cfg_version, config::host_tuple(),));
532    if let Some((flags, excluded_cargo_defaults)) = rustc_session::utils::extra_compiler_flags() {
533        diag.note(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("compiler flags: {0}",
                flags.join(" ")))
    })format!("compiler flags: {}", flags.join(" ")));
534        if excluded_cargo_defaults {
535            diag.note("some of the compiler flags provided by cargo are hidden");
536        }
537    }
538    diag.emit()
539}
540
541/// Adds query implementations to the [Providers] vtable, see [`rustc_middle::query`]
542pub fn provide(providers: &mut Providers) {
543    *providers = Providers {
544        method_autoderef_steps: method::probe::method_autoderef_steps,
545        typeck,
546        used_trait_imports,
547        check_transmutes: intrinsicck::check_transmutes,
548        ..*providers
549    };
550}