forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#107688 - lukas-code:projection-with-lifetime,…
… r=jackh726 ReErased regions are local fix rust-lang#107678 fix rust-lang#107684 fix rust-lang#107686 fix rust-lang#107691 fix rust-lang#107730
- Loading branch information
Showing
4 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// build-pass | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub trait StreamOnce { | ||
type Error; | ||
} | ||
|
||
pub trait ResetStream: StreamOnce { | ||
fn reset(&mut self) -> Result<(), Self::Error>; | ||
} | ||
|
||
impl<'a> ResetStream for &'a str | ||
where Self: StreamOnce | ||
{ | ||
#[inline] | ||
fn reset(&mut self) -> Result<(), Self::Error> { | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// build-pass | ||
// compile-flags: -C opt-level=3 | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub trait Archive { | ||
type Archived; | ||
type Resolver; | ||
|
||
fn resolve(resolver: Self::Resolver, out: *mut Self::Archived); | ||
} | ||
|
||
pub type Archived<T> = <T as Archive>::Archived; | ||
pub type Resolver<T> = <T as Archive>::Resolver; | ||
|
||
pub struct Record<'a> { | ||
_payload: &'a [u8], | ||
} | ||
|
||
pub struct ArchivedRecord<'a> | ||
where | ||
&'a [u8]: Archive, | ||
{ | ||
_payload: Archived<&'a [u8]>, | ||
} | ||
|
||
pub struct RecordResolver<'a> | ||
where | ||
&'a [u8]: Archive, | ||
{ | ||
_payload: Resolver<&'a [u8]>, | ||
} | ||
|
||
impl<'a> Archive for Record<'a> | ||
where | ||
&'a [u8]: Archive, | ||
{ | ||
type Archived = ArchivedRecord<'a>; | ||
type Resolver = RecordResolver<'a>; | ||
|
||
fn resolve(_resolver: Self::Resolver, _out: *mut Self::Archived) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters