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

Regression in Beta and Nightly in type inference #36352

Closed
Razican opened this issue Sep 8, 2016 · 6 comments
Closed

Regression in Beta and Nightly in type inference #36352

Razican opened this issue Sep 8, 2016 · 6 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Razican
Copy link
Contributor

Razican commented Sep 8, 2016

Stable build: https://travis-ci.org/SUPERAndroidAnalyzer/super/jobs/158500096
Beta build: https://travis-ci.org/SUPERAndroidAnalyzer/super/jobs/158500095
Nightly build: https://travis-ci.org/SUPERAndroidAnalyzer/super/jobs/158500094

Beta and nightly fail when trying to get a file name as a String from a PathBuf. The code is the following:

let dir_iter = try!(fs::read_dir("some/random/path"));
for f in dir_iter {
    let path_file = match f.unwrap().path().file_name() {
            Some(n) => String::from(n.to_string_lossy().borrow()),
            None => String::new(),
    };
    println!("{}", path_file);
}

And it also happens when getting the value from an AsRef<str>, in this example code:

pub fn new<S: AsRef<str>>(somedata: S) -> String {
    String::from(somedata.as_ref())
}

In both cases the error is the same:
type annotations required: cannot resolve std::string::String: std::convert::From<&_>

@arielb1
Copy link
Contributor

arielb1 commented Sep 8, 2016

That's because of the impl<'a> From<&'a [char]> for String impl added in ac73335f.

@arielb1 arielb1 added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Sep 8, 2016
@bluss bluss added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Sep 9, 2016
@alexcrichton
Copy link
Member

Thanks for the investigation @arielb1! This is essentially expected breakage as per our library stability conventions (e.g. fixable by a local type annotation).

I believe @sfackler is going to open an issue, however, to track a system to better deal with these, however.

@sfackler
Copy link
Member

#36443

@alexcrichton
Copy link
Member

Thanks @sfackler! Closing in favor of #36443

@brson
Copy link
Contributor

brson commented Sep 22, 2016

This was also reported 5 times on crater late in the beta cycle: #36352

@brson brson reopened this Sep 22, 2016
@brson
Copy link
Contributor

brson commented Sep 22, 2016

I'm opening this to consider reverting.

bors added a commit that referenced this issue Sep 24, 2016
Revert "implement `From<Vec<char>>` and `From<&'a [char]>` for `String`"

This reverts commit ac73335.

This is a revert of #35054, which resulted in at least 7 known regressions, reported [here](https://internals.rust-lang.org/t/regression-report-stable-2016-08-16-vs-beta-2016-09-21/4119) and [here](#36352), which will hit stable next week.

I think this breakage was somewhat unanticipated, and we did not realize so many crates were broken until this week, so reverting is the conservative thing to do until we figure out how not to cause so much breakage. I've run crater on the revert and did not find any new breakage from the revert.

Fixes #36352

cc @pwoolcoc @rust-lang/libs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants