diff options
| author | bors <bors@rust-lang.org> | 2025-07-04 04:21:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-07-04 04:21:14 +0000 |
| commit | c96a69059ecc618b519da385a6ccd03155aa0237 (patch) | |
| tree | 8a658b79c06f3b54d15b22c22fa7b30edd889557 /compiler/rustc_trait_selection/src | |
| parent | 837c5dd7de03aa97190593aef4e70d53e1bb574b (diff) | |
| parent | e4e26d2acb13f42badb6e4953c7d72a001e3aed7 (diff) | |
| download | rust-c96a69059ecc618b519da385a6ccd03155aa0237.tar.gz rust-c96a69059ecc618b519da385a6ccd03155aa0237.zip | |
Auto merge of #143407 - jhpratt:rollup-ekkoubw, r=jhpratt
Rollup of 11 pull requests
Successful merges:
- rust-lang/rust#142749 (Add methods for converting bool to `Result<(), E>`)
- rust-lang/rust#143288 (Fix `x clean` with a fifo)
- rust-lang/rust#143307 (Fast path nitpicks)
- rust-lang/rust#143346 (update coherence example)
- rust-lang/rust#143356 (use unsigned_abs instead of `abs` on signed int to silence clippy)
- rust-lang/rust#143370 (remove redundant #[must_use])
- rust-lang/rust#143378 (simplify receivers for some array method calls)
- rust-lang/rust#143380 (Replace kw_span by full span for generic const parameters.)
- rust-lang/rust#143381 (rustdoc: don't treat methods under const impls or traits as const)
- rust-lang/rust#143394 (compiler: Document and reduce `fn provide`s in hir crates)
- rust-lang/rust#143395 (Always use the pure Rust fallback instead of `llvm.{maximum,minimum}`)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/util.rs | 7 |
2 files changed, 6 insertions, 15 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs index 18971c47831..22eeb285b37 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs @@ -21,19 +21,9 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> { if let ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(term)) = key.value.predicate.kind().skip_binder() + && term.is_trivially_wf(tcx) { - match term.as_type()?.kind() { - ty::Param(_) - | ty::Bool - | ty::Char - | ty::Int(_) - | ty::Float(_) - | ty::Str - | ty::Uint(_) => { - return Some(()); - } - _ => {} - } + return Some(()); } None diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index a05bae53566..141454bfe37 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -368,16 +368,17 @@ pub fn sizedness_fast_path<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tc // Proving `Sized`/`MetaSized`, very often on "obviously sized" types like // `&T`, accounts for about 60% percentage of the predicates we have to prove. No need to // canonicalize and all that for such cases. - if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_ref)) = + if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred)) = predicate.kind().skip_binder() + && trait_pred.polarity == ty::PredicatePolarity::Positive { - let sizedness = match tcx.as_lang_item(trait_ref.def_id()) { + let sizedness = match tcx.as_lang_item(trait_pred.def_id()) { Some(LangItem::Sized) => SizedTraitKind::Sized, Some(LangItem::MetaSized) => SizedTraitKind::MetaSized, _ => return false, }; - if trait_ref.self_ty().has_trivial_sizedness(tcx, sizedness) { + if trait_pred.self_ty().has_trivial_sizedness(tcx, sizedness) { debug!("fast path -- trivial sizedness"); return true; } |
