Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE for adding block to str #10401

Closed
klutzy opened this issue Nov 10, 2013 · 1 comment · Fixed by #12738
Closed

ICE for adding block to str #10401

klutzy opened this issue Nov 10, 2013 · 1 comment · Fixed by #12738
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@klutzy
Copy link
Contributor

klutzy commented Nov 10, 2013

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.

@alexcrichton
Copy link
Member

This has been fixed, flagging as needstest.

bors added a commit that referenced this issue Mar 6, 2014
Closes #6738
Closes #7061
Closes #7899
Closes #9719
Closes #10028
Closes #10228
Closes #10401
Closes #11192
Closes #11508
Closes #11529
Closes #11873
Closes #11925
Jarcho pushed a commit to Jarcho/rust that referenced this issue Feb 26, 2023
Do not panic when analyzing the malformed origin of a format string

Fixes rust-lang#10148. This will trigger only when generating format strings while accepting weird things in a procedural macro and setting the span to something which is not a string.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants