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

ices/79565.sh: fixed with no errors #942

Merged
merged 1 commit into from
Aug 29, 2021
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#79565

#!/bin/bash

rustc -Zinstrument-coverage - << EOF
#![feature(const_generics)]
#![allow(incomplete_features)]

struct Foo {
    i: i32,
}

trait Get<'a, const N: &'static str> {
    type Target: 'a;

    fn get(&'a self) -> &'a Self::Target;
}

impl Foo {
    fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target
    where
        Self: Get<'a, N>,
    {
        self.get()
    }
}

impl<'a> Get<'a, "int"> for Foo {
    type Target = i32;

    fn get(&'a self) -> &'a Self::Target {
        &self.i
    }
}

fn main() {
    let foo = Foo { i: 123 };

    //println!("{}", foo.ask()); // okay
    println!("{}", foo.ask::<"int">()); // ICE
}
EOF
=== stdout ===
=== stderr ===
==============

=== stdout ===
=== stderr ===
==============
@Alexendoo Alexendoo merged commit db4a695 into master Aug 29, 2021
@Alexendoo Alexendoo deleted the autofix/ices/79565.sh branch August 29, 2021 11:36
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