[Pre-RFC] NonInternalMut auto trait (never mind)

#1

This post is removed by the author. The idea is incorrect. Thanks for your attention!

0 Likes

#2

Making code that used to compile not compile is a breaking change.

0 Likes

#3

It’s entirely possible to write a type that has interior mutability and upholds the invariants necessary for HashMap and BTreeMap to work.

0 Likes

#4

This also breaks all code that is parameterized over a type used as a key in a hashmap or hashset.

0 Likes

#5

Em, you are right. Thanks for all your reply. I would like to withdraw this post.

Thanks again!

0 Likes

#6

As an aside, please don’t do that! It’s pretty frustrating to come by and only see the remnants of a discussion. Nobodys judging you for starting a thread that did not turn into a revolution, so just leave it be, others might be interested nonetheless.

4 Likes

#7

Also, if you withdraw it then no one with the same idaya in the future can google to find the past discussion.

2 Likes

#8

Sorry for the inconvenience. My basic idea of this post is to introduce a auto trait NonInteriorMut to indicate whether a type has interior mutability or not. And add this trait as a constraint to the key type of associative containers (HashMap BTreeMap etc), to prevent keys being modified when they are in the container.

0 Likes

closed #9

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

0 Likes