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

\ escape error in CR LF line mode. #12821

Closed
liigo opened this issue Mar 11, 2014 · 1 comment
Closed

\ escape error in CR LF line mode. #12821

liigo opened this issue Mar 11, 2014 · 1 comment

Comments

@liigo
Copy link
Contributor

liigo commented Mar 11, 2014

fn main() {
    println!("Hello\
World.");
}

If I save the source to a file with CR-LF line mode (lines end with \r\n), will got the compile error:

rustc hello.rs
hello.rs:2:21: 2:22 error: unknown string escape: \r
hello.rs:2     println!("Hello\
                               ^
@huonw
Copy link
Member

huonw commented Mar 11, 2014

Dupe of #11669.

@huonw huonw closed this as completed Mar 11, 2014
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this issue Jul 22, 2022
…=Veykril

fix: Correctly generate default `PartialEq::ne`

Fixes rust-lang#12779

For the `Generate default members` assist on the `PartialEq` trait, the assist will now give the default implementation instead of generating a function.
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this issue Jul 26, 2022
…gen, r=Veykril

fix: don't replace default members' body

cc rust-lang#12779, rust-lang#12821
addresses rust-lang/rust-analyzer#12821 (comment)

`gen_trait_fn_body()` only attempts to implement required trait member functions, so we shouldn't call it for `Implement default members` assist.

This patch also documents the precondition of `gen_trait_fn_body()` and inserts `debug_assert!`, but I'm not entirely sure if the assertions are appropriate.
bors added a commit to rust-lang-ci/rust that referenced this issue May 30, 2024
…interaction, r=y21

Fix `unnecessary_to_owned` interaction with macro expansion

fixes rust-lang#12821

In the case of an unnecessary `.iter().cloned()`, the lint `unnecessary_to_owned` might suggest to remove the `&` from references without checking if such references are inside a macro expansion. This can lead to unexpected behavior or even broken code if the lint suggestion is applied blindly. See issue rust-lang#12821 for an example.

This PR checks if such references are inside macro expansions and skips this part of the lint suggestion in these cases.

changelog: [`unnecessary_to_owned`]: Don't suggest to remove `&` inside macro expansion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants