Patchwork D10742: rust: Add type annotation to fix inference on Rust Nightly

login
register
mail settings
Submitter phabricator
Date May 19, 2021, 1:22 p.m.
Message ID <differential-rev-PHID-DREV-x3ky6m4zgf5emy6nhitz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49062/
State Superseded
Headers show

Comments

phabricator - May 19, 2021, 1:22 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When compiling with Rust Nightly, the im-rs crate silently makes use of the
  experimental language feature for trait impl specialization. This apperently
  changes public its APIs in subtle ways such that type inference of some user
  code can fail where it succeeds when specialization is disabled.
  
  This made Mercurial’s Rust unit tests have compilation errors on Nightly.
  
  I have not managed to find the exactl root cause, but I wrote down my findings
  so far at https://github.com/bodil/im-rs/issues/188
  
  This adds type annotation to make unit tests rely less on type inference
  and work around the issue.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10742

AFFECTED FILES
  rust/hg-core/src/copy_tracing/tests_support.rs

CHANGE DETAILS




To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/copy_tracing/tests_support.rs b/rust/hg-core/src/copy_tracing/tests_support.rs
--- a/rust/hg-core/src/copy_tracing/tests_support.rs
+++ b/rust/hg-core/src/copy_tracing/tests_support.rs
@@ -123,7 +123,10 @@ 
                     ),
                 )
             })
-            .collect::<OrdMap<_, _>>()
+            .collect::<OrdMap<
+                String,
+                (Revision, Option<String>, OrdSet<Revision>)
+            >>()
         }
     };
 }