File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
compiler/rustc_session/src/lint Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -2207,6 +2207,16 @@ declare_lint! {
22072207 /// }
22082208 /// }
22092209 /// ```
2210+ ///
2211+ /// ### Explanation
2212+ ///
2213+ /// Previous versions of Rust allowed function pointers and wide raw pointers in patterns.
2214+ /// While these work in many cases as expected by users, it is possible that due to
2215+ /// optimizations pointers are "not equal to themselves" or pointers to different functions
2216+ /// compare as equal during runtime. This is because LLVM optimizations can deduplicate
2217+ /// functions if their bodies are the same, thus also making pointers to these functions point
2218+ /// to the same location. Additionally functions may get duplicated if they are instantiated
2219+ /// in different crates and not deduplicated again via LTO.
22102220 pub POINTER_STRUCTURAL_MATCH ,
22112221 Allow ,
22122222 "pointers are not structural-match" ,
@@ -2246,6 +2256,13 @@ declare_lint! {
22462256 /// }
22472257 /// }
22482258 /// ```
2259+ ///
2260+ /// ### Explanation
2261+ ///
2262+ /// Previous versions of Rust accepted constants in patterns, even if those constants's types
2263+ /// did not have `PartialEq` derived. Thus the compiler falls back to runtime execution of
2264+ /// `PartialEq`, which can report that two constants are not equal even if they are
2265+ /// bit-equivalent.
22492266 pub NONTRIVIAL_STRUCTURAL_MATCH ,
22502267 Warn ,
22512268 "constant used in pattern of non-structural-match type and the constant's initializer \
You can’t perform that action at this time.
0 commit comments