Skip to content

Incremental: code is not recompiled when a case of string literal is changed #49783

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

Closed
matklad opened this issue Apr 8, 2018 · 2 comments
Closed

Comments

@matklad
Copy link
Member

matklad commented Apr 8, 2018

Originally reported by @redcape at rust-lang/cargo#5320

~/trash
λ rustc --version
rustc 1.26.0-beta.2 (0e350672e 2018-04-05)

λ cat main.rs
fn main() {
    let test_str = "a man a plan a canal panama";
    println!("{}", is_palindrome(test_str));
}

fn is_palindrome(test_str: &str) -> bool {
    use std::iter::FromIterator;

    let non_whitespace = |p : &char| !p.is_whitespace();
    let forward_iter = test_str.chars().filter(non_whitespace);
    let rev_iter = test_str.chars().rev().filter(non_whitespace);
    println!("{:?}", String::from_iter(test_str.chars()));
    println!("{:?}", String::from_iter(test_str.chars().rev()));
    println!("{:?}", String::from_iter(forward_iter.clone()));
    println!("{:?}", String::from_iter(rev_iter.clone()));
    forward_iter.eq(rev_iter)
}

~/trash
λ rustc main.rs -C incremental=inc

~/trash
λ ./main
"a man a plan a canal panama"
"amanap lanac a nalp a nam a"
"amanaplanacanalpanama"
"amanaplanacanalpanama"
true

~/trash
λ vim main.rs # change `"a man` to `"A man`

~/trash
λ cat main.rs
fn main() {
    let test_str = "A man a plan a canal panama";
    println!("{}", is_palindrome(test_str));
}

fn is_palindrome(test_str: &str) -> bool {
    use std::iter::FromIterator;

    let non_whitespace = |p : &char| !p.is_whitespace();
    let forward_iter = test_str.chars().filter(non_whitespace);
    let rev_iter = test_str.chars().rev().filter(non_whitespace);
    println!("{:?}", String::from_iter(test_str.chars()));
    println!("{:?}", String::from_iter(test_str.chars().rev()));
    println!("{:?}", String::from_iter(forward_iter.clone()));
    println!("{:?}", String::from_iter(rev_iter.clone()));
    forward_iter.eq(rev_iter)
}

~/trash
λ ./main
"a man a plan a canal panama" # should be capital A here
"amanap lanac a nalp a nam a"
"amanaplanacanalpanama"
"amanaplanacanalpanama"
true
@sinkuu
Copy link
Contributor

sinkuu commented Apr 8, 2018

This will be fixed in the next nightly (#49752).

@matklad
Copy link
Member Author

matklad commented Apr 8, 2018

Seems like it, closing then, thanks @sinkuu !

@matklad matklad closed this as completed Apr 8, 2018
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