Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeated TAIT doesn't detect lifetime conflict #86465

Closed
nikomatsakis opened this issue Jun 19, 2021 · 4 comments · Fixed by #87287
Closed

repeated TAIT doesn't detect lifetime conflict #86465

nikomatsakis opened this issue Jun 19, 2021 · 4 comments · Fixed by #87287
Assignees
Labels
A-traits Area: Trait system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jun 19, 2021

This code compiles, but it should not:

#![feature(min_type_alias_impl_trait)]

type X<'a, 'b> = impl std::fmt::Debug;

fn f<'t, 'u>(a: &'t u32, b: &'u u32) -> (X<'t, 'u>, X<'u, 't>) {
    (a, a)
}

The function creates two constraints:

  • X<'t, 'u> = &'t u32, which means type X<'a, 'b> = &'a u32
  • X<'u, 't> = &'t u32, which means type X<'a, 'b> = &'b u32

These should not both be satisfiable!

@nikomatsakis nikomatsakis added A-traits Area: Trait system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` labels Jun 19, 2021
@nikomatsakis
Copy link
Contributor Author

@rustbot assign @spastorino

@nikomatsakis
Copy link
Contributor Author

@rustbot assign @nikomatsakis

I have been working on this. It might also make sense to assign to @oli-obk instead though.

@rustbot rustbot assigned nikomatsakis and unassigned spastorino Jul 7, 2021
@nikomatsakis
Copy link
Contributor Author

@rustbot assign @oli-obk

@rustbot rustbot assigned oli-obk and unassigned nikomatsakis Jul 7, 2021
@nikomatsakis
Copy link
Contributor Author

In progress PR: #86410

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jul 21, 2021
…pes, r=spastorino

 Make mir borrowck's use of opaque types independent of the typeck query's result

fixes rust-lang#87218
fixes rust-lang#86465

we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result.

When i removed the `fixup_opaque_types` function in rust-lang#87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information.

We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead.

r? `@spastorino`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jul 21, 2021
…pes, r=spastorino

 Make mir borrowck's use of opaque types independent of the typeck query's result

fixes rust-lang#87218
fixes rust-lang#86465

we used to use the typeck results only to generate an obligation for the mir borrowck type to be equal to the typeck result.

When i removed the `fixup_opaque_types` function in rust-lang#87200, I exposed a bug that showed that mir borrowck can't doesn't get enough information from typeck in order to build the correct lifetime mapping from opaque type usage to the actual concrete type. We therefor now fully compute the information within mir borrowck (we already did that, but we only used it to verify the typeck result) and stop using the typeck information.

We will likely be able to remove most opaque type information from the borrowck results in the future and just have all current callers use the mir borrowck result instead.

r? ``@spastorino``
@bors bors closed this as completed in b2b7c85 Jul 23, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 23, 2021
…i-obk

VecMap::get_value_matching should return just one element

r? `@nikomatsakis`

Related to rust-lang#86465 and rust-lang#87287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants