Stop ConstraintCategory
Ord
impl from relying on Ty
's Ord
impl.
This commit is contained in:
parent
1cf345e10a
commit
cda209bf43
@ -4236,6 +4236,7 @@ name = "rustc_middle"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.4.2",
|
||||||
|
"derivative",
|
||||||
"either",
|
"either",
|
||||||
"field-offset",
|
"field-offset",
|
||||||
"gsgdt",
|
"gsgdt",
|
||||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
bitflags = "2.4.1"
|
bitflags = "2.4.1"
|
||||||
|
derivative = "2.2.0"
|
||||||
either = "1.5.0"
|
either = "1.5.0"
|
||||||
field-offset = "0.3.5"
|
field-offset = "0.3.5"
|
||||||
gsgdt = "0.1.2"
|
gsgdt = "0.1.2"
|
||||||
|
@ -284,8 +284,15 @@ pub struct ClosureOutlivesRequirement<'tcx> {
|
|||||||
/// order of the category, thereby influencing diagnostic output.
|
/// order of the category, thereby influencing diagnostic output.
|
||||||
///
|
///
|
||||||
/// See also `rustc_const_eval::borrow_check::constraints`.
|
/// See also `rustc_const_eval::borrow_check::constraints`.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||||
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
|
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
|
||||||
|
#[derive(derivative::Derivative)]
|
||||||
|
#[derivative(
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
PartialOrd = "feature_allow_slow_enum",
|
||||||
|
Ord = "feature_allow_slow_enum"
|
||||||
|
)]
|
||||||
pub enum ConstraintCategory<'tcx> {
|
pub enum ConstraintCategory<'tcx> {
|
||||||
Return(ReturnConstraint),
|
Return(ReturnConstraint),
|
||||||
Yield,
|
Yield,
|
||||||
@ -295,6 +302,7 @@ pub enum ConstraintCategory<'tcx> {
|
|||||||
Cast {
|
Cast {
|
||||||
/// Whether this is an unsizing cast and if yes, this contains the target type.
|
/// Whether this is an unsizing cast and if yes, this contains the target type.
|
||||||
/// Region variables are erased to ReErased.
|
/// Region variables are erased to ReErased.
|
||||||
|
#[derivative(PartialOrd = "ignore", Ord = "ignore")]
|
||||||
unsize_to: Option<Ty<'tcx>>,
|
unsize_to: Option<Ty<'tcx>>,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -304,7 +312,7 @@ pub enum ConstraintCategory<'tcx> {
|
|||||||
ClosureBounds,
|
ClosureBounds,
|
||||||
|
|
||||||
/// Contains the function type if available.
|
/// Contains the function type if available.
|
||||||
CallArgument(Option<Ty<'tcx>>),
|
CallArgument(#[derivative(PartialOrd = "ignore", Ord = "ignore")] Option<Ty<'tcx>>),
|
||||||
CopyBound,
|
CopyBound,
|
||||||
SizedBound,
|
SizedBound,
|
||||||
Assignment,
|
Assignment,
|
||||||
|
@ -53,17 +53,16 @@ LL | fn case2() {
|
|||||||
error[E0597]: `a` does not live long enough
|
error[E0597]: `a` does not live long enough
|
||||||
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
|
||||||
|
|
|
|
||||||
LL | let a = 0;
|
LL | let a = 0;
|
||||||
| - binding `a` declared here
|
| - binding `a` declared here
|
||||||
LL | let cell = Cell::new(&a);
|
LL | let cell = Cell::new(&a);
|
||||||
| ^^ borrowed value does not live long enough
|
| ----------^^-
|
||||||
|
| | |
|
||||||
|
| | borrowed value does not live long enough
|
||||||
|
| argument requires that `a` is borrowed for `'static`
|
||||||
...
|
...
|
||||||
LL | / foo(cell, |cell_a, cell_x| {
|
LL | }
|
||||||
LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
|
| - `a` dropped here while still borrowed
|
||||||
LL | | })
|
|
||||||
| |______- argument requires that `a` is borrowed for `'static`
|
|
||||||
LL | }
|
|
||||||
| - `a` dropped here while still borrowed
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
error[E0597]: `c` does not live long enough
|
error[E0597]: `c` does not live long enough
|
||||||
--> $DIR/adt-nullary-enums.rs:33:41
|
--> $DIR/adt-nullary-enums.rs:33:41
|
||||||
|
|
|
|
||||||
LL | let c = 66;
|
LL | let c = 66;
|
||||||
| - binding `c` declared here
|
| - binding `c` declared here
|
||||||
LL | / combine(
|
LL | combine(
|
||||||
LL | | SomeEnum::SomeVariant(Cell::new(&c)),
|
LL | SomeEnum::SomeVariant(Cell::new(&c)),
|
||||||
| | ^^ borrowed value does not live long enough
|
| ----------^^-
|
||||||
LL | | SomeEnum::SomeOtherVariant::<Cell<&'static u32>>,
|
| | |
|
||||||
LL | | );
|
| | borrowed value does not live long enough
|
||||||
| |_____- argument requires that `c` is borrowed for `'static`
|
| argument requires that `c` is borrowed for `'static`
|
||||||
LL | }
|
...
|
||||||
| - `c` dropped here while still borrowed
|
LL | }
|
||||||
|
| - `c` dropped here while still borrowed
|
||||||
|
|
||||||
error[E0597]: `c` does not live long enough
|
error[E0597]: `c` does not live long enough
|
||||||
--> $DIR/adt-nullary-enums.rs:41:41
|
--> $DIR/adt-nullary-enums.rs:41:41
|
||||||
|
Loading…
Reference in New Issue
Block a user