-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
const_fn_trait_bound
causes rustc not to recognize trait bounds
#88071
Comments
So this is odd: if you move the Ord bound to the function it works fine: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=1bec0846e3c540afc36b436b508947f1 and if you add both bounds it stops working, which is pretty incomprehensible to me: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=fcd4b29d4f01dba3eacaaacb0cdbae5e |
This is definitely related to |
const_fn_trait_bound
causes rustc not to recognize trait bounds
It seems that you don't even need to specify a trait bound in your code to cause this bug. The following code breaks for me: pub struct PidPool {
pool: BTreeSet<u32>,
}
impl PidPool {
pub const fn new() -> PidPool {
PidPool {
pool: BTreeSet::new(),
}
}
} which gives the following very weird output on nightly:
(But anyway, there is a trait bound specified in |
Update: I'm not quite sure what happened, but it seems that this problem is already fixed in the latest nightly, and both code snippets can now be compiled without problem. Maybe it's time to close this issue. (This issue should be some kind of regression introduced at some point between |
add some more testcases resolves rust-lang#52893 resolves rust-lang#68295 resolves rust-lang#87750 resolves rust-lang#88071 All these issues have been fixed according to glacier. Just adding a test so it can be closed. Can anybody tell me why the github keywords do not work? 🤔 Please edit this post if you can fix it.
add some more testcases resolves rust-lang#52893 resolves rust-lang#68295 resolves rust-lang#87750 resolves rust-lang#88071 All these issues have been fixed according to glacier. Just adding a test so it can be closed. Can anybody tell me why the github keywords do not work? 🤔 Please edit this post if you can fix it.
I replaced lib.rs with this code after creating an empty lib:
When running
cargo build
, I expected to see this happen: built successfullyInstead, this happened:
And when I followed the suggestions it offered, it turned into a type mismatch error and wanted me to cancel the borrowing.
Meta
rustc --version --verbose
:The output of
RUST_BACKTRACE=1 cargo build
is the same as above.The text was updated successfully, but these errors were encountered: