-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
"Calls in const functions are limited to..." error should specifically say what part isn't const #92380
Comments
Going to add this case here as well, since I think it goes along with the trait variant. Take this code: https://gist.github.com/486de68ccf35f90a4e6814365d0ee295 struct Test<T>(T);
impl<T> Test<T> {
const fn const_drop(self) {
}
} Gives this output:
When we could suggest adding a However, we should at least point out that the destructor in question is the one for |
… r=oli-obk More informative error message for E0015 Helps with rust-lang#92380
… r=oli-obk More informative error message for E0015 Helps with rust-lang#92380
… r=oli-obk More informative error message for E0015 Helps with rust-lang#92380
… r=oli-obk More informative error message for E0015 Helps with rust-lang#92380
These should be fixed. |
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6d59a86fd2dbb93ed78e8f9108afe083
The current output is:
Although the carets technically make it clear which function is at fault since you can check what the outermost call is, this really kind of sucks. The actual source of the error can further be obscured if the functions are called through traits or macros, since it's harder to determine the actual non-const function that caused the error.
A few things that I think would help, in no particular order:
impl const
, instead of just annotating the function. If the user doesn't have the necessary features enabled, we should also point out what features the user would have to enable.The text was updated successfully, but these errors were encountered: