-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Change error contains interior mutability
to may contain interior mutability
?
#40313
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
Comments
@rust-lang/lang: Do we want to make this change? If so, E-easy and E-mentor on me. I think it makes sense to edit the language; unfortunately I don't think we can do it only when referencing a trait object. This message needs to be updated to the new language and src/test/compile-fail/issue-17718-const-borrow.rs and src/librustc_mir/diagnostics.rs need updating as of the time of writing this. |
|
Okay, I've marked as E-easy and E-mentor; initial instructions are here. Let us know if you'd like to work on this or have any questions, we'd be happy to help. |
I'd like to take this up |
Go ahead! Let us know if you'd like any assistance. |
So we aren't doing it only while referencing a |
No, since that'd require doing this inside the compiler; we can get 95% of the way there by just changing the error message. There's not a good way to check in the annotation if the Self type is a trait object. |
Here's a link to my local branch. I've made the changes as you suggested followed by a |
Could you post a build log? By the way, I think to test you should run |
You changed |
@eddyb thanks! I happened to not notice that these two were indeed different. The error message regarding borrowing values appears here . That'll make the |
Updated the code here |
@gaurikholkar Yupp, looks great! |
Changing error message from `contains interior mutability` to `may contain interior mutability` Fixes rust-lang#40313 . I have changed the message from `contains interior mutability` to `may contain interior mutability` for the following example ``` use std::cell::Cell; use std::panic::catch_unwind; fn main() { let mut x = Cell::new(22); catch_unwind(|| { x.set(23); }); } ``` which has been added as a ui test. Also, the message [here](https://github.com/gaurikholkar/rust/blob/master/src/librustc_mir/transform/qualify_consts.rs#L666) and it's respective `compile-fail` test have been modified. cc @nikomatsakis @Mark-Simulacrum @eddyb
The following error is a bit misleading:
the type SomeTrait + 'static contains interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
Since
SomeTrait
is a trait object, it seems to memay contain (...)
is more precise.The text was updated successfully, but these errors were encountered: