Skip to content

Beta regression in span printing with tabs involved #47377

Closed
@est31

Description

@est31

This code (containing tabs) gives an error (playground):

	let b = "hello";
	let _a = b + ", World!";

The error works fine on stable:

  |
3 |  let _a = b + ", World!";
  |           ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
  |
3 |  let _a = b.to_owned() + ", World!";
  |           ^^^^^^^^^^^^

But is mispositioned on rustc 1.25.0-nightly (73ac5d6 2018-01-11) as well as on rustc 1.24.0-beta.2 (a19122c 2018-01-10):

  |
3 |     let _a = b + ", World!";
  |              ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
  |
3 |     let _a = b.to_owned() + ", World!";
  |           ^^^^^^^^^^^^

cc @estebank

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions