about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-03-30Rollup merge of #83667 - estebank:cool-bears-hot-tip, r=lcnrDylan DPC-91/+79
Suggest box/pin/arc ing receiver on method calls _Extracted from https://fasterthanli.me/articles/pin-and-suffering_
2021-03-30Rollup merge of #83662 - ehuss:update-books, r=ehussDylan DPC-0/+0
Update books ## reference 4 commits in d10a0af8dca25d9d548ca6a369fd66ad06acb3c9..fd97729e2d82f8b08d68a31c9bfdf0c37a7fd542 2021-03-21 11:14:06 -0700 to 2021-03-28 14:29:19 -0700 - Editorial cleanup on expressions (part 1) (rust-lang-nursery/reference#967) - Update type casts section (rust-lang-nursery/reference#961) - Add missing "?" notion (rust-lang-nursery/reference#989) - Fix typo (rust-lang-nursery/reference#988) ## book 8 commits in fc2f690fc16592abbead2360cfc0a42f5df78052..b54090a99ec7c4b46a5203a9c927fdbc311bb1f5 2021-03-05 14:03:22 -0500 to 2021-03-24 11:21:46 -0500 - correct the signature of the `deref` method (rust-lang/book#2658) - Clarify the immutability of a reference (rust-lang/book#2646) - Tweak wording around Windows representation of enter - Ch. 02 note - Enter results in CRLF on Windows (rust-lang/book#2648) - Added an example of slicing result (rust-lang/book#2649) - Fix word wrapping, mention dictionary.txt is also in the ci dir - README: note that spellcheck.sh is in ci directory (rust-lang/book#2652) - Change someurl.com to example.org (rust-lang/book#2655) ## rust-by-example 12 commits in eead22c6c030fa4f3a167d1798658c341199e2ae..29d91f591c90dd18fdca6d23f1a9caf9c139d0d7 2021-03-04 16:26:43 -0300 to 2021-03-23 09:03:39 -0300 - Unwrap some drinks. (rust-lang/rust-by-example#1431) - doc(testcase_linked_list): add a little extra note about pattern (rust-lang/rust-by-example#1408) - Update function name in comment (rust-lang/rust-by-example#1413) - Fixes minor typo in src/types/cast.md (rust-lang/rust-by-example#1414) - Add destructuring example to generics new type (rust-lang/rust-by-example#1416) - update struct.md (rust-lang/rust-by-example#1419) - fix name from rectangle to Rectangle (rust-lang/rust-by-example#1420) - Typo "incures" in code comment (rust-lang/rust-by-example#1422) - Changed impl to use Self::Item (rust-lang/rust-by-example#1425) - Fix code highlighting in some places (rust-lang/rust-by-example#1427) - Update multi_bounds.md (rust-lang/rust-by-example#1428) - Reformulated text for redability (rust-lang/rust-by-example#1429) ## rustc-dev-guide 3 commits in 67ebd4b55dba44edfc351621cef6e5e758169c55..0687daac28939c476df51778f5a1d1aff1a3fddf 2021-03-11 13:36:25 -0800 to 2021-03-28 13:33:56 -0400 - Add notes about nightly rustc version for the rustc-driver examples - Update rustc-driver-*.rs examples (rust-lang/rustc-dev-guide#1095) - Fix rust compiler meeting info (rust-lang/rustc-dev-guide#1087) ## embedded-book 1 commits in f61685755fad7d3b88b4645adfbf461d500563a2..d3f2ace94d51610cf3e3c265705bb8416d37f8e4 2021-03-08 01:06:44 +0000 to 2021-03-17 07:53:09 +0000 - Add binary attribute to .jpeg files, closes rust-embedded/book#287 (rust-embedded/book#288)
2021-03-30Rollup merge of #83656 - JohnTitor:resolve-test, r=petrochenkovDylan DPC-0/+34
Add a regression test for issue-82865 Closes #82865 r? `@petrochenkov`
2021-03-30Rollup merge of #83645 - pickfire:patch-3, r=GuillaumeGomezDylan DPC-1/+3
Wrap non-pre code blocks Fix #83550 regression ``` $ cargo new --lib whitespace && cd whitespace && echo '//! `" foo "`' > src/lib.rs && cargo doc --open ``` Before ![](https://user-images.githubusercontent.com/89623/112713498-c0dfc200-8ed5-11eb-8c57-efdf26372e74.png) After ![](https://user-images.githubusercontent.com/89623/112713538-f08eca00-8ed5-11eb-8a98-675179f60ae2.png) r? ``@GuillaumeGomez`` cc ``@mgeisler``
2021-03-29Hide unnecessary reference to traitEsteban Küber-3/+0
When the problem for a method not being found in its receiver is due to arbitrary self-types, we don't want to mention importing or implementing the trait, instead we suggest wrapping.
2021-03-30Auto merge of #83664 - Dylan-DPC:rollup-wx6idpd, r=Dylan-DPCbors-94/+210
Rollup of 7 pull requests Successful merges: - #82331 (alloc: Added `as_slice` method to `BinaryHeap` collection) - #83130 (escape_ascii take 2) - #83374 (unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs) - #83543 (Lint on unknown intra-doc link disambiguators) - #83636 (Add a regression test for issue-82792) - #83643 (Remove a FIXME resolved by #73578) - #83644 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-03-29Suggest box/pin/arc ing receiver on method callsEsteban Küber-91/+82
2021-03-30Add a regression test for issue-82865JohnTitor-0/+34
2021-03-30Rollup merge of #83644 - lnicola:rust-analyzer-2021-03-29, r=jonas-schievinkDylan DPC-16/+21
:arrow_up: rust-analyzer
2021-03-30Rollup merge of #83636 - JohnTitor:const-generics-defualts-regg-test, r=lcnrDylan DPC-52/+66
Add a regression test for issue-82792 Closes #82792 r? ``@lcnr``
2021-03-30Rollup merge of #83543 - camelid:lint-unknown-disambiguator, r=jyn514Dylan DPC-26/+123
Lint on unknown intra-doc link disambiguators
2021-03-29Auto merge of #82864 - jyn514:short-circuit, r=GuillaumeGomezbors-6/+2
rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls Less broken version of https://github.com/rust-lang/rust/pull/82856. get_blanket_impls is a *very* hot region of rustdoc, so even small changes like this should help. Unfortunately I don't have benchmarks for this until https://github.com/rust-lang/rustc-perf/pull/802 is merged.
2021-03-29Update booksEric Huss-0/+0
2021-03-29Auto merge of #83185 - jyn514:remove-dead-code, r=oli-obkbors-2/+2
Remove (lots of) dead code Builds on - [ ] https://github.com/rust-lang/rust/pull/83161 - [x] https://github.com/rust-lang/rust/pull/83230 - [x] https://github.com/rust-lang/rust/pull/83197. Found with https://github.com/est31/warnalyzer. See https://github.com/rust-lang/rust/pull/77739 for a similar change in the past. Dubious changes: - Maybe some of the dead code in rustc_data_structures should be kept, in case someone wants to use it in the future? TODO: - [ ] check if any of the comments on the deleted code should be kept. - [x] update the compiler documentation; right now it fails to build - [x] finish moving `cfg(test)` changes into https://github.com/rust-lang/rust/pull/83197 cc `@est31`
2021-03-29Auto merge of #80839 - tblah:riscv64linux_links, r=Mark-Simulacrumbors-16/+38
Riscv64linux Test fixes Get tests passing again using the riscv64gc-unknown-linux-gnu docker image. Test with ``` src/ci/docker/run.sh riscv64gc-linux ``` ## linkcheck Linkcheck tests that interdocument links in the documentation are correct. Some interdocument links go between rustc and tools (such as rustdoc and cargo). When cross compiling, rustc is built for the host while some tools are built for the target. This goes for the documentation too. Because of this, links in the rustc documentation reffering to cargo or rustdoc documentation look broken. This issue is worked around by disabling linkcheck for cross compilation builds. ## run-make tests #78911 seems to happen because `--target` was not passed to `rustc`, but the target linker was specified, causing the target linker to be called with options intended for the host. Resolves #78911 In a separate issue, `issue-36710` was trying to run a binary built for the target on the host system. This will not work for any platform using `remote-test-server`/`client` (such as riscv64). I don't know of a way of skipping those platforms specifically, so I set this test to skip only on riscv64 for now.
2021-03-29Wrap non-pre code blocksIvan Tham-1/+3
Fix #83550 regression
2021-03-29:arrow_up: rust-analyzerLaurențiu Nicola-16/+21
2021-03-29Prefer 4 spacesJohnTitor-52/+52
2021-03-29Add a regression test for issue-82792JohnTitor-0/+14
2021-03-29Auto merge of #83565 - RalfJung:miri, r=oli-obkbors-10/+15
update Miri, and also run test suite with mir-opt-level=4 In the Miri repo, we run the Miri test suite once with default flags and once with `-O -Zmir-opt-level=4`. This helps identify and document situations where MIR optimizations mask UB -- it is okay for that to happen, but it might be god to look into it when it does happen. Recently these tests failed fairly frequently as new MIR optimizations were added, and since we only run them on the Miri side, it is not even clear which rustc PR introduced the change. So I propose we also run these tests in the rustc repo, such that toolstate tracking will tell us the exact PR (or at least the rollup) that caused the change. r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/83590
2021-03-28Inline `find_suffix` closure that's only used onceCamelid-18/+14
2021-03-28Add test for weird backticks placementCamelid-8/+23
2021-03-28Point to disambiguator instead of whole linkCamelid-22/+35
And, now that we do that, we can remove the explanatory note since the error span should make it clear what the disambiguator is.
2021-03-29Auto merge of #83605 - RalfJung:unaligned, r=petrochenkovbors-23/+63
unaligned_references: align(N) fields in packed(N) structs are fine This removes some false positives from the unaligned_references lint: in a `repr(packed(2))` struct, fields of alignment 2 (and less) are guaranteed to be properly aligned, so we do not have to consider them "disaligned".
2021-03-28Auto merge of #83602 - JohnTitor:cloudabi-flag-is-unnecessary, r=Xanewokbors-1/+0
Remove unnecessary `ignore-cloudabi` flag ...since we dropped the CloudABI support.
2021-03-28test: run-make: skip tests on unsupported platformsTom Eccles-0/+7
The tests issue-36710 and incr-prev-body-beyond-eof were changed in a previous commit so that the correct target was passed to rustc (previously rustc was building for the host not for the specific target). Since that change it turns out that these platforms never worked (they only appeared to work because rustc was actually building for the host architecture). The wasm architectures fall over trying to build the C++ file in issue-36710. They look for clang (which isn't installed in the test-various docker container). If clang is installed, they can't find a wasm c++ standard library to link to. nvtptx64-nvidia-cuda fails in rustc saying it can't find std. The rust platforms support page says that std is supported on cuda so this is surprising. dist-i586-gnu-i586-i686-musl can't find the C++ compiler. There is only a musl-gcc and no musl-g++ in /musl-i586/bin/. The Docker image probably needs tweaking.
2021-03-28test: run-make: flag tests which won't work in no-std environmentsTom Eccles-0/+5
2021-03-28ci: docker: x86_64: specify host explicitlyTom Eccles-1/+2
2021-03-28bootstrap: don't run linkcheck when crosscompilingTom Eccles-1/+15
When we cross compile, some things (and their documentation) are built for the host (e.g. rustc), while others (and their documentation) are built for the target. This generated documentation will have broken links between documentation for different platforms e.g. between rustc and cargo.
2021-03-28ci: docker: riscv64gc: specify host explicitlyTom Eccles-1/+1
2021-03-28run-make: skip issue-36710 on riscv64 and armhfTom Eccles-0/+4
The test assumes it can run target binaries on the host. This not true for riscv64 CI (or for other platforms using remote-test-server).
2021-03-28run-make: Specify --target to rustcTom Eccles-14/+5
Resolves #78911 The target's linker was used but rustc wasn't told to build for that target (instead defaulting to the host). This led to the host instead of the target getting tested and to the linker getting inappropriate arguments.
2021-03-28adjust old testRalf Jung-16/+31
2021-03-28unaligned_references: align(N) fields in packed(N) structs are fineRalf Jung-7/+32
2021-03-28update MiriRalf Jung-9/+7
2021-03-28Remove unnecessary `ignore-cloudabi` flagJohnTitor-1/+0
2021-03-28Auto merge of #81354 - SkiFire13:binary-search-assume, r=nagisabors-0/+19
Instruct LLVM that binary_search returns a valid index This allows removing bound checks when the return value of `binary_search` is used to index into the slice it was call on. I also added a codegen test for this, not sure if it's the right thing to do (I didn't find anything on the dev guide), but it felt so.
2021-03-27Remove (lots of) dead codeJoshua Nelson-2/+2
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-27Auto merge of #83103 - petrochenkov:unilex, r=Aaron1011bors-4/+8
resolve: Partially unify early and late scope-relative identifier resolution Reuse `early_resolve_ident_in_lexical_scope` instead of a chunk of code in `resolve_ident_in_lexical_scope` doing the same job. `early_resolve_ident_in_lexical_scope`/`visit_scopes` had to be slightly extended to be able to 1) start from a specific module instead of the current parent scope and 2) report one deprecation lint. `early_resolve_ident_in_lexical_scope` still doesn't support walking through "ribs", that part is left in `resolve_ident_in_lexical_scope` (moreover, I'm pretty sure it's buggy, but that's a separate issue, cc https://github.com/rust-lang/rust/issues/52389 at least).
2021-03-27resolve: Partially unify early and late scope-relative ident resolutionVadim Petrochenkov-4/+8
2021-03-27Rollup merge of #83548 - Aaron1011:capture-none-delims, r=petrochenkovDylan DPC-13/+58
Always preserve `None`-delimited groups in a captured `TokenStream` Previously, we would silently remove any `None`-delimiters when capturing a `TokenStream`, 'flattenting' them to their inner tokens. This was not normally visible, since we usually have `TokenKind::Interpolated` (which gets converted to a `None`-delimited group during macro invocation) instead of an actual `None`-delimited group. However, there are a couple of cases where this becomes visible to proc-macros: 1. A cross-crate `macro_rules!` macro has a `None`-delimited group stored in its body (as a result of being produced by another `macro_rules!` macro). The cross-crate `macro_rules!` invocation can then expand to an attribute macro invocation, which needs to be able to see the `None`-delimited group. 2. A proc-macro can invoke an attribute proc-macro with its re-collected input. If there are any nonterminals present in the input, they will get re-collected to `None`-delimited groups, which will then get captured as part of the attribute macro invocation. Both of these cases are incredibly obscure, so there hopefully won't be any breakage. This change will allow more agressive 'flattenting' of nonterminals in #82608 without losing `None`-delimited groups.
2021-03-27Rollup merge of #82993 - camelid:source-use-diag, r=jyn514Dylan DPC-5/+3
rustdoc: Use diagnostics for error when including sources This error probably almost never happens, but we should still use the diagnostic infrastructure. My guess is that the error was added back before rustdoc used the rustc diagnostic infrastructure (it was all `println!` and `eprintln!` back then!) and since it likely rarely occurs and this code doesn't change that much, no one thought to transition it to using diagnostics. Note that the old error was actually a warning (it didn't stop the rest of doc building). It seems very unlikely that this would fail without the rest of the doc build failing, so it makes more sense for it to be a hard error. The error looks like this: error: failed to render source code for `src/test/rustdoc/smart-punct.rs`: "bar": foo --> src/test/rustdoc/smart-punct.rs:3:1 | 3 | / #![crate_name = "foo"] 4 | | 5 | | //! This is the "start" of the 'document'! How'd you know that "it's" ... 6 | | //! ... | 22 | | //! I say "don't smart-punct me -- please!" 23 | | //! ``` | |_______^ I wasn't sure how to trigger the error, so to create that message I temporarily made rustdoc always emit it. That's also why it says "bar" and "foo" instead of a real error message. Note that the span of the diagnostic starts at line 3 because line 1 of that file is a (non-doc) comment and line 2 is a blank line.
2021-03-27Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-seDylan DPC-35/+41
Add function core::iter::zip This makes it a little easier to `zip` iterators: ```rust for (x, y) in zip(xs, ys) {} // vs. for (x, y) in xs.into_iter().zip(ys) {} ``` You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and `iter()`, respectively. This can also support arbitrary nesting, where it's easier to see the item layout than with arbitrary `zip` chains: ```rust for ((x, y), z) in zip(zip(xs, ys), zs) {} for (x, (y, z)) in zip(xs, zip(ys, zs)) {} // vs. for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {} for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {} ``` It may also format more nicely, especially when the first iterator is a longer chain of methods -- for example: ```rust iter::zip( trait_ref.substs.types().skip(1), impl_trait_ref.substs.types().skip(1), ) // vs. trait_ref .substs .types() .skip(1) .zip(impl_trait_ref.substs.types().skip(1)) ``` This replaces the tuple-pair `IntoIterator` in #78204. There is prior art for the utility of this in [`itertools::zip`]. [`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html
2021-03-27Rollup merge of #82626 - lcnr:encode_with_shorthandb, r=estebankDylan DPC-23/+28
update array missing `IntoIterator` msg fixes #82602 r? ```@estebank``` do you know whether we can use the expr span in `rustc_on_unimplemented`? The label isn't too great rn
2021-03-27Rollup merge of #82525 - RalfJung:unaligned-ref-warn, r=petrochenkovDylan DPC-212/+160
make unaligned_references future-incompat lint warn-by-default and also remove the safe_packed_borrows lint that it replaces. `std::ptr::addr_of!` has hit beta now and will hit stable in a month, so I propose we start fixing https://github.com/rust-lang/rust/issues/27060 for real: creating a reference to a field of a packed struct needs to eventually become a hard error; this PR makes it a warn-by-default future-incompat lint. (The lint already existed, this just raises its default level.) At the same time I removed the corresponding code from unsafety checking; really there's no reason an `unsafe` block should make any difference here. For references to packed fields outside `unsafe` blocks, this means `unaligned_refereces` replaces the previous `safe_packed_borrows` warning with a link to https://github.com/rust-lang/rust/issues/82523 (and no more talk about unsafe blocks making any difference). So behavior barely changes, the warning is just worded differently. For references to packed fields inside `unsafe` blocks, this PR shows a new future-incompat warning. Closes https://github.com/rust-lang/rust/issues/46043 because that lint no longer exists.
2021-03-27Rollup merge of #81351 - lcnr:big-money-big-prices, r=oli-obkDylan DPC-9/+85
combine: stop eagerly evaluating consts `super_relate_consts` eagerly evaluates constants which doesn't seem too great. I now also finally understand why all of the unused substs test passed. The reason being that we just evaluated the constants in `super_relate_consts` :laughing: While this change isn't strictly necessary as evaluating consts here doesn't hurt, it still feels a lot cleaner to do it this way r? `@oli-obk` `@nikomatsakis`
2021-03-28Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726Yuki Okushi-3/+48
Add regression tests for #56445 Closes #56445.
2021-03-28Rollup merge of #83567 - jonjensen:patch-1, r=GuillaumeGomezYuki Okushi-1/+1
Update rustup cross-compilation docs link
2021-03-28Rollup merge of #83348 - osa1:issue83344, r=jackh726Yuki Okushi-2/+17
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344 --- r? ```@estebank```
2021-03-27make unaligned_refereces future-incompat lint warn-by-default, and remove ↵Ralf Jung-212/+160
the safe_packed_borrows lint that it replaces