mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 10:38:57 +00:00
fix: get MatchBorrow type check working for references 3 deep
This commit is contained in:
@@ -81,10 +81,38 @@ impl<'a> MatchBorrowExt for MatchBorrow<&'a [u8], Vec<u8>> {
|
||||
type Matched = &'a [u8];
|
||||
}
|
||||
|
||||
impl<'a, T> MatchBorrowExt for MatchBorrow<&'a T, T> {
|
||||
impl<T> MatchBorrowExt for MatchBorrow<&'_ T, T> {
|
||||
type Matched = T;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<&'_ &'_ T, T> {
|
||||
type Matched = T;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<T, &'_ T> {
|
||||
type Matched = T;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<T, &'_ &'_ T> {
|
||||
type Matched = T;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<Option<&'_ T>, Option<T>> {
|
||||
type Matched = Option<T>;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<Option<&'_ &'_ T>, Option<T>> {
|
||||
type Matched = Option<T>;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<Option<T>, Option<&'_ T>> {
|
||||
type Matched = Option<T>;
|
||||
}
|
||||
|
||||
impl<T> MatchBorrowExt for MatchBorrow<Option<T>, Option<&'_ &'_ T>> {
|
||||
type Matched = Option<T>;
|
||||
}
|
||||
|
||||
impl<T, U> MatchBorrowExt for &'_ MatchBorrow<T, U> {
|
||||
type Matched = U;
|
||||
}
|
||||
@@ -125,5 +153,11 @@ fn test_match_borrow() {
|
||||
|
||||
let (_, match_borrow) = MatchBorrow::new(&&0i64, &0i64);
|
||||
let _: i64 = match_borrow.match_borrow();
|
||||
|
||||
let (_, match_borrow) = MatchBorrow::new(&0i64, &0i64);
|
||||
let _: i64 = match_borrow.match_borrow();
|
||||
|
||||
let (_, match_borrow) = MatchBorrow::new(0i64, &0i64);
|
||||
let _: i64 = match_borrow.match_borrow();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user