Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/111176.rs: fixed with errors #1656

Merged
merged 1 commit into from
Oct 15, 2023
Merged

ices/111176.rs: fixed with errors #1656

merged 1 commit into from
Oct 15, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#111176

use std::mem;

pub struct S<T: Tr> {
    pub f: <T as Tr>::I,
}

pub trait Tr {
   type I: Tr;
}

impl<T: Tr> Tr for S<T> {
    type I = S<S<T>>;
}

impl Tr for () {
    type I = ();
}

fn foo<T: Tr>() -> usize {
    mem::size_of::<S<T>>()
}

fn main() {
    println!("{}", foo::<S<()>>());
}
=== stdout ===
=== stderr ===
error[E0391]: cycle detected when computing layout of `S<S<()>>`
  |
  = note: ...which requires computing layout of `<S<()> as Tr>::I`...
  = note: ...which again requires computing layout of `S<S<()>>`, completing the cycle
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: failed to get layout for S<S<()>>: a cycle occurred during layout computation

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0391`.
==============

=== stdout ===
=== stderr ===
error[E0391]: cycle detected when computing layout of `S<S<()>>`
  |
  = note: ...which requires computing layout of `<S<()> as Tr>::I`...
  = note: ...which again requires computing layout of `S<S<()>>`, completing the cycle
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: failed to get layout for S<S<()>>: a cycle occurred during layout computation

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0391`.
==============
@JohnTitor JohnTitor merged commit 938d903 into master Oct 15, 2023
@JohnTitor JohnTitor deleted the autofix/ices/111176.rs branch October 15, 2023 03:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants