Commit 9035d2e
authored
Rollup merge of rust-lang#159671 - Kobzol:semver-checks, r=jieyouxu
Add semver check test command for checking API compatibility of stdlib
This PR adds a new test to bootstrap (not executed by default at the moment) that checks the API compatibility of the standard library using the https://github.com/obi1kenobi/cargo-semver-checks tool.
The command can be executed using `x test std-semver-check`.
(Note: I realized that `x dist rust-docs-json` executed twice in a row invalidates Cargo cache for some reason, that is a separate issue though).
The test is not yet executed on CI, I would do that in a separate PR (maybe pending a t-libs FCP or something).
The test checks that c-s-c is installed, and then uses git to lookup a parent baseline commit (in a future extension, we should make the baseline commit be configurable through `config.toml`). Then it downloads the corresponding `rust-docs-json` component of that commit from CI and extracts it. It generates the same JSON docs component from local sources, and then runs c-s-c on those two JSON files to compare their API.
Output when API stability is broken:
```
Checking semver compatibility of core
Checking <unknown> v1.99.0-nightly (d527bc9 2026-07-20) -> v1.99.0-dev (assume minor change)
Checked [ 1.282s] 196 checks: 196 pass, 57 skip
Summary no semver update required
Finished [ 2.368s] <unknown>
Checking semver compatibility of alloc
Checking <unknown> v1.99.0-nightly (d527bc9 2026-07-20) -> v1.99.0-dev (assume minor change)
Checked [ 0.030s] 196 checks: 196 pass, 57 skip
Summary no semver update required
Finished [ 0.127s] <unknown>
Checking semver compatibility of std
Checking <unknown> v1.99.0-nightly (d527bc9 2026-07-20) -> v1.99.0-dev (assume minor change)
Checked [ 0.055s] 196 checks: 195 pass, 1 fail, 0 warn, 57 skip
--- failure function_missing: pub fn removed or renamed ---
Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/function_missing.ron
Failed in:
function std::process::id, previously in file library/std/src/process.rs:2656
Summary semver requires new major version: 1 major and 0 minor checks failed
Finished [ 0.243s] <unknown>
```
CC @obi1kenobi @Amanieu
r? @jieyouxu5 files changed
Lines changed: 129 additions & 8 deletions
File tree
- src/bootstrap/src/core
- build_steps
- builder
- cli_paths
- snapshots
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
4613 | 4615 | | |
4614 | 4616 | | |
4615 | 4617 | | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
| 4626 | + | |
| 4627 | + | |
| 4628 | + | |
| 4629 | + | |
| 4630 | + | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
| 4648 | + | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
| 4656 | + | |
| 4657 | + | |
| 4658 | + | |
| 4659 | + | |
| 4660 | + | |
| 4661 | + | |
| 4662 | + | |
| 4663 | + | |
| 4664 | + | |
| 4665 | + | |
| 4666 | + | |
| 4667 | + | |
| 4668 | + | |
| 4669 | + | |
| 4670 | + | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
| 4676 | + | |
| 4677 | + | |
| 4678 | + | |
| 4679 | + | |
| 4680 | + | |
| 4681 | + | |
| 4682 | + | |
| 4683 | + | |
| 4684 | + | |
| 4685 | + | |
| 4686 | + | |
| 4687 | + | |
| 4688 | + | |
| 4689 | + | |
| 4690 | + | |
| 4691 | + | |
| 4692 | + | |
| 4693 | + | |
| 4694 | + | |
| 4695 | + | |
| 4696 | + | |
| 4697 | + | |
| 4698 | + | |
| 4699 | + | |
| 4700 | + | |
| 4701 | + | |
| 4702 | + | |
| 4703 | + | |
| 4704 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
| 977 | + | |
977 | 978 | | |
978 | 979 | | |
979 | 980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
176 | 200 | | |
177 | 201 | | |
178 | 202 | | |
| |||
785 | 809 | | |
786 | 810 | | |
787 | 811 | | |
788 | | - | |
| 812 | + | |
789 | 813 | | |
790 | 814 | | |
791 | 815 | | |
792 | | - | |
| 816 | + | |
793 | 817 | | |
794 | 818 | | |
795 | 819 | | |
| |||
834 | 858 | | |
835 | 859 | | |
836 | 860 | | |
837 | | - | |
838 | | - | |
| 861 | + | |
839 | 862 | | |
840 | 863 | | |
841 | 864 | | |
| |||
848 | 871 | | |
849 | 872 | | |
850 | 873 | | |
851 | | - | |
852 | | - | |
| 874 | + | |
853 | 875 | | |
854 | 876 | | |
855 | 877 | | |
| |||
872 | 894 | | |
873 | 895 | | |
874 | 896 | | |
875 | | - | |
| 897 | + | |
876 | 898 | | |
877 | 899 | | |
878 | 900 | | |
| |||
916 | 938 | | |
917 | 939 | | |
918 | 940 | | |
919 | | - | |
| 941 | + | |
920 | 942 | | |
921 | 943 | | |
922 | 944 | | |
| |||
979 | 1001 | | |
980 | 1002 | | |
981 | 1003 | | |
| 1004 | + | |
982 | 1005 | | |
983 | 1006 | | |
984 | 1007 | | |
| |||
0 commit comments