about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-10-09Rollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obkMatthias Krüger-112/+213
make #[target_feature] work with `asm` register classes Fixes #89289
2021-10-09Rollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obkMatthias Krüger-16/+19
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes #76824 Closes #89623 cc ``@eddyb,`` ``@oli-obk``
2021-10-09Rollup merge of #89605 - camelid:fix-version, r=nagisaMatthias Krüger-1/+1
Fix stabilization version for `bindings_after_at` According to the release notes and its PR milestone, it was stabilized in 1.56.0.
2021-10-09Rollup merge of #88707 - sylvestre:split_example, r=yaahcMatthias Krüger-0/+6
String.split_terminator: Add an example when using a slice of chars
2021-10-09Remove unnecessary hyphenTim McNamara-1/+1
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-10-09Fix min LLVM version for bpf-types testAlessandro Decina-1/+1
Closes #89689
2021-10-09Simplify wordingTim McNamara-4/+4
Co-authored-by: Josh Triplett <josh@joshtriplett.org> Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-10-08Move template initialization into its own file.Jacob Hoffman-Andrews-15/+23
2021-10-09Update library/core/src/num/mod.rsJohn Kugelman-1/+1
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-10-08Add template for print_itemJacob Hoffman-Andrews-46/+96
Add print_item.html and the code in print_item.rs to use it.
2021-10-09Auto merge of #89582 - jkugelman:optimize-file-read-to-end, r=joshtriplettbors-46/+146
Optimize File::read_to_end and read_to_string Reading a file into an empty vector or string buffer can incur unnecessary `read` syscalls and memory re-allocations as the buffer "warms up" and grows to its final size. This is perhaps a necessary evil with generic readers, but files can be read in smarter by checking the file size and reserving that much capacity. `std::fs::read` and `std::fs::read_to_string` already perform this optimization: they open the file, reads its metadata, and call `with_capacity` with the file size. This ensures that the buffer does not need to be resized and an initial string of small `read` syscalls. However, if a user opens the `File` themselves and calls `file.read_to_end` or `file.read_to_string` they do not get this optimization. ```rust let mut buf = Vec::new(); file.read_to_end(&mut buf)?; ``` I searched through this project's codebase and even here are a *lot* of examples of this. They're found all over in unit tests, which isn't a big deal, but there are also several real instances in the compiler and in Cargo. I've documented the ones I found in a comment here: https://github.com/rust-lang/rust/issues/89516#issuecomment-934423999 Most telling, the documentation for both the `Read` trait and the `Read::read_to_end` method both show this exact pattern as examples of how to use readers. What this says to me is that this shouldn't be solved by simply fixing the instances of it in this codebase. If it's here it's certain to be prevalent in the wider Rust ecosystem. To that end, this commit adds specializations of `read_to_end` and `read_to_string` directly on `File`. This way it's no longer a minor footgun to start with an empty buffer when reading a file in. A nice side effect of this change is that code that accesses a `File` as `impl Read` or `dyn Read` will benefit. For example, this code from `compiler/rustc_serialize/src/json.rs`: ```rust pub fn from_reader(rdr: &mut dyn Read) -> Result<Json, BuilderError> { let mut contents = Vec::new(); match rdr.read_to_end(&mut contents) { ``` Related changes: - I also added specializations to `BufReader` to delegate to `self.inner`'s methods. That way it can call `File`'s optimized implementations if the inner reader is a file. - The private `std::io::append_to_string` function is now marked `unsafe`. - `File::read_to_string` being more efficient means that the performance note for `io::read_to_string` can be softened. I've added `@camelid's` suggested wording from https://github.com/rust-lang/rust/issues/80218#issuecomment-936806502. r? `@joshtriplett`
2021-10-09Add #[must_use] to string/char transformation methodsJohn Kugelman-0/+40
These methods could be misconstrued as modifying their arguments instead of returning new values. Where possible I made the note recommend a method that does mutate in place.
2021-10-08Add #[must_use] to stdin/stdout/stderr locksJohn Kugelman-0/+3
2021-10-08Move read2_abbreviated function into read2.rsNicholas-Baron-70/+73
2021-10-08Add feature gate to non_exhaustive_omitted_patterns lintDevin Ragotzy-20/+154
Actually add the feature to the lints ui test Add tracking issue to the feature declaration Rename feature gate to non_exhaustive_omitted_patterns_lint Add more omitted_patterns lint feature gate
2021-10-08Auto merge of #89683 - GuillaumeGomez:rollup-q2mjd9m, r=GuillaumeGomezbors-84/+166
Rollup of 6 pull requests Successful merges: - #86506 (Don't normalize xform_ret_ty during method candidate assembly ) - #89538 (Make rustdoc not highlight `->` and `=>` as operators) - #89649 (clippy::complexity fixes) - #89668 (Cfg hide more conditions for core and alloc) - #89669 (Remove special-casing of never primitive in rustdoc-json-types) - #89672 (Remove unwrap_or! macro) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-08Fix asm docs typoasquared31415-2/+2
2021-10-08Rollup merge of #89672 - klensy:unwrap-or-macro, r=jackh726Guillaume Gomez-17/+8
Remove unwrap_or! macro Removes `unwrap_or!` macro and replaces it with `match`. It's kinda cleanup, as rustc_ast not the best place for this macro and this is used only in 2 places anyway.
2021-10-08Rollup merge of #89669 - Urgau:json-remove-type-never, r=GuillaumeGomezGuillaume Gomez-4/+23
Remove special-casing of never primitive in rustdoc-json-types Fixes https://github.com/rust-lang/rust/issues/89349 r? `@GuillaumeGomez`
2021-10-08Rollup merge of #89668 - Urgau:core-cfg-hide, r=GuillaumeGomezGuillaume Gomez-1/+7
Cfg hide more conditions for core and alloc Fixes https://github.com/rust-lang/rust/issues/89663 Before: ![image](https://user-images.githubusercontent.com/3616612/136572816-a7844ac7-dc2f-4d79-87b4-7f9766421a83.png) After: ![image](https://user-images.githubusercontent.com/3616612/136572745-7d890726-8efd-4d74-83ac-ed06f4687741.png) *Same for alloc* r? ``@GuillaumeGomez``
2021-10-08Rollup merge of #89649 - matthiaskrgr:clippycompl, r=jyn514Guillaume Gomez-30/+23
clippy::complexity fixes
2021-10-08Rollup merge of #89538 - notriddle:notriddle/arrow-highlight, r=GuillaumeGomezGuillaume Gomez-18/+31
Make rustdoc not highlight `->` and `=>` as operators It was marking them up as `<span class="op">=</span><span class="op">&gt;</span>`, which is bloaty and wrong (at least, I think `<=` and `=>` should probably be different colors, since they're so different and yet made from the same symbols). Before: ![image](https://user-images.githubusercontent.com/1593513/135939748-f49b0f9e-6a7d-4d65-935a-e31cdf688a81.png) After: ![image](https://user-images.githubusercontent.com/1593513/135940063-5ef1f6b1-7e03-4227-b46b-572b063aba05.png)
2021-10-08Rollup merge of #86506 - b-naber:gen_trait_impl_inconsistent, r=jackh726Guillaume Gomez-14/+74
Don't normalize xform_ret_ty during method candidate assembly Fixes https://github.com/rust-lang/rust/issues/85671 Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a `self_ty` of the form `&A<&[Coef]>` whereas the `impl_ty` of the method would be `&A<_>`, if we normalize the projection in the return type we unify the inference variable with `Cont`, which will lead us to reject the candidate in the sup type check in `consider_probe`. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates in `consider_probe`.
2021-10-08Fix minor std::thread documentation typoMarcelo Diop-Gonzalez-3/+3
callers of spawn_unchecked() need to make sure that the thread not outlive references in the passed closure, not the other way around.
2021-10-08Auto merge of #89666 - ↵bors-4/+13
rusticstuff:disable_new_llvm_pass_manager_on_s390x_take_two, r=nagisa Default to disabling the new pass manager for the s390x arch targets. This hack disables the new LLVM pass manager by default for s390x arch targets until the performance issues are fixed (see #89609). The command line option `-Z new-llvm-pass-manager=(yes|no)` continues to take precedence over this default.
2021-10-08clippy::complexity fixesMatthias Krüger-30/+23
2021-10-08bless warningsEliza Weisman-0/+1
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-10-08Directly call relate_types function instead of having a method wrapperOli Scherer-37/+26
2021-10-08Re-use TypeChecker instead of passing around some of its fieldsOli Scherer-48/+31
2021-10-08remove unwrap_or! macroklensy-17/+8
2021-10-08Cfg hide more conditions for allocLoïc BRANSTETT-1/+6
2021-10-09Show detailed expected/found types in error message when trait paths are the ↵rhysd-20/+87
same
2021-10-08Remove special-casing of never primitive in rustdoc-json-typesLoïc BRANSTETT-4/+23
2021-10-08Auto merge of #89644 - matthiaskrgr:clippy_perf_okt, r=jyn514bors-3/+3
some clippy::perf fixes
2021-10-08Cfg hide more conditions for coreLoïc BRANSTETT-0/+1
2021-10-08Default to disabling the new pass manager for the s390x targets.Hans Kratz-4/+13
2021-10-08Auto merge of #89576 - tom7980:issue-89275-fix, r=estebankbors-18/+82
Prevent error reporting from outputting a recursion error if it finds an ambiguous trait impl during suggestions Closes #89275 This fixes the compiler reporting a recursion error during another already in progress error by trying to make a conversion method suggestion and encounters ambiguous trait implementations that can convert a the original type into a type that can then be recursively converted into itself via another method in the trait. Updated OverflowError struct to be an enum so I could differentiate between passes - it's no longer a ZST but I don't think that should be a problem as they only generate when there's an error in compiling code anyway
2021-10-08Also cfg flag auxiliar functionCaio-0/+1
2021-10-08Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisabors-82/+125
Turn vtable_allocation() into a query This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query. The change is pretty straightforward and should be backportable without too much effort. Fixes https://github.com/rust-lang/rust/issues/89598.
2021-10-08testsb-naber-4/+39
2021-10-08dont normalize return type during candidate assembly in method probingb-naber-10/+35
2021-10-08Add documentation to boxed conversionsTim McNamara-0/+41
Among other changes, documents whether allocations are necessary to complete the type conversion. Part of #51430 Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com> Co-authored-by: Joshua Nelson <github@jyn.dev>
2021-10-08Create more accurate debuginfo for vtables.Michael Woerister-62/+163
Before this commit all vtables would have the same name "vtable" in debuginfo. Now they get a name that identifies the implementing type and the trait that is being implemented.
2021-10-08CI: Use mirror for downloads.Hans Kratz-4/+8
Crosstool-ng 1.22 used by those docker dist builds only allows one mirror for all downloads.
2021-10-08Auto merge of #89659 - workingjubilee:rollup-0vggc69, r=workingjubileebors-123/+1034
Rollup of 8 pull requests Successful merges: - #87918 (Enable AutoFDO.) - #88137 (On macOS, make strip="symbols" not pass any options to strip) - #88772 (Fixed confusing wording on Result::map_or_else.) - #89025 (Implement `#[link_ordinal(n)]`) - #89082 (Implement #85440 (Random test ordering)) - #89288 (Wrapper for `-Z gcc-ld=lld` to invoke rust-lld with the correct flavor) - #89476 (Correct decoding of foreign expansions during incr. comp.) - #89622 (Use correct edition for panic in [debug_]assert!().) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-07Rollup merge of #89622 - m-ou-se:debug-assert-2021, r=estebankJubilee-4/+148
Use correct edition for panic in [debug_]assert!(). See https://github.com/rust-lang/rust/issues/88638#issuecomment-915472783
2021-10-07Rollup merge of #89476 - cjgillot:expn-id, r=petrochenkovJubilee-19/+51
Correct decoding of foreign expansions during incr. comp. Fixes https://github.com/rust-lang/rust/issues/74946 The original issue was due to a wrong assertion in `expn_hash_to_expn_id`. The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.
2021-10-07Rollup merge of #89288 - rusticstuff:lld_wrapper, r=Mark-SimulacrumJubilee-13/+189
Wrapper for `-Z gcc-ld=lld` to invoke rust-lld with the correct flavor This PR adds an `lld-wrapper` tool which is installed as `ld` and `ld64` in `lib\rustlib\<host_target>\bin\gcc-ld` directory and whose sole purpose is to invoke `rust-lld` in the parent directory with the correct flavor. Lld decides which flavor to use from either the first two commandline arguments or from the name of the executable (`ld` for GNU/ld flavor, `ld64` for Darwin/Macos/ld64 flavor and so on). Symbolic links could not be used as they are not supported by rustup and on Windows. The wrapper replaces full copies of rust-lld which added some significant bloat. On UNIXish operating systems it exec rust-lld, on Windows it spawns it as a child process. Fixes #88869. r? ```@Mark-Simulacrum``` cc ```@nagisa``` ```@petrochenkov``` ```@1000teslas```
2021-10-07Rollup merge of #89082 - smoelius:master, r=kennytmJubilee-40/+313
Implement #85440 (Random test ordering) This PR adds `--shuffle` and `--shuffle-seed` options to `libtest`. The options are similar to the [`-shuffle` option](https://github.com/golang/go/blob/c894b442d1e5e150ad33fa3ce13dbfab1c037b3a/src/testing/testing.go#L1482-L1499) that was recently added to Go. Here are the relevant parts of the help message: ``` --shuffle Run tests in random order --shuffle-seed SEED Run tests in random order; seed the random number generator with SEED ... By default, the tests are run in alphabetical order. Use --shuffle or set RUST_TEST_SHUFFLE to run the tests in random order. Pass the generated "shuffle seed" to --shuffle-seed (or set RUST_TEST_SHUFFLE_SEED) to run the tests in the same order again. Note that --shuffle and --shuffle-seed do not affect whether the tests are run in parallel. ``` Is an RFC needed for this?
2021-10-07Rollup merge of #89025 - ricobbe:raw-dylib-link-ordinal, r=michaelwoeristerJubilee-23/+201
Implement `#[link_ordinal(n)]` Allows the use of `#[link_ordinal(n)]` with `#[link(kind = "raw-dylib")]`, allowing Rust to link against DLLs that export symbols by ordinal rather than by name. As long as the ordinal matches, the name of the function in Rust is not required to match the name of the corresponding function in the exporting DLL. Part of #58713.