Rollup merge of #90395 - b-naber:const-expr-type-relation, r=oli-obk
Restrict liveness of mutable borrow of inner infcx in ConstInferUnifier::consts Fixes https://github.com/rust-lang/rust/issues/89304 r? ``@oli-obk``
This commit is contained in:
commit
88e0bea7ca
2 changed files with 40 additions and 9 deletions
20
src/test/ui/const-generics/issues/issue-89304.rs
Normal file
20
src/test/ui/const-generics/issues/issue-89304.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct GenericStruct<const T: usize> { val: i64 }
|
||||
|
||||
impl<const T: usize> From<GenericStruct<T>> for GenericStruct<{T + 1}> {
|
||||
fn from(other: GenericStruct<T>) -> Self {
|
||||
Self { val: other.val }
|
||||
}
|
||||
}
|
||||
|
||||
impl<const T: usize> From<GenericStruct<{T + 1}>> for GenericStruct<T> {
|
||||
fn from(other: GenericStruct<{T + 1}>) -> Self {
|
||||
Self { val: other.val }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue