Move StatementAsExpression
to where it's actually used.
Also minimize some visibilities in the destination file.
This commit is contained in:
parent
5986ff05d8
commit
dc4f948299
2 changed files with 13 additions and 14 deletions
|
@ -514,12 +514,6 @@ impl<'tcx> ObligationCauseCode<'tcx> {
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
rustc_data_structures::static_assert_size!(ObligationCauseCode<'_>, 48);
|
rustc_data_structures::static_assert_size!(ObligationCauseCode<'_>, 48);
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
|
||||||
pub enum StatementAsExpression {
|
|
||||||
CorrectType,
|
|
||||||
NeedsBoxing,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
|
#[derive(Clone, Debug, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
|
||||||
#[derive(TypeVisitable, TypeFoldable)]
|
#[derive(TypeVisitable, TypeFoldable)]
|
||||||
pub struct MatchExpressionArmCause<'tcx> {
|
pub struct MatchExpressionArmCause<'tcx> {
|
||||||
|
|
|
@ -10,7 +10,6 @@ use rustc_hir::def::Res;
|
||||||
use rustc_hir::{MatchSource, Node};
|
use rustc_hir::{MatchSource, Node};
|
||||||
use rustc_middle::traits::{
|
use rustc_middle::traits::{
|
||||||
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
|
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
|
||||||
StatementAsExpression,
|
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::error::TypeError;
|
use rustc_middle::ty::error::TypeError;
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
|
@ -26,8 +25,14 @@ use crate::errors::{
|
||||||
SuggestTuplePatternMany, SuggestTuplePatternOne, TypeErrorAdditionalDiags,
|
SuggestTuplePatternMany, SuggestTuplePatternOne, TypeErrorAdditionalDiags,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
|
enum StatementAsExpression {
|
||||||
|
CorrectType,
|
||||||
|
NeedsBoxing,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum SuggestAsRefKind {
|
enum SuggestAsRefKind {
|
||||||
Option,
|
Option,
|
||||||
Result,
|
Result,
|
||||||
}
|
}
|
||||||
|
@ -382,7 +387,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suggest_function_pointers_impl(
|
pub(crate) fn suggest_function_pointers_impl(
|
||||||
&self,
|
&self,
|
||||||
span: Option<Span>,
|
span: Option<Span>,
|
||||||
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
|
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
|
||||||
|
@ -518,7 +523,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_suggest_as_ref_kind(
|
fn should_suggest_as_ref_kind(
|
||||||
&self,
|
&self,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
found: Ty<'tcx>,
|
found: Ty<'tcx>,
|
||||||
|
@ -588,8 +593,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
) -> Option<TypeErrorAdditionalDiags> {
|
) -> Option<TypeErrorAdditionalDiags> {
|
||||||
/// Find the if expression with given span
|
/// Find the if expression with given span
|
||||||
struct IfVisitor {
|
struct IfVisitor {
|
||||||
pub found_if: bool,
|
found_if: bool,
|
||||||
pub err_span: Span,
|
err_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'v> Visitor<'v> for IfVisitor {
|
impl<'v> Visitor<'v> for IfVisitor {
|
||||||
|
@ -736,7 +741,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
/// Be helpful when the user wrote `{... expr; }` and taking the `;` off
|
/// Be helpful when the user wrote `{... expr; }` and taking the `;` off
|
||||||
/// is enough to fix the error.
|
/// is enough to fix the error.
|
||||||
pub fn could_remove_semicolon(
|
fn could_remove_semicolon(
|
||||||
&self,
|
&self,
|
||||||
blk: &'tcx hir::Block<'tcx>,
|
blk: &'tcx hir::Block<'tcx>,
|
||||||
expected_ty: Ty<'tcx>,
|
expected_ty: Ty<'tcx>,
|
||||||
|
@ -816,7 +821,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
|
|
||||||
/// Suggest returning a local binding with a compatible type if the block
|
/// Suggest returning a local binding with a compatible type if the block
|
||||||
/// has no return expression.
|
/// has no return expression.
|
||||||
pub fn consider_returning_binding_diag(
|
fn consider_returning_binding_diag(
|
||||||
&self,
|
&self,
|
||||||
blk: &'tcx hir::Block<'tcx>,
|
blk: &'tcx hir::Block<'tcx>,
|
||||||
expected_ty: Ty<'tcx>,
|
expected_ty: Ty<'tcx>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue