Skip to content

Implied bounds compat mode does not deduce sufficient outlives bounds #137767

Closed
@compiler-errors

Description

@compiler-errors

I tried this code:

pub trait Iter {
    type Item;
}

impl<'x, I> Iter for I
where
    I: IntoIterator<Item = &'x ()>,
{
    type Item = &'x ();
}

pub struct Map<I>(I)
where
    I: Iter,
    I::Item: 'static;

pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str {
    s
}

fn main() {}

I expected to see it work.

Instead, it did not.

Meta

1.85 + beta + nightly for Feb 27, 2025

Metadata

Metadata

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions