Skip to content

WIP: refactoring after absorbing libm #825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

tgross35
Copy link
Contributor

No description provided.

…orb-libm

Absorb the libm repository into `compiler-builtins`.

This was done using `git-filter-repo` to ensure hashes mentioned in
commit messages were correctly rewritten, I used the same strategy to
merge `ctest` into `libc` [1] and it worked quite well. Approximately:

    # `git filter-repo` requires a clean clone
    git clone https://github.com/rust-lang/libm.git

    # Move all code to a `libm` subdirectory for all history
    git filter-repo --to-subdirectory-filter libm

    # The default merge messages are "merge pull request #nnn from
    # user/branch". GH links these incorrectly in the new repo, so
    # rewrite messages from `#nnn` to `rust-lang/libm#nnn`.
    echo 'regex:(^|\s)(#\d+)==>\1rust-lang/libm\2' > messages.txt
    git filter-repo --replace-message messages.txt

    # Re-add a remote and push as a new branch
    git remote add upstream https://github.com/rust-lang/libm.git
    git switch -c merge-into-builtins-prep
    git push --set-upstream upstream merge-into-builtins-prep

    # Now in a compiler-builtins, add `libm` as a remote
    git remote add libm https://github.com/rust-lang/libm.git
    git fetch libm

    # Do the merge that creates this commit
    git merge libm/merge-into-builtins-prep --allow-unrelated-histories

The result should be correct git history and blame for all files, with
messages that use correct rewritten hashes when they are referenced.
There is some reorganization and CI work needed, but that will be a
follow up.

After this merges I will need to push tags from `libm`, which I have
already rewritten to include a `libm-` prefix. Old tags in
compiler-builtins should likely also be rewritten to add a prefix (we
already have this for newer tags), but this can be done at any point.

* Original remote: https://github.com/rust-lang/libm.git
* Default HEAD: c94017af75c3ec4616d5b7f9b6b1b3826b934469 ("Migrate all
  crates except `libm` to edition 2024")
* HEAD after rewriting history: 15fb630
  ("Migrate all crates except `libm` to edition 2024")

[1]: rust-lang/libc#4283 (comment)
@tgross35 tgross35 changed the base branch from master to absorb-libm April 19, 2025 01:35
@Mark-Simulacrum Mark-Simulacrum deleted the branch rust-lang:absorb-libm April 19, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants