about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-04-25Rollup merge of #84541 - KaiJewson:inline-raw, r=m-ou-seDylan DPC-0/+76
Inline most raw socket, fd and handle conversions Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. `Socket` from socket2) to store a `File` internally instead of a `RawFd`, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as `IntoRawFd`, `FromRawFd` and `AsRawFd` are not inlined. This change adds `#[inline]` to those methods on std types that wrap file descriptors, handles or sockets.
2021-04-25Rollup merge of #84520 - hameerabbasi:fn-as-ty, r=lcnrDylan DPC-0/+41
Improve diagnostics for function passed when a type was expected. This PR improves diagnostics, it provides more information when a function is passed where a type is expected. r? `@lcnr`
2021-04-25Rollup merge of #84516 - torhovland:issue-84114, r=estebankDylan DPC-5/+121
Add suggestion to "use break" when attempting to implicit-break a loop Fixes #84114
2021-04-25Rollup merge of #84499 - estebank:issue-84272, r=jackh726Dylan DPC-8/+96
Tweak trait not `use`d suggestion Fix #84272. Follow up to #83667.
2021-04-25Rollup merge of #84486 - Smittyvb:else-if-let-hir-pretty-print, r=petrochenkovDylan DPC-2/+69
Handle pretty printing of `else if let` clauses without ICEing When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing. ```rust pub fn main() { if true { // 1 } else if let a = 1 { // 2 } else { // 3 } } ``` now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to: ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (if (true as bool) ({ // 1 } as ()) else {match (1 as i32) { a => { // 2 } _ => { // 3 } }} as ()) } as ()) ``` For comparison, this code gets HIR prettyprinted the same way before and after this change: ```rust pub fn main() { if let a = 1 { // 2 } else { // 3 } } ``` turns into ```rust #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; pub fn main() ({ (match (1 as i32) { a => { // 2 } _ => { // 3 } } as ()) } as ()) ``` This closes #82329. It closes #84434 as well, due to having the same root cause.
2021-04-25Rollup merge of #84450 - jyn514:missing-std, r=petrochenkovDylan DPC-5/+63
Give a better error when `std` or `core` are missing - Suggest using `rustup target add` if `RUSTUP_HOME` is set. I don't know if there's any precedent for doing this, but it seems harmless enough and it will be a big help. - On nightly, suggest using `cargo build -Z build-std` if `CARGO` is set - Add a note about `#![no_std]` if `std` is missing but not core - Add a note that std may be unsupported if `std` is missing but not core Fixes https://github.com/rust-lang/rust/issues/84418. r? `@petrochenkov`
2021-04-25Rollup merge of #84235 - klensy:styled-buffer, r=lcnrDylan DPC-35/+55
refactor StyledBuffer Refactors StyledBuffer `text` and `styles` fields content into StyledChar and touches some other stuff.
2021-04-25Auto merge of #84481 - RalfJung:miri, r=RalfJungbors-9/+7
update Miri Fixes https://github.com/rust-lang/rust/issues/84553 Cc `@rust-lang/miri` r? `@ghost`
2021-04-25update MiriRalf Jung-9/+7
2021-04-25Give a better error when std or core are missingJoshua Nelson-5/+63
- Suggest using `rustup target add` if `RUSTUP_HOME` is set. I don't know if there's any precedent for doing this, but it seems harmless enough and it will be a big help. - Add a note about `#![no_std]` if `std` is missing but not core - On nightly, suggest using `cargo build -Z build-std` if `CARGO` is set - Add a note that std may be unsupported if `std` is missing but not core - Don't suggest `#![no_std]` when the load isn't injected by the compiler
2021-04-25Auto merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkorbors-218/+386
various const parameter defaults improvements Actually resolve names in const parameter defaults, fixing `struct Foo<const N: usize = { usize::MAX }>`. --- Split generic parameter ban rib for types and consts, allowing ```rust #![feature(const_generics_defaults)] struct Q; struct Foo<T = Q, const Q: usize = 3>(T); ``` --- Remove the type/const ordering restriction if `const_generics_defaults` is active, even if `const_generics` is not. allowing us to stabilize and test const param defaults separately. --- Check well formedness of const parameter defaults, eagerly emitting an error for `struct Foo<const N: usize = { 0 - 1 }>` --- Do not forbid const parameters in param defaults, allowing `struct Foo<const N: usize, T = [u8; N]>(T)` and `struct Foo<const N: usize, const M: usize = N>`. Note that this should not change anything which is stabilized, as on stable, type parameters must be in front of const parameters, which means that type parameter defaults are only allowed if no const parameters exist. We still forbid generic parameters inside of const param types. r? `@varkor` `@petrochenkov`
2021-04-25Auto merge of #84216 - RalfJung:black-box, r=Mark-Simulacrumbors-13/+23
move core::hint::black_box under its own feature gate The `black_box` function had its own RFC and is tracked separately from the `test` feature at https://github.com/rust-lang/rust/issues/64102. Let's reflect this in the feature gate. To avoid breaking all the benchmarks, libtest's `test::black_box` is a wrapping definition, not a reexport -- this means it is still under the `test` feature gate.
2021-04-25fix sanitizer testsRalf Jung-5/+4
2021-04-25move core::hint::black_box under its own feature gateRalf Jung-9/+20
2021-04-25Auto merge of #84147 - cuviper:array-method-dispatch, r=nikomatsakis,m-ou-sebors-171/+237
Cautiously add IntoIterator for arrays by value Add the attribute described in #84133, `#[rustc_skip_array_during_method_dispatch]`, which effectively hides a trait from method dispatch when the receiver type is an array. Then cherry-pick `IntoIterator for [T; N]` from #65819 and gate it with that attribute. Arrays can now be used as `IntoIterator` normally, but `array.into_iter()` has edition-dependent behavior, returning `slice::Iter` for 2015 and 2018 editions, or `array::IntoIter` for 2021 and later. r? `@nikomatsakis` cc `@LukasKalbertodt` `@rust-lang/libs`
2021-04-25Improve diagnostics for function passed when a type was expected.Hameer Abbasi-0/+41
2021-04-25Inline most raw socket, fd and handle conversionsKaiJewson-0/+76
2021-04-24Ignore array IntoIterator tests in bootstrapJosh Stone-2/+4
2021-04-25Auto merge of #84115 - CDirkx:rt, r=m-ou-sebors-262/+175
Rework `init` and `cleanup` This PR reworks the code in `std` that runs before and after `main` and centralizes this code respectively in the functions `init` and `cleanup` in both `sys_common` and `sys`. This makes is easy to see what code is executed during initialization and cleanup on each platform just by looking at e.g. `sys::windows::init`. Full list of changes: - new module `rt` in `sys_common` to contain `init` and `cleanup` and the runtime macros. - `at_exit` and the mechanism to register exit handlers has been completely removed. In practice this was only used for closing sockets on windows and flushing stdout, which have been moved to `cleanup`. - <s>On windows `alloc` and `net` initialization is now done in `init`, this saves a runtime check in every allocation and network use.</s>
2021-04-25Auto merge of #80339 - jyn514:no-span, r=GuillaumeGomezbors-55/+80
Calculate `span` info on-demand - Add helper `attr_span` for common reused function - Stop storing `Span`s on `Item` directly; calculate them on demand instead - Special case modules, which have different spans depending on whether you use inner or outer attributes - Special case impls with fake IDs, which can have either dummy spans (for auto traits) or the DefId of the impl block (for blanket impls) - Use a fake ID for primitives instead of the ID of the crate; this lets `source()` know that it should use a dummy span instead of the span of the crate. This shrinks `Item` from 48 to 40 bytes. Helps with https://github.com/rust-lang/rust/issues/76382.
2021-04-24Finally (finally) ((finally!!!!)) fix spans for the standard libraryJoshua Nelson-1/+5
2021-04-24Get rid of `item.span`Joshua Nelson-36/+44
- Remove `span` field, adding `Item::span()` instead - Special-case `Impl` and `Module` items - Use dummy spans for primitive items
2021-04-24Do the hard part firstJoshua Nelson-20/+33
The only bit failing was the module, so change that before removing the `span` field.
2021-04-24Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obkbors-114/+176
further split up const_fn feature flag This continues the work on splitting up `const_fn` into separate feature flags: * `const_fn_trait_bound` for `const fn` with trait bounds * `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here) I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more. `@oli-obk` are you currently able to do reviews?
2021-04-24Add attr_span helper functionJoshua Nelson-17/+17
2021-04-24update rustc-perf version that is used for PGORalf Jung-1/+1
2021-04-24Auto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomezbors-44/+6
Revert "rustdoc: Hide `#text` in doc-tests" See discussion in #84502 - I'm worried that #84445 may cause a lot of breakages if this were to hit stable, so I think it's safer to revert and work on the known correct fix #84478.
2021-04-24One more test case.Tor Hovland-1/+16
2021-04-24reviewklensy-24/+14
2021-04-24Auto merge of #84525 - JohnTitor:rollup-t2qigt3, r=JohnTitorbors-1797/+5029
Rollup of 8 pull requests Successful merges: - #83519 (Implement a lint that highlights all moves larger than a configured limit) - #84105 (stabilize `core::array::{from_ref,from_mut}` in `1.53.0`) - #84179 (Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`) - #84427 (Update Clippy) - #84459 (rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`) - #84460 (rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module) - #84464 (rustdoc: Get rid of `clean::TypeKind`) - #84518 (Clean up DOM strings) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-04-24More tests.Tor Hovland-7/+51
2021-04-25Rollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jshaYuki Okushi-4/+9
Clean up DOM strings Follow-up of #84320. r? ``@jsha``
2021-04-25Rollup merge of #84464 - jyn514:type-kind, r=CraftSpiderYuki Okushi-134/+93
rustdoc: Get rid of `clean::TypeKind` It does exactly the same thing as ItemType.
2021-04-25Rollup merge of #84460 - jyn514:doctree-is-crate, r=camelidYuki Okushi-42/+26
rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `json::conversions::from_item_kind` to take a whole item, which avoids having to add more and more parameters. Helps with https://github.com/rust-lang/rust/issues/76382. r? ```@camelid```
2021-04-25Rollup merge of #84459 - jyn514:json-mod, r=aDotInTheVoidYuki Okushi-15/+2
rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()` The JSON renderer no longer gets called on modules (since https://github.com/rust-lang/rust/pull/83055). r? ``@aDotInTheVoid``
2021-04-25Rollup merge of #84427 - flip1995:clippyup, r=ManishearthYuki Okushi-1551/+4649
Update Clippy r? ```@Manishearth``` Biweekly Clippy update.
2021-04-25Rollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-seYuki Okushi-27/+30
Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}` Remove the field `_dont_send_or_sync_me: PhantomData<*mut ()>` in favor of an explicit implementation of `!Send` and `!Sync`.
2021-04-25Rollup merge of #84105 - WaffleLapkin:stabilize_array_from_ref, r=m-ou-seYuki Okushi-3/+2
stabilize `core::array::{from_ref,from_mut}` in `1.53.0` I didn't get any response in https://github.com/rust-lang/rust/issues/77101#issuecomment-761831104, so I figured out I can try opening stabilization pr. --- This PR stabilizes following functions: ```rust // core::array pub fn from_ref<T>(s: &T) -> &[T; 1]; pub fn from_mut<T>(s: &mut T) -> &mut [T; 1]; ``` Functions are similar to already stabilized `core::slice::{`[`from_ref`](https://doc.rust-lang.org/std/slice/fn.from_ref.html),[`from_mut`](https://doc.rust-lang.org/std/slice/fn.from_mut.html)`}` and were unstable without any problems/questions for a while now. --- resolves #77101 ``@rustbot`` modify labels: +T-libs
2021-04-25Rollup merge of #83519 - oli-obk:assign_shrink_your_normal_code, r=pnkfelixYuki Okushi-21/+218
Implement a lint that highlights all moves larger than a configured limit Tracking issue: #83518 [MCP 420](https://github.com/rust-lang/compiler-team/issues/420) still ~blazing~ in progress r? ```@pnkfelix``` The main open issue I see with this minimal impl of the feature is that the lint is immediately "stable" (so it can be named on stable), even if it is never executed on stable. I don't think we have the concept of unstable lint names or hiding lint names without an active feature gate, so that would be a bigger change.
2021-04-24Refactor.Tor Hovland-57/+23
2021-04-24Added a test.Tor Hovland-0/+19
2021-04-24rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`Joshua Nelson-15/+2
The JSON renderer no longer gets called on modules.
2021-04-24Auto merge of #84412 - ehuss:update-cargo, r=ehussbors-12/+9
Update cargo, rls ## cargo 18 commits in 65d57e6f384c2317f76626eac116f683e2b63665..0ed318d182e465cd66071b91ac3d265af63ef8a1 2021-04-04 15:07:52 +0000 to 2021-04-23 20:54:54 +0000 - Restore crates.io's `SourceId` hash value to before (rust-lang/cargo#9397) - Fix loading `branch=master` patches in the v3 lock transition (rust-lang/cargo#9392) - Update changelog for 1.52 beta changes. (rust-lang/cargo#9396) - Fix build-std updating the index on every build. (rust-lang/cargo#9393) - Fix typo in profile docs (rust-lang/cargo#9386) - Fix disagreement about lockfile ordering on stable/nightly (rust-lang/cargo#9384) - Don't give a hard error when the end-user specifies RUSTC_BOOTSTRAP=crate_name (rust-lang/cargo#9365) - Fix rust-lang/cargo#9350 (cargo build -Z help is missing options) (rust-lang/cargo#9369) - an struct -&gt; a struct (rust-lang/cargo#9379) - Handle man pages better on Windows. (rust-lang/cargo#9378) - fix: better error message when dependency/workspace member missing (rust-lang/cargo#9368) - Fix typo in book (rust-lang/cargo#9376) - Don't re-use rustc cache when RUSTC_WRAPPER changes (rust-lang/cargo#9348) - doc: add split-debuginfo doc in config chapter (rust-lang/cargo#9372) - refactor: remove `CargoResultExt` (rust-lang/cargo#9367) - Track "CARGO" in environment fingerprint. (rust-lang/cargo#9363) - Update clippy lint allow set. (rust-lang/cargo#9356) - Fix 'suport' typo in documentation (rust-lang/cargo#9338) ## rls 3 commits in 32c0fe006dcdc13e1ca0ca31de543e4436c1299e..74d1800c25498689c5b5120a1e8495fce0cd0d0d 2021-04-12 11:21:12 +0000 to 2021-04-22 21:29:51 +0000 - Bump default integration test message timeout to 30s (rust-lang-nursery/rls#1731) - itertools = 0.9, fst = 0.4 (rust-lang-nursery/rls#1729) - Update cargo (rust-lang-nursery/rls#1728)
2021-04-24Clean up DOM stringsGuillaume Gomez-4/+9
2021-04-24Implemented suggestion.Tor Hovland-5/+77
2021-04-24Revert "rustdoc: Hide `#text` in doc-tests"David Hewitt-44/+6
This reverts commit af6c3201fc3d5ec2559836454ea4f43eec583fa2.
2021-04-24Auto merge of #84501 - JohnTitor:rollup-wxu1thu, r=JohnTitorbors-152/+324
Rollup of 10 pull requests Successful merges: - #83990 (implement `TrustedRandomAccess` for `Take` iterator adapter) - #84250 (bootstrap: use bash on illumos to run install scripts) - #84320 (Use details tag for trait implementors.) - #84436 (Make a few functions private) - #84453 (Document From implementations for Waker and RawWaker) - #84458 (Remove unnecessary fields and parameters in rustdoc) - #84485 (Add some associated type bounds tests) - #84489 (Mention FusedIterator case in Iterator::fuse doc) - #84492 (rustdoc: Remove unnecessary dummy span) - #84496 (Add some specialization tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-04-24Rollup merge of #84496 - marmeladema:specialization-test, r=JohnTitorYuki Okushi-0/+91
Add some specialization tests Closes #33017 Closes #51892 r? `@JohnTitor`
2021-04-24Rollup merge of #84492 - jyn514:span, r=camelidYuki Okushi-3/+4
rustdoc: Remove unnecessary dummy span Follow-up to https://github.com/rust-lang/rust/pull/84460#discussion_r619447655. r? `@camelid`
2021-04-24Rollup merge of #84489 - amorison:issue-83969-fix, r=yaahcYuki Okushi-0/+5
Mention FusedIterator case in Iterator::fuse doc Using `fuse` on an iterator that incorrectly implements `FusedIterator` does not fuse the iterator. This commit adds a note about this in the documentation of this method to increase awareness about this potential issue (esp. when relying on fuse in unsafe code). Closes #83969