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

ices/103507.rs: fixed with errors #1629

Merged
merged 1 commit into from
Oct 15, 2023
Merged

ices/103507.rs: fixed with errors #1629

merged 1 commit into from
Oct 15, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#103507

#![feature(type_alias_impl_trait)]
#![feature(const_trait_impl)]
#![feature(const_refs_to_cell)]
#![feature(inline_const)]

use std::marker::Destruct;

trait T {
    type Item;
}

type Alias<'a> = impl T<Item = &'a ()>;

struct S;
impl<'a> T for &'a S {
    type Item = &'a ();
}

const fn filter_positive<'a>() -> &'a Alias<'a> {
    &&S
}

const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
    fun(filter_positive());
}

const fn foo(_: &Alias<'_>) {}

const BAR: () = {
    with_positive(foo);
};

fn main() {}
=== stdout ===
=== stderr ===
error[E0493]: destructor of `F` cannot be evaluated at compile-time
  --> /home/runner/work/glacier/glacier/ices/103507.rs:23:79
   |
23 | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
   |                                                                               ^^^ the destructor for this type cannot be evaluated in constant functions
24 |     fun(filter_positive());
25 | }
   | - value is dropped here

error: aborting due to previous error

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

=== stdout ===
=== stderr ===
error[E0493]: destructor of `F` cannot be evaluated at compile-time
  --> /home/runner/work/glacier/glacier/ices/103507.rs:23:79
   |
23 | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
   |                                                                               ^^^ the destructor for this type cannot be evaluated in constant functions
24 |     fun(filter_positive());
25 | }
   | - value is dropped here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0493`.
==============
@JohnTitor JohnTitor merged commit 9cfd12b into master Oct 15, 2023
@JohnTitor JohnTitor deleted the autofix/ices/103507.rs branch October 15, 2023 03:02
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