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

ices/108271-2.rs: fixed with errors #1719

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#108271

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

pub trait TraitWAssocConst {
    const A: dyn TraitWAssocConst<A = 0>;
}

fn bar<A: TraitWAssocConst<A = 0>>() {}

fn main() {}
=== stdout ===
=== stderr ===
error[E0658]: associated const equality is incomplete
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:35
  |
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |                                   ^^^^^
  |
  = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
  = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
  = note: this compiler was built on 2024-03-18; consider upgrading it if it is out of date

error[E0658]: associated const equality is incomplete
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:8:28
  |
8 | fn bar<A: TraitWAssocConst<A = 0>>() {}
  |                            ^^^^^
  |
  = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
  = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
  = note: this compiler was built on 2024-03-18; consider upgrading it if it is out of date

error[E0391]: cycle detected when computing type of `TraitWAssocConst::A`
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:5
  |
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: ...which immediately requires computing type of `TraitWAssocConst::A` again
note: cycle used when computing explicit predicates of `bar`
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:8:1
  |
8 | fn bar<A: TraitWAssocConst<A = 0>>() {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = 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: the type of the associated constant `A` must not depend on generic parameters
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:8:28
  |
8 | fn bar<A: TraitWAssocConst<A = 0>>() {}
  |        -                   ^ its type must not depend on the type parameter `A`
  |        |
  |        the type parameter `A` is defined here

error: associated item referring to unboxed trait object for its own trait
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:14
  |
4 | pub trait TraitWAssocConst {
  |           ---------------- in this trait
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: you might have meant to use `Self` to refer to the implementing type
  |
5 |     const A: Self;
  |              ~~~~

error[E0038]: the trait `TraitWAssocConst` cannot be made into an object
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:14
  |
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TraitWAssocConst` cannot be made into an object
  |
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:11
  |
4 | pub trait TraitWAssocConst {
  |           ---------------- this trait cannot be made into an object...
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |           ^ ...because it contains this associated `const`
  = help: consider moving `A` to another trait

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0038, E0391, E0658.
For more information about an error, try `rustc --explain E0038`.
==============

=== stdout ===
=== stderr ===
error[E0658]: associated const equality is incomplete
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:35
  |
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |                                   ^^^^^
  |
  = note: see issue #92827 <rust-lang/rust#92827> for more information
  = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
  = note: this compiler was built on 2024-03-18; consider upgrading it if it is out of date

error[E0658]: associated const equality is incomplete
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:8:28
  |
8 | fn bar<A: TraitWAssocConst<A = 0>>() {}
  |                            ^^^^^
  |
  = note: see issue #92827 <rust-lang/rust#92827> for more information
  = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
  = note: this compiler was built on 2024-03-18; consider upgrading it if it is out of date

error[E0391]: cycle detected when computing type of `TraitWAssocConst::A`
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:5
  |
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: ...which immediately requires computing type of `TraitWAssocConst::A` again
note: cycle used when computing explicit predicates of `bar`
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:8:1
  |
8 | fn bar<A: TraitWAssocConst<A = 0>>() {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = 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: the type of the associated constant `A` must not depend on generic parameters
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:8:28
  |
8 | fn bar<A: TraitWAssocConst<A = 0>>() {}
  |        -                   ^ its type must not depend on the type parameter `A`
  |        |
  |        the type parameter `A` is defined here

error: associated item referring to unboxed trait object for its own trait
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:14
  |
4 | pub trait TraitWAssocConst {
  |           ---------------- in this trait
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: you might have meant to use `Self` to refer to the implementing type
  |
5 |     const A: Self;
  |              ~~~~

error[E0038]: the trait `TraitWAssocConst` cannot be made into an object
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:14
  |
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TraitWAssocConst` cannot be made into an object
  |
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
 --> /home/runner/work/glacier/glacier/ices/108271-2.rs:5:11
  |
4 | pub trait TraitWAssocConst {
  |           ---------------- this trait cannot be made into an object...
5 |     const A: dyn TraitWAssocConst<A = 0>;
  |           ^ ...because it contains this associated `const`
  = help: consider moving `A` to another trait

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0038, E0391, E0658.
For more information about an error, try `rustc --explain E0038`.
==============
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant