Commit 5eb7480
committed
feat(SourceId): use stable hash from rustc-stable-hash
This helps `-Ztrim-paths` build a stable cross-platform path for the
registry and git sources. Sources files then can be found from the same
path when debugging.
It also helps cache registry index all at once for all platforms,
for example the use case in #14795
(despite they should use `cargo vendor` instead IMO).
Some caveats:
* Newer cargo will need to re-download files for global caches
(index files, git/registry sources).
The old cache is still kept and used when running with older cargoes.
* Windows is not really covered by the "cross-platform" hash,
because path prefix components like `C:` are always there.
That means hashes of some sources kind,
like local registry and local path,
are not going to be real cross-platform stable.
There might be hash collisions if you have two registries under the same
domain. This won't happen to crates.io, as the infra would have to
intentionally put another registry on index.crates.io to collide.
We don't consider this is an actual threat model, so we are not going to
use any cryptographically secure hash algorithm like BLAKE3.
See also <#13171 (comment)>1 parent 674e609 commit 5eb7480
File tree
5 files changed
+80
-59
lines changed- src/cargo
- core
- util
- tests/testsuite
5 files changed
+80
-59
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
782 | 782 | | |
783 | 783 | | |
784 | 784 | | |
785 | | - | |
786 | | - | |
787 | | - | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
788 | 790 | | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | 791 | | |
802 | 792 | | |
803 | 793 | | |
804 | 794 | | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
805 | 802 | | |
806 | | - | |
807 | | - | |
808 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
809 | 806 | | |
810 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
811 | 812 | | |
812 | 813 | | |
813 | | - | |
814 | | - | |
| 814 | + | |
| 815 | + | |
815 | 816 | | |
816 | 817 | | |
817 | 818 | | |
818 | | - | |
819 | | - | |
| 819 | + | |
| 820 | + | |
820 | 821 | | |
821 | 822 | | |
822 | 823 | | |
823 | | - | |
824 | | - | |
| 824 | + | |
| 825 | + | |
825 | 826 | | |
826 | 827 | | |
827 | 828 | | |
828 | | - | |
829 | | - | |
| 829 | + | |
| 830 | + | |
830 | 831 | | |
831 | 832 | | |
832 | 833 | | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
| 834 | + | |
| 835 | + | |
837 | 836 | | |
| 837 | + | |
838 | 838 | | |
839 | | - | |
840 | | - | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
841 | 849 | | |
842 | 850 | | |
843 | | - | |
844 | | - | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
845 | 856 | | |
846 | 857 | | |
847 | | - | |
848 | | - | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
849 | 868 | | |
850 | 869 | | |
851 | 870 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2004 | 2004 | | |
2005 | 2005 | | |
2006 | 2006 | | |
2007 | | - | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
2008 | 2017 | | |
2009 | 2018 | | |
2010 | 2019 | | |
| |||
2027 | 2036 | | |
2028 | 2037 | | |
2029 | 2038 | | |
2030 | | - | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
2031 | 2043 | | |
2032 | 2044 | | |
2033 | 2045 | | |
| |||
0 commit comments