Use the patches table from the workspace manifest if possible#28
Use the patches table from the workspace manifest if possible#28RalfJung merged 2 commits intoRalfJung:masterfrom
patches table from the workspace manifest if possible#28Conversation
|
I'll run a try build with this once it's closer to ready, but you should probably make sure this is on the right track first. |
|
Thanks! TBH, this is a lot heavier than I thought it would be. Though a lot of that seems to be due to using Is it possible to use |
src/lib.rs
Outdated
| // We only care about the patch table. | ||
| t.retain(|k, _v| k == "patch"); | ||
| Some(t) |
There was a problem hiding this comment.
Can this be just t["patch"]? Seems odd to keep the surrounding table but erase the rest.
There was a problem hiding this comment.
I did it this way so the existing default_patches could keep the existing patch.crates-io part. But yeah, both could be de-nested by one
src/lib.rs
Outdated
| path = "rustc-std-workspace-std" | ||
| } | ||
| }; | ||
| let mut patches = extract_patches(src_dir).unwrap_or_else(default_patches); |
There was a problem hiding this comment.
Can this ever fail? The library toml file always has a patch section, doesn't it?
There was a problem hiding this comment.
The library/Cargo.toml file is newer since the workspace split right? I don't know how far back this tool needs to support.
There was a problem hiding this comment.
Seems like the file got added in rust-lang/rust@1f3be75. I like supporting a few months worth of rustc versions, but that's almost a year, so it's fine requiring the toml file to exist.
Sure, I can change it if you prefer. I just liked that the string literals could be indented and we still get a nicely formatted output 🙂 Though I guess we get that just by passing the indented string through |
Make things a bit nicer to read in code. This means the entire file will be indented, but we will wind up passing it through a toml parser/printer so the nice formatting will come back.
Remove special casing for the `compiler-builtins` patch by instead picking up the `patch` table from the workspace `Cargo.toml`. Paths in the patch table are remapped to be relative to the source directory, which matches current behavior.
|
I updated things so most of the existing logic except for the patches remains unchanged. The first commit indents things just because we can now without creating a wonky file. |
|
This looks great, thanks. :) |
Remove special casing for the
compiler-builtinspatch by instead picking up thepatchtable from the workspaceCargo.toml. Paths in the patch table are remapped to be relative to the source directory, which matches current behavior.