Skip to content

internal compiler error with impl Aaa for &mut Aaa #17771

Closed

Description

@stepancheg

Code:

trait Aaa {}

impl<'a> Aaa for &'a mut Aaa + 'a {}

struct Bar<'a> {
    writer: &'a mut Aaa + 'a,
}

fn baz(_: &mut Aaa) {
}

fn foo<'a>(mut bar: Bar<'a>) {
    baz(&mut bar.writer);
}

fn main() {
}
error: internal compiler error: trying to take the sizing type of Aaa+'a, an unsized type

Activity

  1. nodakai commented on Oct 5, 2014

    @nodakai
    Contributor

    @stepancheg Can you check if this is the same issue as #17351 ?

  2. stepancheg commented on Oct 5, 2014

    @stepancheg
    ContributorAuthor

    @nodakai I don't know, looks similar.

  3. ghost added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Oct 25, 2014
  4. ghost removed
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Oct 25, 2014
  5. nodakai commented on Nov 28, 2014

    @nodakai
    Contributor

    Added parenthesis as per PR #19298 and then it compiled fine.

    trait Aaa {}
    
    impl<'a> Aaa for &'a mut (Aaa + 'a) {}
    
    struct Bar<'a> {
        writer: &'a mut (Aaa + 'a),
    }
    
    fn baz(_: &mut Aaa) {
    }
    
    fn foo<'a>(mut bar: Bar<'a>) {
        baz(&mut bar.writer);
    }
    
    fn main() {
    }
  6. ghost added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Dec 12, 2014
  7. added 3 commits that reference this issue on Dec 12, 2014
    20cbbff
    c59b9b7
  8. added a commit that references this issue on Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions