Skip to content

Commit b082e80

Browse files
committed
Auto merge of #107688 - lukas-code:projection-with-lifetime, r=jackh726
ReErased regions are local fix #107678 fix #107684 fix #107686 fix #107691 fix #107730
2 parents 3f059f6 + e2a1a2a commit b082e80

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

compiler/rustc_type_ir/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ bitflags! {
220220
// which is different from how types/const are freshened.
221221
| TypeFlags::HAS_TY_FRESH.bits
222222
| TypeFlags::HAS_CT_FRESH.bits
223-
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits;
223+
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits
224+
| TypeFlags::HAS_RE_ERASED.bits;
224225

225226
/// Does this have `Projection`?
226227
const HAS_TY_PROJECTION = 1 << 10;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// build-pass
2+
3+
#![crate_type = "lib"]
4+
5+
pub trait StreamOnce {
6+
type Error;
7+
}
8+
9+
pub trait ResetStream: StreamOnce {
10+
fn reset(&mut self) -> Result<(), Self::Error>;
11+
}
12+
13+
impl<'a> ResetStream for &'a str
14+
where Self: StreamOnce
15+
{
16+
#[inline]
17+
fn reset(&mut self) -> Result<(), Self::Error> {
18+
Ok(())
19+
}
20+
}

tests/ui/mir/issue-107691.rs

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// build-pass
2+
// compile-flags: -C opt-level=3
3+
4+
#![crate_type = "lib"]
5+
6+
pub trait Archive {
7+
type Archived;
8+
type Resolver;
9+
10+
fn resolve(resolver: Self::Resolver, out: *mut Self::Archived);
11+
}
12+
13+
pub type Archived<T> = <T as Archive>::Archived;
14+
pub type Resolver<T> = <T as Archive>::Resolver;
15+
16+
pub struct Record<'a> {
17+
_payload: &'a [u8],
18+
}
19+
20+
pub struct ArchivedRecord<'a>
21+
where
22+
&'a [u8]: Archive,
23+
{
24+
_payload: Archived<&'a [u8]>,
25+
}
26+
27+
pub struct RecordResolver<'a>
28+
where
29+
&'a [u8]: Archive,
30+
{
31+
_payload: Resolver<&'a [u8]>,
32+
}
33+
34+
impl<'a> Archive for Record<'a>
35+
where
36+
&'a [u8]: Archive,
37+
{
38+
type Archived = ArchivedRecord<'a>;
39+
type Resolver = RecordResolver<'a>;
40+
41+
fn resolve(_resolver: Self::Resolver, _out: *mut Self::Archived) {}
42+
}

tests/ui/recursion/issue-83150.stderr

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ LL | func(&mut iter.map(|x| x + 1))
99
= help: a `loop` may express intention better if this is on purpose
1010
= note: `#[warn(unconditional_recursion)]` on by default
1111

12-
error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>: Iterator`
12+
error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:12:24: 12:27]>: Iterator`
1313
|
1414
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
15+
= note: required for `&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:12:24: 12:27]>` to implement `Iterator`
16+
= note: 65 redundant requirements hidden
1517
= note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `Iterator`
1618
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt'
1719

0 commit comments

Comments
 (0)