Skip to content

ICE for adding block to str #10401

Closed
@klutzy

Description

@klutzy
Contributor
fn main() {
    let a = "a";
    a += { "b" }; // oops
}

This causes ICE as well as normal error:

a.rs:3:4: 3:16 error: binary operation + cannot be applied to type `&'static str`
a.rs:3     a += { "b" }; // oops
           ^~~~~~~~~~~~
error: internal compiler error: no type for node 16: block { "b" } (id=16) in fcx 0x7fdaac1165b0

As a consequence, a += format!(...); triggers same error. Same for a += {};.

cc #9942 and #10091 since they just share same ICE message.

Activity

alexcrichton

alexcrichton commented on Mar 1, 2014

@alexcrichton
Member

This has been fixed, flagging as needstest.

added a commit that references this issue on Mar 6, 2014
13e10f5
added a commit that references this issue on Mar 6, 2014

auto merge of #12738 : alexcrichton/rust/needstest, r=brson,just

0e95b08
added a commit that references this issue on Feb 26, 2023

Auto merge of rust-lang#10401 - samueltardieu:issue-10148, r=Alexendoo

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @alexcrichton@klutzy

      Issue actions

        ICE for adding block to str · Issue #10401 · rust-lang/rust