-
Notifications
You must be signed in to change notification settings - Fork 549
Rustc pull update #2478
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
Closed
Rustc pull update #2478
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enable automatic cross-compilation in run-make tests Supersedes rust-lang/rust#138066. Blocker for rust-lang/rust#141856. Based on rust-lang/rust#138066 plus `rustdoc()` cross-compile changes. ### Summary This PR automatically specifies `--target` to `rustc()` and `rustdoc()` to have `rustc`/`rustdoc` produce cross-compiled artifacts in run-make tests by default, unless: - `//@ ignore-cross-compile` is used, or - `bare_{rustc,rustdoc}` are used, or - Explicit `.target()` is specified, which overrides the default cross-compile target. Some tests are necessarily modified: - Tests that have `.target(target())` have that incantation removed (since this is now automatically the default). - Some tests have `//@ needs-target-std`, but are a necessary-but-insufficient condition, and are changed to `//@ ignore-cross-compile` instead as host-only tests. - A few tests received `//@ ignore-musl` that fail against `x86_64-unknown-linux-musl` because of inability to find `-lunwind`. AFAICT, they don't *need* to test cross-compiled artifacts. - Some tests are constrained to host-only for now, because the effort to make them pass on cross-compile does not seem worth the complexity, and it's not really *meaningfully* improving test coverage. try-job: dist-various-1
ci: split x86_64-gnu-tools job try-job: x86_64-gnu-tools try-job: x86_64-gnu-miri try-job: aarch64-gnu
Handle win32 separator for cygwin paths This PR handles a issue that cygwin actually supports Win32 path, so we need to handle the Win32 prefix and separaters. r? `@mati865` cc `@jeremyd2019` ~~Not sure if I should handle the prefix like the windows target... Cygwin *does* support win32 paths directly going through the APIs, but I think it's not the recommended way.~~ Here I just use `cygwin_conv_path` because it handles both cygwin and win32 paths correctly and convert them into absolute POSIX paths. UPDATE: Windows path prefix is handled.
Allow storing `format_args!()` in variable Fixes rust-lang/rust#92698 Tracking issue for super let: rust-lang/rust#139076 Tracking issue for format_args: rust-lang/rust#99012 This change allows: ```rust let name = "world"; let f = format_args!("hello {name}!"); // New: Store format_args!() for later! println!("{f}"); ``` This will need an FCP. This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging rust-lang/rust#139114.) (This is a second version of rust-lang/rust#139135)
…egers, r=tgross35 Use a distinct `ToString` implementation for `u128` and `i128` Part of rust-lang/rust#135543. Follow-up of rust-lang/rust#136264. When working on rust-lang/rust#142098, I realized that `i128` and `u128` could also benefit from a distinct `ToString` implementation so here it. The last commit is just me realizing that I forgot to add the format tests for `usize` and `isize`. Here is the bench comparison: | bench name | last nightly | with this PR | diff | |-|-|-|-| | bench_i128 | 29.25 ns/iter (+/- 0.66) | 17.52 ns/iter (+/- 0.7) | -40.1% | | bench_u128 | 34.06 ns/iter (+/- 0.21) | 16.1 ns/iter (+/- 0.6) | -52.7% | I used this code to test: ```rust #![feature(test)] extern crate test; use test::{Bencher, black_box}; #[inline(always)] fn convert_to_string<T: ToString>(n: T) -> String { n.to_string() } macro_rules! decl_benches { ($($name:ident: $ty:ident,)+) => { $( #[bench] fn $name(c: &mut Bencher) { c.iter(|| convert_to_string(black_box({ let nb: $ty = 20; nb }))); } )+ } } decl_benches! { bench_u128: u128, bench_i128: i128, } ```
Use jemalloc for Clippy The tool macros are annoying, we should IMO just get rid of them, create separate steps for each tool and (re)use some builders in them to share the build code. r? `@ghost`
Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types. Implements `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types, which remove at most one occurrence of a prefix/suffix while always returning a string/slice (rather than Option), enabling easy method chaining. ## Tracking issue rust-lang/rust#142312 ## API ```rust impl str { pub fn trim_prefix<P: Pattern>(&self, prefix: P) -> &str; pub fn trim_suffix<P: Pattern>(&self, suffix: P) -> &str where for<'a> P::Searcher<'a>: ReverseSearcher<'a>; } impl<T> [T] { pub fn trim_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> &[T] where T: PartialEq; pub fn trim_suffix<P: SlicePattern<Item = T> + ?Sized>(&self, suffix: &P) -> &[T] where T: PartialEq; } ``` ## Examples ```rust // Method chaining assert_eq!(" <https://example.com/> ".trim().trim_prefix('<').trim_suffix('>').trim(), "https://example.com/"); // Slices let v = &[10, 40, 30]; assert_eq!(v.trim_prefix(&[10]), &[40, 30][..]); ``` ## ACP Originally proposed in rust-lang/libs-team#597
…li-obk Fix missing docs in `rustc_attr_parsing`
Better template for `#[repr]` attributes
…=lolbinarycat Fix random failure when JS code is executed when the whole file was not read yet Very randomly (and rarely), when I arrived on a page with `?search=something` in the URL, I got this error:  Moving the `initSearch` function at the bottom to ensure everything has been loaded fixes the issue. PS: Sorry for the noise. Pushed to the wrong branch and rust-lang/rust#142496 closed. ><
…laumeGomez,fmease add issue template for rustdoc ~~This also expands the scope of the "diagnostic issue" template to include rustdoc lints, meaning diagnostic issues will need triaging again. I think this is preferable to the alternative of cramming even more cases under a single issue template.~~ r? t-rustdoc
rustc-dev-guide subtree update r? ``@ghost``
Add a mailmap entry for y21
Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed I think `rustdoc-json-types` was more recently split out, so this download-rustc logic became outdated as it wasn't tracked. This PR adds `src/rustdoc-json-types` to be tracked for difference versus upstream, so that we properly rebuild rustdoc if it has changes versus upstream. Fixes rust-lang/rust#142738. ### Local testing This is not so easy to test locally because it requires download-rustc. To test this, you need to: 1. Disable `download-rustc` inhibition from bootstrap changes versus upstream, by including `:!src/bootstrap` in https://github.com/rust-lang/rust/blob/255aa220821c05c3eac7605fce4ea1c9ab2cbdb4/src/bootstrap/src/core/config/config.rs#L67-L74. 2. Then, use a config like `profile = "tools"` which by default uses `download-rustc = "if-unchanged"`. 3. Run `./x test tests/rustdoc-json` one time, to "prime" initial build caches. 4. Change the `FORMAT_VERSION` in `src/rustdoc-json-types`, i.e. ```diff diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 1f93895ae07..72a3720c7b4 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs ``@@`` -38,7 +38,7 ``@@`` // are deliberately not in a doc comment, because they need not be in public docs.) // // Latest feature: Pretty printing of inline attributes changed -pub const FORMAT_VERSION: u32 = 48; +pub const FORMAT_VERSION: u32 = 666; ``` 5. Observe that without this patch, `rustdoc-json` tests fail because `FORMAT_VERSION` mismatch. Observe that with this patch, rustdoc gets properly rebuilt and `rustdoc-json` tests pass. cc ``@aDotInTheVoid`` r? Kobzol
Convert `ilog(10)` to `ilog10()` Except in tests, convert `integer.ilog(10)` to `integer.ilog10()` for better speed and to provide better examples of code that efficiently counts decimal digits. I couldn't find any instances of `integer.ilog(2)`.
Some symbol and PathRoot cleanups I'm looking into unifying how we join and print paths. Here are some preliminary cleanups. r? ``@petrochenkov``
…gross35 remove equivalent new method on context Noticed the two had converged so much they literally became equivalent. So one could go hehe
Rollup of 10 pull requests Successful merges: - rust-lang/rust#142629 (Add config builder for bootstrap tests) - rust-lang/rust#142715 (correct template for `#[align]` attribute) - rust-lang/rust#142720 (De-dup common code from `ExternalCrate` methods) - rust-lang/rust#142736 (add issue template for rustdoc) - rust-lang/rust#142743 (rustc-dev-guide subtree update) - rust-lang/rust#142744 (Add a mailmap entry for y21) - rust-lang/rust#142758 (Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed) - rust-lang/rust#142764 (Convert `ilog(10)` to `ilog10()`) - rust-lang/rust#142767 (Some symbol and PathRoot cleanups) - rust-lang/rust#142769 (remove equivalent new method on context) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - rust-lang/rust#142491 (Rework #[cold] attribute parser) - rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`) - rust-lang/rust#142495 (Better template for `#[repr]` attributes) - rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet) - rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks) - rust-lang/rust#142650 (Refactor Translator) - rust-lang/rust#142713 (mbe: Refactor transcription) - rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`) r? `@ghost` `@rustbot` modify labels: rollup
Only traverse reachable blocks in JumpThreading. Fixes rust-lang/rust#131451 We only compute loop headers for reachable blocks. We shouldn't try to perform an opt on unreachable blocks anyway.
…r=nnethercote Avoid a few more allocations in `write_shared.rs` Inspired by rust-lang/rust#141421 , avoids a few `Vec`, `PathBuf` and `String` allocations in `write_shared.rs`. I don't think these will show up on benchmarks, but are still worthwhile IMHO. Also includes a few small cleanups. r? nnethercote - if you'd like :)
Preserve caches in a call to shrink_to_fit A small follow up to rust-lang/rust#142542.
completely deduplicate `Visitor` and `MutVisitor` r? oli-obk This closes rust-lang/rust#127615. ### Discussion > * Give every `MutVisitor::visit_*` method a corresponding `flat_map_*` method. Not every AST node exists in a location where they can be mapped to multiple instances of themselves. Not every AST node exists in a location where they can be removed from existence (e.g. `filter_map_expr`). I don't think this is doable. > * Give every `MutVisitor::visit_*` method a corresponding `Visitor` method and vice versa The only three remaining method-level asymmetries after this PR are `visit_stmt` and `visit_nested_use_tree` (only on `Visitor`) and `visit_span` (only on `MutVisitor`). `visit_stmt` doesn't seem applicable to `MutVisitor` because `walk_flat_map_stmt_kind` will ask `flat_map_item` / `filter_map_expr` to potentially turn a single `Stmt` to multiple based on what a visitor wants. So only using `flat_map_stmt` seems appropriate. `visit_nested_use_tree` is used for `rustc_resolve` to track stuff. Not useful for `MutVisitor` for now. `visit_span` is currently not used for `MutVisitor` already, it was just kept in case we want to revive rust-lang/rust#127241. cc `@cjgillot` maybe we could remove for now and re-insert later if we find a use-case? It does involve some extra effort to maintain. * Remaining FIXMEs `visit_lifetime` has an extra param for `Visitor` that's not in `MutVisitor`. This is again something only used by `rustc_resolve`. I think we can keep that symmetry for now.
Let String pass #[track_caller] to its Vec calls I've added `#[track_caller]` to `String` methods that delegate to `Vec` methods that already have `#[track_caller]`. I've also added `#[track_caller]` to methods that have `assert!` or `panic!` due to invalid inputs.
Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using |
empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Latest update from rustc.