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

ices/113378.rs: fixed with errors #1708

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jan 5, 2024

Issue: rust-lang/rust#113378

#![feature(const_trait_impl)]
#![feature(effects)]

trait Value {}

impl<T> const Value for T {
    const fn value() -> u32 {
        0
    }
}

fn main() {}
=== stdout ===
=== stderr ===
error[E0379]: functions in trait impls cannot be declared const
 --> /home/runner/work/glacier/glacier/ices/113378.rs:7:5
  |
6 | impl<T> const Value for T {
  |         ----- this declares all associated functions implicitly const
7 |     const fn value() -> u32 {
  |     ^^^^^-
  |     |
  |     functions in trait impls cannot be const
  |     help: remove the `const`

error[E0407]: method `value` is not a member of trait `Value`
 --> /home/runner/work/glacier/glacier/ices/113378.rs:7:5
  |
7 | /     const fn value() -> u32 {
8 | |         0
9 | |     }
  | |_____^ not a member of trait `Value`

error: const `impl` for trait `Value` which is not marked with `#[const_trait]`
 --> /home/runner/work/glacier/glacier/ices/113378.rs:6:15
  |
4 | trait Value {}
  | - help: mark `Value` as const: `#[const_trait]`
5 |
6 | impl<T> const Value for T {
  |               ^^^^^
  |
  = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
  = note: adding a non-const method body in the future would be a breaking change

error: aborting due to 3 previous errors

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

=== stdout ===
=== stderr ===
error[E0379]: functions in trait impls cannot be declared const
 --> /home/runner/work/glacier/glacier/ices/113378.rs:7:5
  |
6 | impl<T> const Value for T {
  |         ----- this declares all associated functions implicitly const
7 |     const fn value() -> u32 {
  |     ^^^^^-
  |     |
  |     functions in trait impls cannot be const
  |     help: remove the `const`

error[E0407]: method `value` is not a member of trait `Value`
 --> /home/runner/work/glacier/glacier/ices/113378.rs:7:5
  |
7 | /     const fn value() -> u32 {
8 | |         0
9 | |     }
  | |_____^ not a member of trait `Value`

error: const `impl` for trait `Value` which is not marked with `#[const_trait]`
 --> /home/runner/work/glacier/glacier/ices/113378.rs:6:15
  |
4 | trait Value {}
  | - help: mark `Value` as const: `#[const_trait]`
5 |
6 | impl<T> const Value for T {
  |               ^^^^^
  |
  = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
  = note: adding a non-const method body in the future would be a breaking change

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0379, E0407.
For more information about an error, try `rustc --explain E0379`.
==============
@JohnTitor JohnTitor merged commit 799fe69 into master Jan 5, 2024
@JohnTitor JohnTitor deleted the autofix/ices/113378.rs branch January 5, 2024 12:27
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