diff options
| author | bors <bors@rust-lang.org> | 2024-09-17 23:05:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-17 23:05:43 +0000 |
| commit | f7b4c72c8ffb320616bda27f70bb8e0a341673fb (patch) | |
| tree | 7e761d56714411ff5e1e47fbd3ebf798c13e527d | |
| parent | 28e8f01c2a2f33fb4214925a704e3223b372cad5 (diff) | |
| parent | 7e8eb7aa93b7c39fc8bf4587ef5bfdd6fd251ac2 (diff) | |
| download | rust-f7b4c72c8ffb320616bda27f70bb8e0a341673fb.tar.gz rust-f7b4c72c8ffb320616bda27f70bb8e0a341673fb.zip | |
Auto merge of #130492 - matthiaskrgr:rollup-9pxkd8i, r=matthiaskrgr
Rollup of 2 pull requests Successful merges: - #130481 (Remove uneeded PartialOrd bound in cmp::Ord::clamp) - #130482 (Remove redundant test typeid equality by subtyping) r? `@ghost` `@rustbot` modify labels: rollup
3 files changed, 0 insertions, 82 deletions
diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index a1ed993b7d9..818a36002e7 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -901,7 +901,6 @@ pub trait Ord: Eq + PartialOrd<Self> { fn clamp(self, min: Self, max: Self) -> Self where Self: Sized, - Self: PartialOrd, { assert!(min <= max); if self < min { diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs deleted file mode 100644 index 81be8d5c7d7..00000000000 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.rs +++ /dev/null @@ -1,54 +0,0 @@ -//@ known-bug: #110395 -//@ known-bug: #97156 - -#![feature(const_type_id, const_trait_impl, generic_const_exprs)] -#![allow(incomplete_features)] - -use std::any::TypeId; -// `One` and `Two` are currently considered equal types, as both -// `One <: Two` and `One :> Two` holds. -type One = for<'a> fn(&'a (), &'a ()); -type Two = for<'a, 'b> fn(&'a (), &'b ()); -trait AssocCt { - const ASSOC: usize; -} -const fn to_usize<T: 'static>() -> usize { - const WHAT_A_TYPE: TypeId = TypeId::of::<One>(); - match TypeId::of::<T>() { - WHAT_A_TYPE => 0, - _ => 1000, - } -} -impl<T: 'static> AssocCt for T { - const ASSOC: usize = to_usize::<T>(); -} - -trait WithAssoc<U> { - type Assoc; -} -impl<T: 'static> WithAssoc<()> for T -where - [(); <T as AssocCt>::ASSOC]:, -{ - type Assoc = [u8; <T as AssocCt>::ASSOC]; -} - -fn generic<T: 'static, U>(x: <T as WithAssoc<U>>::Assoc) -> <T as WithAssoc<U>>::Assoc -where - [(); <T as AssocCt>::ASSOC]:, - T: WithAssoc<U>, -{ - x -} - -fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc -where - One: WithAssoc<T>, -{ - let x: <Two as WithAssoc<T>>::Assoc = generic::<One, T>(x); - x -} - -fn main() { - println!("{:?}", unsound::<()>([])); -} diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr deleted file mode 100644 index 26e724c9061..00000000000 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq)]` - --> $DIR/typeid-equality-by-subtyping.rs:18:9 - | -LL | WHAT_A_TYPE => 0, - | ^^^^^^^^^^^ - | - = note: the traits must be derived, manual `impl`s are not sufficient - = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details - -error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied - --> $DIR/typeid-equality-by-subtyping.rs:44:51 - | -LL | fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` - -error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied - --> $DIR/typeid-equality-by-subtyping.rs:47:1 - | -LL | / { -LL | | let x: <Two as WithAssoc<T>>::Assoc = generic::<One, T>(x); -LL | | x -LL | | } - | |_^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. |
