Fast path for sized pred
This commit is contained in:
parent
1d0d258a86
commit
407fac5479
2 changed files with 18 additions and 2 deletions
|
|
@ -1882,9 +1882,9 @@ impl<'tcx> Ty<'tcx> {
|
|||
// Needs normalization or revealing to determine, so no is the safe answer.
|
||||
ty::Alias(..) => false,
|
||||
|
||||
ty::Param(..) | ty::Infer(..) | ty::Error(..) => false,
|
||||
ty::Param(..) | ty::Placeholder(..) | ty::Infer(..) | ty::Error(..) => false,
|
||||
|
||||
ty::Bound(..) | ty::Placeholder(..) => {
|
||||
ty::Bound(..) => {
|
||||
bug!("`is_trivially_pure_clone_copy` applied to unexpected type: {:?}", self);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use std::ops::Deref;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
|
||||
use rustc_infer::infer::canonical::query_response::make_query_region_constraints;
|
||||
use rustc_infer::infer::canonical::{
|
||||
|
|
@ -83,6 +84,21 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
|||
|
||||
Some(HasChanged::No)
|
||||
}
|
||||
ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred)) => {
|
||||
match self.0.tcx.as_lang_item(trait_pred.def_id()) {
|
||||
Some(LangItem::Sized)
|
||||
if trait_pred.self_ty().is_trivially_sized(self.0.tcx) =>
|
||||
{
|
||||
Some(HasChanged::No)
|
||||
}
|
||||
Some(LangItem::Copy | LangItem::Clone)
|
||||
if trait_pred.self_ty().is_trivially_pure_clone_copy() =>
|
||||
{
|
||||
Some(HasChanged::No)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue