about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-06-18Add unit test for `TcpStream::connect_timeout`Eval EXEC-0/+20
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-06-18Fix windows `Socket::connect_timeout` overflowEval EXEC-1/+1
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-06-17Auto merge of #112739 - matthiaskrgr:rollup-8cfggml, r=matthiaskrgrbors-287/+355
Rollup of 6 pull requests Successful merges: - #112352 (Fix documentation build on FreeBSD) - #112644 (Correct types in method descriptions of `NonZero*` types) - #112683 (fix ICE on specific malformed asm clobber_abi) - #112707 ([rustdoc] Fix invalid handling of "going back in history" when "go to only search result" setting is enabled) - #112719 (Replace fvdl with ffx, allow test without install) - #112728 (Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-17Rollup merge of #112728 - Zalathar:spanview-charset, r=NilstriebMatthias Krüger-5/+9
Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output Without an explicit `<meta charset>` declaration, some browsers (e.g. Safari) won't detect the page encoding as UTF-8, causing unicode characters in the dump output to display incorrectly.
2023-06-17Rollup merge of #112719 - djkoloski:fuchsia_test_runner_remove_fvdl, r=tmandryMatthias Krüger-156/+100
Replace fvdl with ffx, allow test without install Along with replacing fvdl uses with the equivalent ffx commands, this also switches from using the install path for libstd-*.so and libtest-*.so to using the build directory (now passed on the command line). The user no longer needs to run x.py install before running tests now, and the correct libstd and libtest are detected on run instead of startup so the test runner can handle recompilations after starting the testing environment. r? ``@tmandry``
2023-06-17Rollup merge of #112707 - GuillaumeGomez:back-in-history-fix, r=notriddleMatthias Krüger-20/+43
[rustdoc] Fix invalid handling of "going back in history" when "go to only search result" setting is enabled You can test the fix [here](https://rustdoc.crud.net/imperio/back-in-history-fix/lib2/index.html). Enable "Directly go to item in search if there is only one result", then search for `HasALongTraitWithParams` and finally go back to previous page. It should be back on the `index.html` page. The reason for this bug is that the JS state is cached as is, so when we go back to the page, it resumes where it was left, somewhat (very weird), meaning the search is run again etc. The best way to handle this is to force the JS re-execution in this case so that it doesn't try to resume from where it left and then lead us back to the current page. r? ``@notriddle``
2023-06-17Rollup merge of #112683 - asquared31415:asm_clobber_ice, r=compiler-errorsMatthias Krüger-96/+184
fix ICE on specific malformed asm clobber_abi fixes #112635
2023-06-17Rollup merge of #112644 - zica87:nonZeroTypes, r=Mark-SimulacrumMatthias Krüger-9/+12
Correct types in method descriptions of `NonZero*` types - `$Int`: e.g. i32, usize - `$Ty`: e.g. NonZeroI32, NonZeroUsize |method|current description|after my changes| |-|-|-| |`saturating_add`|...Return `$Int`::MAX on overflow.|...Return `$Ty`::MAX on overflow.| |`checked_abs`|...returns None if self == `$Int`::MIN.|...returns None if self == `$Ty`::MIN.| |`checked_neg`|...returning None if self == i32::MIN.|...returning None if self == `$Ty`::MIN.| |`saturating_neg`|...returning MAX if self == i32::MIN...|...returning `$Ty`::MAX if self == `$Ty`::MIN...| |`saturating_mul`|...Return `$Int`::MAX...|...Return `$Ty`::MAX...| |`saturating_pow`|...Return `$Int`::MIN or `$Int`::MAX...|...Return `$Ty`::MIN or `$Ty`::MAX...| --- For example: ```rust pub const fn saturating_neg(self) -> NonZeroI128 ``` - current - Saturating negation. Computes `-self`, returning `MAX` if `self == i32::MIN` instead of overflowing. - after my changes - Saturating negation. Computes `-self`, returning `NonZeroI128::MAX` if `self == NonZeroI128::MIN` instead of overflowing.
2023-06-17Rollup merge of #112352 - dankm:fbsd_doc_fix, r=thomccMatthias Krüger-1/+7
Fix documentation build on FreeBSD After the socket ancillary data implementation was introduced, the documentation build was broken on FreeBSD hosts, add the same workaround as for the existing implementations. Fixes the doc build after #91793
2023-06-17Auto merge of #112330 - the8472:use-buf-reader-buffer, r=thomccbors-74/+207
Extend io::copy buffer reuse to BufReader too previously it was only able to use BufWriter. This was due to a limitation in the BufReader generics that prevented specialization. This change works around the issue by using `BufReader where Self: Read` instead of `BufReader<I> where I: Read`. This limits our options, e.g. we can't access the inner reader, but it happens to work out if we rely on some implementation details. Copying 1MiB from `/dev/zero` to `/dev/null` through a 256KiB BufReader yields following improvements ``` OLD: io::copy::tests::bench_copy_buf_reader 51.44µs/iter +/- 703.00ns NEW: io::copy::tests::bench_copy_buf_reader 18.55µs/iter +/- 237.00ns ``` Previously this would read 256KiB into the reader but then copy 8KiB chunks to the writer through an additional intermediate buffer inside `io::copy`. Since those devices don't do much work most of the speedup should come from fewer syscalls and avoided memcopies. The b3sum crate [notes that the default buffer size in io::copy is too small](https://github.com/BLAKE3-team/BLAKE3/blob/4108923f5284e0f8c3cf97b59041c2b6b2f601d3/b3sum/src/main.rs#L235-L239). With this optimization they could achieve the desired performance by wrapping the reader in a `BufReader` instead of handrolling it. Currently the optimization doesn't apply to things like `StdinLock`, but this can be addressed with an additional `AsMutBufReader` specialization trait.
2023-06-17Extend io::copy buffer reuse to BufReader tooThe 8472-74/+207
previously it was only able to use BufWriter. This was due to a limitation in the BufReader generics that prevented specialization. This change works around the issue by using `where Self: Read` instead of `where I: Read`. This limits our options, e.g. we can't access BufRead methods, but it happens to work out if we rely on some implementation details.
2023-06-17Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` outputZalathar-5/+9
2023-06-17Auto merge of #112687 - compiler-errors:simplify-impl-source, r=lcnrbors-384/+186
Simplify `ImplSource` candidates a bit Reduce the number of impl source candidates, which will hopefully make our life easier when trying to adapt things like `SelectionContext::select` and `codegen_select_candidate` for the new solver. r? `@lcnr` but feel free to reassign
2023-06-17Remove even more redundant builtin candidatesMichael Goulet-138/+96
2023-06-17Simplify even more candidatesMichael Goulet-161/+88
2023-06-17Simplify an ObjectData fieldMichael Goulet-10/+14
2023-06-17Simplify some impl source candidatesMichael Goulet-81/+18
2023-06-17Remove some ImplSource candidatesMichael Goulet-50/+26
2023-06-17Auto merge of #112407 - tgross35:ci-docs-publish, r=Mark-Simulacrumbors-0/+97
Publish docs as github artifacts during CI Discussed here: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Building.20docs.20for.20PR.20CI The goal is to make docs available for download after CI runs on PRs, for easy review of API changes. Notes: - Currently this only captures library documentation (`core`, `alloc`, `std`, `test`, `proc_macro`) - You can't see artifacts until the entire workflow run has completed https://github.com/actions/upload-artifact/issues/53 - There is currently a generic file name `ci-artifacts`. No way to customize this based on contained files unfortunately https://github.com/actions/upload-artifact/issues/349 You can find the results at the bottom of the CI "summary" page: <img width="379" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/d3748e59-242c-40f8-9f54-82177b9b481b">
2023-06-17Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errorsbors-344/+625
Add `AliasKind::Weak` for type aliases. `type Foo<T: Debug> = Bar<T>;` does not check `T: Debug` at use sites of `Foo<NotDebug>`, because in contrast to a ```rust trait Identity { type Identity; } impl<T: Debug> Identity for T { type Identity = T; } <NotDebug as Identity>::Identity ``` type aliases do not exist in the type system, but are expanded to their aliased type immediately when going from HIR to the type layer. Similarly: * a private type alias for a public type is a completely fine thing, even though it makes it a bit hard to write out complex times sometimes * rustdoc expands the type alias, even though often times users use them for documentation purposes * diagnostics show the expanded type, which is confusing if the user wrote a type alias and the diagnostic talks about another type that they don't know about. For type alias impl trait, these issues do not actually apply in most cases, but sometimes you have a type alias impl trait like `type Foo<T: Debug> = (impl Debug, Bar<T>);`, which only really checks it for `impl Debug`, but by accident prevents `Bar<T>` from only being instantiated after proving `T: Debug`. This PR makes sure that we always check these bounds explicitly and don't rely on an implementation accident. To not break all the type aliases out there, we only use it when the type alias contains an opaque type. We can decide to do this for all type aliases over an edition. Or we can later extend this to more types if we figure out the back-compat concerns with suddenly checking such bounds. As a side effect, easily allows fixing https://github.com/rust-lang/rust/issues/108617, which I did. fixes https://github.com/rust-lang/rust/issues/108617
2023-06-16fix ICE on specific malformed asm clobber_abiasquared31415-96/+184
2023-06-16Fix edit failTyler Mandry-1/+0
2023-06-16Fix --rust-build flag in docsTyler Mandry-1/+2
2023-06-16Replace fvdl with ffx, allow test without installDavid Koloski-156/+100
Along with replacing fvdl uses with the equivalent ffx commands, this also switches from using the install path for libstd-*.so and libtest-*.so to using the build directory (now passed on the command line). The user no longer needs to run x.py install before running tests now, and the correct libstd and libtest are detected on run instead of startup so the test runner can handle recompilations after starting the testing environment.
2023-06-16Auto merge of #112716 - compiler-errors:rollup-h77daia, r=compiler-errorsbors-163/+331
Rollup of 7 pull requests Successful merges: - #111074 (Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>`) - #112226 (std: available_parallelism using native netbsd api first) - #112474 (Support 128-bit enum variant in debuginfo codegen) - #112662 (`#[lang_item]` for `core::ptr::Unique`) - #112665 (Make assumption functions in new solver take `Binder<'tcx, Clause<'tcx>>`) - #112684 (Disable alignment checks on i686-pc-windows-msvc) - #112706 (Add `SyntaxContext::is_root`) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-16Rollup merge of #112706 - WaffleLapkin:syntax_context_is_root, r=petrochenkovMichael Goulet-15/+20
Add `SyntaxContext::is_root` Makes the code a tad nicer.
2023-06-16Rollup merge of #112684 - saethlin:ignore-windows-alignment, r=wesleywiserMichael Goulet-0/+26
Disable alignment checks on i686-pc-windows-msvc r? `@wesleywiser` Because you were in the Zulip discussion of this: https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202023-06-15 cc #112480
2023-06-16Rollup merge of #112665 - compiler-errors:assumption-takes-clause, r=lcnrMichael Goulet-26/+98
Make assumption functions in new solver take `Binder<'tcx, Clause<'tcx>>` We just use an if-let to match on an optional clause at all the places where we transition from `Predicate` -> `Clause`, but I assume that when things like item-bounds and param-env start to only store `Clause`s then those can just be trivially dropped. r? ``@lcnr``
2023-06-16Rollup merge of #112662 - Vanille-N:symbol_unique, r=RalfJungMichael Goulet-0/+5
`#[lang_item]` for `core::ptr::Unique` Tree Borrows is about to introduce experimental special handling of `core::ptr::Unique` in Miri to give it a semantics. As of now there does not seem to be a clean way (i.e. other than `&format!("{adt:?}") == "std::ptr::Unique"`) to check if an `AdtDef` represents a `Unique`. r? `@RalfJung` Draft: making a lang item
2023-06-16Rollup merge of #112474 - ldm0:ldm_enum_debuginfo_128_support, r=compiler-errorsMichael Goulet-11/+41
Support 128-bit enum variant in debuginfo codegen fixes #111600
2023-06-16Rollup merge of #112226 - devnexen:netbsd_affinity, r=cuviperMichael Goulet-0/+23
std: available_parallelism using native netbsd api first before falling back to existing code paths like FreeBSD does.
2023-06-16Rollup merge of #111074 - WaffleLapkin:🌟unsizes_your_buf_reader🌟, ↵Michael Goulet-111/+118
r=Amanieu Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>` TL;DR: ```diff,rust -pub struct BufReader<R> { /* ... */ } +pub struct BufReader<R: ?Sized> { /* ... */ } -pub struct BufWriter<W: Write> { /* ... */ } +pub struct BufWriter<W: ?Sized + Write> { /* ... */ } -pub struct LineWriter<W: Write> { /* ... */ } +pub struct LineWriter<W: ?Sized + Write> { /* ... */ } ``` This allows using `&mut BufReader<dyn Read>`, for example. **This is an insta-stable change**.
2023-06-16Pacify tidyOli Scherer-116/+128
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-199/+474
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-16Add regression test for #112676Guillaume Gomez-1/+8
2023-06-16Fix invalid handling of "going back in history" when "Directly go to item in ↵Guillaume Gomez-4/+21
search if there is only one result" setting is set to true
2023-06-16Auto merge of #112294 - saethlin:inline-me-maybe, r=oli-obkbors-934/+349
Ignore the always part of #[inline(always)] in MIR inlining `#[inline(always)]` is used in two cases: for functions that are so trivial it is always profitable to inline them, but also for functions which LLVM thinks are a bad inlining candidate, but which actually turn out to be profitable to inline. That second justification doesn't apply to the MIR inliner, so ignoring our cost estimation for these functions is not necessarily the right right thing to do. This is basically a wash on non-check runs and a perf benefit in check runs. There are some notable regressions, and I think we might be able to claw those back by turning `#[inline(always)]` into a stronger hint. But I think this PR stands decently on its own as a tidy simplification.
2023-06-16Merge the orphan logic for all alias kindsOli Scherer-29/+23
2023-06-16Ignore the always part of #[inline(always)] in MIR inliningBen Kimock-934/+349
2023-06-16Auto merge of #110688 - GuillaumeGomez:result-search-type, r=notriddle,jshabors-40/+42
rustdoc: Add search result item types after their name Here what it looks like: ![Screenshot from 2023-04-22 15-16-58](https://user-images.githubusercontent.com/3050060/233789566-b5f3f625-3b78-4c56-a7ee-0a4f2d62e667.png) The idea is to improve accessibility by providing this information directly in the text and not only in the text color. Currently we already use it for doc aliases and for primitive types, so I extended it to all types. r? `@notriddle`
2023-06-16Update compiler/rustc_mir_transform/src/check_alignment.rsWesley Wiser-0/+1
2023-06-16Add `SyntaxContext::is_root`Maybe Waffle-15/+20
2023-06-16`#[lang_item]` for `core::ptr::Unique`Neven Villani-0/+5
2023-06-16Disable alignment checks on i686-pc-windows-msvcBen Kimock-0/+25
2023-06-16Auto merge of #112702 - Dylan-DPC:rollup-12d6qay, r=Dylan-DPCbors-88/+207
Rollup of 7 pull requests Successful merges: - #112163 (fix: inline `predicate_may_hold_fatal` and remove expect call in it) - #112399 (Instantiate closure synthetic substs in root universe) - #112443 (Opportunistically resolve regions in new solver) - #112535 (reorder attributes to make miri-test-libstd work again) - #112579 (Fix building libstd documentation on FreeBSD.) - #112639 (Fix `dead_code_cgu` computation) - #112642 (Handle interpolated literal errors) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-16Unify history interactions in searchGuillaume Gomez-15/+14
2023-06-16Rollup merge of #112642 - compiler-errors:interp-lit-err, r=nnethercoteDylan DPC-6/+21
Handle interpolated literal errors Not sure why it was doing a whole dance to re-match on the token kind when it seems like `Lit::from_token` does the right thing for both macro-arg and regular literals. Nothing seems to have regressed diagnostics-wise from the change, though. Fixes #112622 r? ``@nnethercote``
2023-06-16Rollup merge of #112639 - nnethercote:fix-dead_code_cgu, r=wesleywiserDylan DPC-44/+41
Fix `dead_code_cgu` computation This PR fixes a bug in `dead_code_cgu` computation, and also does some refactoring. r? ```@wesleywiser```
2023-06-16Rollup merge of #112579 - MikaelUrankar:freebsd_docs, r=cuviperDylan DPC-0/+1
Fix building libstd documentation on FreeBSD. It fixes the following error: ``` error[E0412]: cannot find type `sockcred2` in module `libc` --> library/std/src/os/unix/net/ancillary.rs:211:29 | 211 | pub struct SocketCred(libc::sockcred2); | ^^^^^^^^^ not found in `libc` ```
2023-06-16Rollup merge of #112535 - RalfJung:miri-test-libstd, r=cuviperDylan DPC-11/+12
reorder attributes to make miri-test-libstd work again Fixes fallout from https://github.com/rust-lang/rust/pull/110141