1
Fork 0

pub(in super::super) to pub(crate)

`super::super` of `rustc_hir_typeck::fn_ctxt::_impl`
is just `rustc_hir_typeck`.
This commit is contained in:
lcnr 2024-03-12 13:56:12 +01:00
parent 2293f1ed6a
commit 662eadbafb

View file

@ -46,7 +46,7 @@ use std::slice;
impl<'a, 'tcx> FnCtxt<'a, 'tcx> { impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// Produces warning on the given node, if the current point in the /// Produces warning on the given node, if the current point in the
/// function is unreachable, and there hasn't been another warning. /// function is unreachable, and there hasn't been another warning.
pub(in super::super) fn warn_if_unreachable(&self, id: HirId, span: Span, kind: &str) { pub(crate) fn warn_if_unreachable(&self, id: HirId, span: Span, kind: &str) {
// FIXME: Combine these two 'if' expressions into one once // FIXME: Combine these two 'if' expressions into one once
// let chains are implemented // let chains are implemented
if let Diverges::Always { span: orig_span, custom_note } = self.diverges.get() { if let Diverges::Always { span: orig_span, custom_note } = self.diverges.get() {
@ -86,7 +86,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// FIXME(-Znext-solver): A lot of the calls to this method should // FIXME(-Znext-solver): A lot of the calls to this method should
// probably be `try_structurally_resolve_type` or `structurally_resolve_type` instead. // probably be `try_structurally_resolve_type` or `structurally_resolve_type` instead.
#[instrument(skip(self), level = "debug", ret)] #[instrument(skip(self), level = "debug", ret)]
pub(in super::super) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> { pub(crate) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
// No Infer()? Nothing needs doing. // No Infer()? Nothing needs doing.
if !ty.has_non_region_infer() { if !ty.has_non_region_infer() {
debug!("no inference var, nothing needs doing"); debug!("no inference var, nothing needs doing");
@ -108,7 +108,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.resolve_vars_if_possible(ty) self.resolve_vars_if_possible(ty)
} }
pub(in super::super) fn record_deferred_call_resolution( pub(crate) fn record_deferred_call_resolution(
&self, &self,
closure_def_id: LocalDefId, closure_def_id: LocalDefId,
r: DeferredCallResolution<'tcx>, r: DeferredCallResolution<'tcx>,
@ -117,7 +117,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
deferred_call_resolutions.entry(closure_def_id).or_default().push(r); deferred_call_resolutions.entry(closure_def_id).or_default().push(r);
} }
pub(in super::super) fn remove_deferred_call_resolutions( pub(crate) fn remove_deferred_call_resolutions(
&self, &self,
closure_def_id: LocalDefId, closure_def_id: LocalDefId,
) -> Vec<DeferredCallResolution<'tcx>> { ) -> Vec<DeferredCallResolution<'tcx>> {
@ -171,7 +171,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
#[instrument(level = "debug", skip(self))] #[instrument(level = "debug", skip(self))]
pub(in super::super) fn write_resolution( pub(crate) fn write_resolution(
&self, &self,
hir_id: HirId, hir_id: HirId,
r: Result<(DefKind, DefId), ErrorGuaranteed>, r: Result<(DefKind, DefId), ErrorGuaranteed>,
@ -335,7 +335,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
/// Instantiates and normalizes the bounds for a given item /// Instantiates and normalizes the bounds for a given item
pub(in super::super) fn instantiate_bounds( pub(crate) fn instantiate_bounds(
&self, &self,
span: Span, span: Span,
def_id: DefId, def_id: DefId,
@ -348,7 +348,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
result result
} }
pub(in super::super) fn normalize<T>(&self, span: Span, value: T) -> T pub(crate) fn normalize<T>(&self, span: Span, value: T) -> T
where where
T: TypeFoldable<TyCtxt<'tcx>>, T: TypeFoldable<TyCtxt<'tcx>>,
{ {
@ -536,7 +536,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.normalize(span, field.ty(self.tcx, args)) self.normalize(span, field.ty(self.tcx, args))
} }
pub(in super::super) fn resolve_rvalue_scopes(&self, def_id: DefId) { pub(crate) fn resolve_rvalue_scopes(&self, def_id: DefId) {
let scope_tree = self.tcx.region_scope_tree(def_id); let scope_tree = self.tcx.region_scope_tree(def_id);
let rvalue_scopes = { rvalue_scopes::resolve_rvalue_scopes(self, scope_tree, def_id) }; let rvalue_scopes = { rvalue_scopes::resolve_rvalue_scopes(self, scope_tree, def_id) };
let mut typeck_results = self.typeck_results.borrow_mut(); let mut typeck_results = self.typeck_results.borrow_mut();
@ -552,7 +552,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// We must not attempt to select obligations after this method has run, or risk query cycle /// We must not attempt to select obligations after this method has run, or risk query cycle
/// ICE. /// ICE.
#[instrument(level = "debug", skip(self))] #[instrument(level = "debug", skip(self))]
pub(in super::super) fn resolve_coroutine_interiors(&self) { pub(crate) fn resolve_coroutine_interiors(&self) {
// Try selecting all obligations that are not blocked on inference variables. // Try selecting all obligations that are not blocked on inference variables.
// Once we start unifying coroutine witnesses, trying to select obligations on them will // Once we start unifying coroutine witnesses, trying to select obligations on them will
// trigger query cycle ICEs, as doing so requires MIR. // trigger query cycle ICEs, as doing so requires MIR.
@ -593,7 +593,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
#[instrument(skip(self), level = "debug")] #[instrument(skip(self), level = "debug")]
pub(in super::super) fn report_ambiguity_errors(&self) { pub(crate) fn report_ambiguity_errors(&self) {
let mut errors = self.fulfillment_cx.borrow_mut().collect_remaining_errors(self); let mut errors = self.fulfillment_cx.borrow_mut().collect_remaining_errors(self);
if !errors.is_empty() { if !errors.is_empty() {
@ -608,7 +608,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
/// Select as many obligations as we can at present. /// Select as many obligations as we can at present.
pub(in super::super) fn select_obligations_where_possible( pub(crate) fn select_obligations_where_possible(
&self, &self,
mutate_fulfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>), mutate_fulfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>),
) { ) {
@ -624,7 +624,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// returns a type of `&T`, but the actual type we assign to the /// returns a type of `&T`, but the actual type we assign to the
/// *expression* is `T`. So this function just peels off the return /// *expression* is `T`. So this function just peels off the return
/// type by one layer to yield `T`. /// type by one layer to yield `T`.
pub(in super::super) fn make_overloaded_place_return_type( pub(crate) fn make_overloaded_place_return_type(
&self, &self,
method: MethodCallee<'tcx>, method: MethodCallee<'tcx>,
) -> ty::TypeAndMut<'tcx> { ) -> ty::TypeAndMut<'tcx> {
@ -635,7 +635,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ret_ty.builtin_deref(true).unwrap() ret_ty.builtin_deref(true).unwrap()
} }
pub(in super::super) fn type_var_is_sized(&self, self_ty: ty::TyVid) -> bool { pub(crate) fn type_var_is_sized(&self, self_ty: ty::TyVid) -> bool {
let sized_did = self.tcx.lang_items().sized_trait(); let sized_did = self.tcx.lang_items().sized_trait();
self.obligations_for_self_ty(self_ty).any(|obligation| { self.obligations_for_self_ty(self_ty).any(|obligation| {
match obligation.predicate.kind().skip_binder() { match obligation.predicate.kind().skip_binder() {
@ -647,7 +647,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}) })
} }
pub(in super::super) fn err_args(&self, len: usize) -> Vec<Ty<'tcx>> { pub(crate) fn err_args(&self, len: usize) -> Vec<Ty<'tcx>> {
let ty_error = Ty::new_misc_error(self.tcx); let ty_error = Ty::new_misc_error(self.tcx);
vec![ty_error; len] vec![ty_error; len]
} }
@ -655,7 +655,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// Unifies the output type with the expected type early, for more coercions /// Unifies the output type with the expected type early, for more coercions
/// and forward type information on the input expressions. /// and forward type information on the input expressions.
#[instrument(skip(self, call_span), level = "debug")] #[instrument(skip(self, call_span), level = "debug")]
pub(in super::super) fn expected_inputs_for_expected_output( pub(crate) fn expected_inputs_for_expected_output(
&self, &self,
call_span: Span, call_span: Span,
expected_ret: Expectation<'tcx>, expected_ret: Expectation<'tcx>,
@ -688,7 +688,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expect_args expect_args
} }
pub(in super::super) fn resolve_lang_item_path( pub(crate) fn resolve_lang_item_path(
&self, &self,
lang_item: hir::LangItem, lang_item: hir::LangItem,
span: Span, span: Span,
@ -867,7 +867,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// but we often want access to the parent function's signature. /// but we often want access to the parent function's signature.
/// ///
/// Otherwise, return false. /// Otherwise, return false.
pub(in super::super) fn get_node_fn_decl( pub(crate) fn get_node_fn_decl(
&self, &self,
node: Node<'tcx>, node: Node<'tcx>,
) -> Option<(LocalDefId, &'tcx hir::FnDecl<'tcx>, Ident, bool)> { ) -> Option<(LocalDefId, &'tcx hir::FnDecl<'tcx>, Ident, bool)> {
@ -945,7 +945,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}) })
} }
pub(in super::super) fn note_internal_mutation_in_method( pub(crate) fn note_internal_mutation_in_method(
&self, &self,
err: &mut Diag<'_>, err: &mut Diag<'_>,
expr: &hir::Expr<'_>, expr: &hir::Expr<'_>,
@ -1490,7 +1490,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
} }
pub(in super::super) fn with_breakable_ctxt<F: FnOnce() -> R, R>( pub(crate) fn with_breakable_ctxt<F: FnOnce() -> R, R>(
&self, &self,
id: HirId, id: HirId,
ctxt: BreakableCtxt<'tcx>, ctxt: BreakableCtxt<'tcx>,
@ -1516,7 +1516,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// Instantiate a QueryResponse in a probe context, without a /// Instantiate a QueryResponse in a probe context, without a
/// good ObligationCause. /// good ObligationCause.
pub(in super::super) fn probe_instantiate_query_response( pub(crate) fn probe_instantiate_query_response(
&self, &self,
span: Span, span: Span,
original_values: &OriginalQueryValues<'tcx>, original_values: &OriginalQueryValues<'tcx>,
@ -1531,7 +1531,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
/// Returns `true` if an expression is contained inside the LHS of an assignment expression. /// Returns `true` if an expression is contained inside the LHS of an assignment expression.
pub(in super::super) fn expr_in_place(&self, mut expr_id: HirId) -> bool { pub(crate) fn expr_in_place(&self, mut expr_id: HirId) -> bool {
let mut contained_in_place = false; let mut contained_in_place = false;
while let hir::Node::Expr(parent_expr) = self.tcx.parent_hir_node(expr_id) { while let hir::Node::Expr(parent_expr) = self.tcx.parent_hir_node(expr_id) {