-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
nightly-2021-10-01: the trait From<&str>
is not implemented for std::string::String
#89432
Comments
This also appears to impact the use of major Rust libraries such as
|
Thanks for the report! Unfortunately I am unable to reproduce with the given example. As written, it doesn't compile with the @npmccallum Or maybe you can put something together? I tried running the testsuite for structopt itself without any problems. |
@ehuss I tried to do the same and compilation succeeded. play.rust-lang.org doesn't have the affected nightly build. However, our open source code is failing to build. I'm not dismissing the possibility that rust may be catching some bad code on our part. But the compiler recommended fixes seem very odd... |
This works around this bug: rust-lang/rust#89432 Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
@oli-obk or @fee1-dead , any thoughts? |
Minimized: pub const fn foo() -> impl FnOnce() -> String {
|| "foo".into()
} I guess it's forcing |
Well, mine can't be all of it, because not all of the errors are from |
Here's a better one, which does work on beta: const FOO: fn() -> String = || "foo".into();
pub fn bar() -> fn() -> String {
|| "bar".into()
} The presence of
|
Short term we should revert #86853. Longer term I believe this is due to global caching of predicate evaluations. We'll need to think about how const traits play into that, since their successful evaluation depends on the context's constness, which is obviously not global |
Shouldn't it be added to |
Revert-PR created #89450 |
Co-authored-by: Josh Stone <cuviper@gmail.com>
Revert rust-lang#86853 Should fix issue found in rust-lang#89432
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-critical |
The revert has landed, we'll unrevert once we have the param env fix |
Rust nightly started giving us compilation problems, so pin to a known-good version until it's fixed/reverted. See rust-lang/rust#89432 for details. Signed-off-by: Will Woods <will@profian.com>
Rust nightly started giving us compilation problems, so pin to a known-good version until it's fixed/reverted. See rust-lang/rust#89432 for details. Signed-off-by: Will Woods <will@profian.com>
Here is another MCVE which is what seems to cause the error: playground #![feature(const_trait_impl)]
#![feature(const_fn_trait_bounds)]
trait Convert<T> {
fn to(self) -> T;
}
impl<A, B> const Convert<B> for A where B: ~const From<A> {
fn to(self) -> B {
B::from(self)
}
}
const FOO: fn() -> String = || "foo".to(); |
Eliminate ConstnessAnd again Closes rust-lang#91489. Closes rust-lang#89432. Reverts rust-lang#91491. Reverts rust-lang#89450. r? `@spastorino`
I tried this code:
I expected to see this happen:
Successful compilation. This has compiled and worked for years until
nightly-2021-10-01
. Reverting tonightly-2021-09-30
produces a successful compilation.Instead, this happened:
Meta
rustc --version --verbose
:cc @haraldh @wgwoods
The text was updated successfully, but these errors were encountered: