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

Testing Sync diverges on recursive type #54419

Open
RalfJung opened this issue Sep 21, 2018 · 2 comments
Open

Testing Sync diverges on recursive type #54419

RalfJung opened this issue Sep 21, 2018 · 2 comments
Labels
A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented Sep 21, 2018

Typechecking the following program diverges:

#![feature(never_type)]

struct Foo<'a, T: 'a> {
    ph: std::marker::PhantomData<T>,
    foo: &'a Foo<'a, (T, T)>,
}

fn wub(f: Foo<!>) {
    sync(f)
}

fn sync<T: Sync>(x: T) {}

fn main() {}

Cc @eddyb @nikomatsakis

@RalfJung RalfJung changed the title Testing Sync diverges on recursive uninhabited type Testing Sync diverges on recursive type Sep 21, 2018
bors added a commit that referenced this issue Sep 21, 2018
WIP: do not borrow non-Sync data in constants

We cannot share that data across threads. non-Sync is as bad as non-Freeze in that regard.

This is currently WIP because it ignores a test that is broken by #54419. But it is good enough ti get crater going.

Fixes #49206.

Cc @eddyb @nikomatsakis
@eddyb
Copy link
Member

eddyb commented Sep 21, 2018

Replacing (T, T) with T makes this compile, so I think it's definitely something about the polymorphic recursion / coinduction aspect of the definition that's causing this problem.

bors added a commit that referenced this issue Sep 21, 2018
WIP: do not borrow non-Sync data in constants

We cannot share that data across threads. non-Sync is as bad as non-Freeze in that regard.

This is currently WIP because it ignores a test that is broken by #54419. But it is good enough to get crater going.

Fixes #49206.

Cc @eddyb @nikomatsakis
@nikomatsakis
Copy link
Contributor

Fun.

@estebank estebank added the A-type-system Area: Type system label Sep 21, 2018
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
@fmease fmease added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants