about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-26 07:53:24 +0100
committerGitHub <noreply@github.com>2023-01-26 07:53:24 +0100
commitd667105681726fe84ef6256b8a75b2e770bed3e6 (patch)
tree87b00669fd6acf4cb99e95fe4944ed81bf0aa5dc
parent35a8d6fea4ae1770b1c819f7686be7b2355981c1 (diff)
parent25f0147db2ca7538ab9324d63bc1e0060f67f9c8 (diff)
downloadrust-d667105681726fe84ef6256b8a75b2e770bed3e6.tar.gz
rust-d667105681726fe84ef6256b8a75b2e770bed3e6.zip
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
implement Hash for proc_macro::LineColumn

For use in `HashMap<LineColumn, TokenTree>` or `HashMap<LineColumn, Comment>`, for example.

[Here is an example of one case complicated by the absence of this impl.](https://github.com/andrewbaxter/genemichaels/blob/71bc45e417c3f9dae09f890f1ec4630e758e5c70/src/comments.rs#L25-L34)

Tracking issue: https://github.com/rust-lang/rust/issues/54725
-rw-r--r--library/proc_macro/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs
index f0e4f5d8a80..1699f0d55bc 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -581,7 +581,7 @@ impl fmt::Debug for Span {
 
 /// A line-column pair representing the start or end of a `Span`.
 #[unstable(feature = "proc_macro_span", issue = "54725")]
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
 pub struct LineColumn {
     /// The 1-indexed line in the source file on which the span starts or ends (inclusive).
     #[unstable(feature = "proc_macro_span", issue = "54725")]