about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-12-16Test documentation of hidden items in stdChris Denton-1/+1
2022-12-17docs: add long error explanation for error E0320Ezra Shaw-1/+32
2022-12-16Auto merge of #105018 - zertosh:path_buf_deref_mut, r=dtolnaybors-0/+14
Implement DerefMut for PathBuf Without this, there's no way to get a `&mut Path` from `PathBuf` without going through `into_boxed_path`. This is relevant now that #105002 adds `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`.
2022-12-16rustdoc: clean up margin CSS for scraped examplesMichael Howell-9/+4
* This stops applying a margin to the additional example links. Because these links are `display: inline`, it doesn't actually do anything. * This switches from using a margin-bottom with a special exception for the examples themselves, plus an additional margin on the hide button, to instead using just margin-top on the examples, with an exception for the first one. No user-visible changes should result from this.
2022-12-16fix logic in IncrementVisitorEric Wu-7/+33
There used to be a logical bug where IncrementVisitor would completely stop checking an expression/block after seeing a continue statement. This led to issue #10058 where a variable incremented (or otherwise modified) after any continue statement would still be considered incremented only once. The solution is to continue scanning the expression after seeing a `continue` statement, but increment self.depth so that the Visitor thinks that the rest of the loop is within a conditional.
2022-12-16Auto merge of #105775 - matthiaskrgr:rollup-2o8qn7e, r=matthiaskrgrbors-156/+194
Rollup of 8 pull requests Successful merges: - #105725 (Allow `impl ~const Trait` opaque types) - #105744 (Rewrite `E0158` error-code docs for clarity) - #105747 (Fix ICE calling method on auto trait) - #105748 (doc: Fix a few small issues) - #105756 (rustdoc: simplify CSS for codeblock tooltips) - #105757 (rustdoc: remove unused CSS `.sub-settings`) - #105764 (rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`) - #105774 (Remove unused stderr files) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-16Add a comment warning against using associated type defaults <3Maybe Waffle-0/+8
2022-12-16Detect inherent associated types not having CamelCaseDeadbeef-1/+37
Fixes #105341.
2022-12-16Add test for presence of read more linksGuillaume Gomez-2/+34
2022-12-16Don't add "Read more" link if there is no extra contentGuillaume Gomez-8/+24
2022-12-16Rollup merge of #105774 - TaKO8Ki:remove-unused-stderr-files, r=tmiaskoMatthias Krüger-16/+0
Remove unused stderr files
2022-12-16Rollup merge of #105764 - notriddle:notriddle/src-sidebar-toggle, ↵Matthias Krüger-37/+37
r=GuillaumeGomez rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle` The old name doesn't get across where it's really supposed to be used.
2022-12-16Rollup merge of #105757 - notriddle:notriddle/sub-settings, r=GuillaumeGomezMatthias Krüger-6/+0
rustdoc: remove unused CSS `.sub-settings` Obsoleted when 9625ed8be7fa66c3ee5f78180a3d5911817096f6 changed the DOM.
2022-12-16Rollup merge of #105756 - notriddle:notriddle/example-wrap-tooltip, ↵Matthias Krüger-15/+9
r=GuillaumeGomez rustdoc: simplify CSS for codeblock tooltips Instead of making its parts `display: none` and then changing it on hover, just make the pseudo-element itself on hover.
2022-12-16Rollup merge of #105748 - hakoerber:master, r=Dylan-DPCMatthias Krüger-5/+5
doc: Fix a few small issues Hey, while reading through the (awesome) stdlib docs, I found a few minor typos. * A few typos around generic types (`;` vs `,`) * Use inline code formatting for code fragments * One instance of wrong wording
2022-12-16Rollup merge of #105747 - chenyukang:yukang/fix-105732-auto-trait, ↵Matthias Krüger-0/+51
r=compiler-errors Fix ICE calling method on auto trait Fixes #105732 r? `@compiler-errors`
2022-12-16Rollup merge of #105744 - Ezrashaw:e0158-clarity, r=GuillaumeGomezMatthias Krüger-19/+34
Rewrite `E0158` error-code docs for clarity Fixes #105585. The `E0158` error-code docs are unclear. It doesn't explain all three different variants of the error and doesn't explain *why* the error occurs. This PR cleans it up a bit and brings it properly into line with [RFC1567](https://rust-lang.github.io/rfcs/1567-long-error-codes-explanation-normalization.html). I'm a first time Rust contributor so I've probably not got it quite right. I also haven't run the whole build process because I assume that my minor docs changes shouldn't break everything.
2022-12-16Rollup merge of #105725 - fee1-dead-contrib:allow-impl-const-trait, r=oli-obkMatthias Krüger-58/+58
Allow `impl ~const Trait` opaque types
2022-12-16Auto merge of #103880 - b-naber:field-ty-mir, r=lcnrbors-99/+433
Use non-ascribed type as field's type in mir Fixes https://github.com/rust-lang/rust/issues/96514 r? `@lcnr`
2022-12-16remove unused stderr filesTakayuki Maeda-16/+0
2022-12-16Make a field only as public as it needs to beOli Scherer-1/+1
2022-12-16Rename ConstS to ConstDataOli Scherer-16/+16
2022-12-16Auto merge of #105763 - Ezrashaw:rustc-book-relative-links, r=jyn514bors-23/+23
Use relative links in the unstable and rustc book Fixes #98227. As it stands, potential issues could arise from mismatch of stable/ nightly in the books. This PR fixes this issue by using relative links instead of absolute ones. I have replaced every absolute link under `src/doc/rustc` and `src/doc/unstable-book/` and tested each manually. The link at `src/doc/rustc/src/targets/index.md:7`: `[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html).` I need help with because my local directory structure and https://doc.rust-lang.org/ seem to be different, where is `nightly-rustc`? `@jyn514`
2022-12-16Auto merge of #105717 - compiler-errors:anonymize, r=jackh726bors-36/+6
always use `anonymize_bound_vars` Unless this is perf-sensitive, it's probably best to always use one anonymize function that does the right thing for all bound vars. r? types
2022-12-16Auto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebankbors-11/+75
Use impl's def id when calculating type to specify in UFCS Fixes #104327 Fixes #104328 Also addresses https://github.com/rust-lang/rust/pull/102670#discussion_r987381197
2022-12-16Auto merge of #10086 - nbdd0121:master, r=matthiaskrgrbors-50/+105
Fix new_return_no_self with recursive bounds Fix #10041 This uses a hash set, as described in https://github.com/rust-lang/rust-clippy/pull/10068#issuecomment-1352528391 changelog: [`new_return_no_self`]: fix stack overflow when the return type is `impl Trait` and contains recursive bounds
2022-12-15rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`Michael Howell-37/+37
The old name doesn't get across where it's really supposed to be used.
2022-12-15Auto merge of #105760 - matthiaskrgr:rollup-r8beo9w, r=matthiaskrgrbors-996/+1345
Rollup of 8 pull requests Successful merges: - #105481 (Start improving monomorphization items stats) - #105674 (Point at method chains on `E0271` errors) - #105679 (Suggest constraining type parameter with `Clone`) - #105694 (Don't create dummy if val has escaping bounds var) - #105727 (Tweak output for bare `dyn Trait` in arguments) - #105739 (Migrate Jump to def links background to CSS variable) - #105743 (`SimplifiedType` cleanups) - #105758 (Move `TypeckResults` to separate module) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-16remove relative links from `rustc-book` and `unstable-book`Ezra Shaw-23/+23
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-12-16fix #105732, Fix ICE calling method on auto traityukang-0/+51
2022-12-15Rollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnrMatthias Krüger-1/+1
`SimplifiedType` cleanups r? `@lcnr`
2022-12-15Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errorsMatthias Krüger-706/+724
Move `TypeckResults` to separate module `ty::context` is really big and the typeck results aren't directly related to `TyCtxt`, so move them to a separate module. Also contains a small drive-by macro "improvement".
2022-12-15Rollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnrMatthias Krüger-55/+15
`SimplifiedType` cleanups r? `@lcnr`
2022-12-15Rollup merge of #105739 - ↵Matthias Krüger-11/+7
GuillaumeGomez:migrate-jump-to-def-link-to-css-var, r=notriddle Migrate Jump to def links background to CSS variable It's already tested in `src/test/rustdoc-gui/jump-to-def-background.goml`. r? `@notriddle`
2022-12-15Rollup merge of #105727 - estebank:use-impl-trait, r=oli-obkMatthias Krüger-23/+85
Tweak output for bare `dyn Trait` in arguments Fix #35825.
2022-12-15Rollup merge of #105694 - ouz-a:issue_105689, r=estebankMatthias Krüger-13/+29
Don't create dummy if val has escaping bounds var Skips creating/pushing obligations if val has escaping bounds vars. Fixes #105689
2022-12-15Rollup merge of #105679 - estebank:suggest-clone, r=compiler-errorsMatthias Krüger-6/+97
Suggest constraining type parameter with `Clone` Fix #34896.
2022-12-15Rollup merge of #105674 - estebank:iterator-chains, r=oli-obkMatthias Krüger-181/+289
Point at method chains on `E0271` errors Follow up to #105332. Fix #33941. CC #9082. r? `@oli-obk`
2022-12-15Rollup merge of #105481 - lqd:mono-stats, r=wesleywiserMatthias Krüger-1/+99
Start improving monomorphization items stats As described in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Compile-time.20case-study.3A.20AWS.20crates/near/314560832), some stats about monomorphization collection would be interesting to have, in a different form than `-Zprint-mono-items`: to have some visibility into the cost of the mono items, we'd like to know how many are instantiated and what is their estimated size. That can be a proxy to analyze sources of slow compile times, although in the future, we'd also like to add more realistic stats from the actual backend's lowering. This PR adds a new `-Z dump-mono-stats` flag which will output some stats in a `{crate_name}.mono-items.md` file (the flag optionally takes an output directory parameter, for easier use within a workspace than printing to stdout). For example, ```rust fn compute<T>(collection: Vec<T>) -> usize { collection.len() + 19 - 0 * 9 - 18 - 1 * 1 // random code to increase the function's size } fn main() { dbg!(compute(vec![0u8, 1, 2])); dbg!(compute(vec![0u64, 1, 2])); dbg!(compute(vec!["0", "1", "2", "3"])); } ``` will output a file with this markdown table (abridged for readability), for a debug build: | Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost | | --- | ---: | ---: | ---: | | alloc::alloc::box_free | 3 | 122 | 366 | | std::alloc::Global::alloc_impl | 1 | 284 | 284 | | alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 | | std::ptr::align_offset | 1 | 222 | 222 | | std::slice::hack::into_vec | 3 | 67 | 201 | | <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 | | std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 | | main | 1 | 163 | 163 | | std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 | ... <details> <summary>Click for full output</summary> | Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost | | --- | ---: | ---: | ---: | | alloc::alloc::box_free | 3 | 122 | 366 | | std::alloc::Global::alloc_impl | 1 | 284 | 284 | | alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 | | std::ptr::align_offset | 1 | 222 | 222 | | std::slice::hack::into_vec | 3 | 67 | 201 | | <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 | | std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 | | main | 1 | 163 | 163 | | std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 | | std::boxed::Box::<T, A>::into_unique | 3 | 48 | 144 | | std::boxed::Box::<T, A>::leak | 3 | 39 | 117 | | std::alloc::Layout::array::inner | 1 | 107 | 107 | | std::ptr::align_offset::mod_inv | 1 | 103 | 103 | | std::boxed::Box::<T, A>::into_raw_with_allocator | 3 | 31 | 93 | | std::fmt::Arguments::<'a>::new_v1 | 1 | 80 | 80 | | <alloc::raw_vec::RawVec<T, A> as std::ops::Drop>::drop | 3 | 26 | 78 | | alloc::raw_vec::RawVec::<T, A>::from_raw_parts_in | 3 | 26 | 78 | | alloc::alloc::exchange_malloc | 1 | 75 | 75 | | std::ptr::const_ptr::<impl *const T>::is_null | 1 | 75 | 75 | | std::ptr::const_ptr::<impl *const T>::is_aligned_to | 1 | 64 | 64 | | compute | 3 | 20 | 60 | | std::ptr::const_ptr::<impl *const T>::align_offset | 1 | 55 | 55 | | std::ptr::read | 1 | 52 | 52 | | <std::alloc::Global as std::alloc::Allocator>::deallocate | 1 | 50 | 50 | | std::ptr::mut_ptr::<impl *mut T>::guaranteed_eq | 1 | 48 | 48 | | std::fmt::ArgumentV1::<'a>::new_display | 2 | 22 | 44 | | std::ptr::Alignment::new_unchecked | 1 | 42 | 42 | | core::fmt::num::<impl std::fmt::Debug for usize>::fmt | 1 | 40 | 40 | | std::result::Result::<T, E>::unwrap_unchecked | 1 | 37 | 37 | | std::cmp::Ord::min | 1 | 32 | 32 | | std::cmp::impls::<impl std::cmp::Ord for usize>::cmp | 1 | 31 | 31 | | std::intrinsics::is_aligned_and_not_null | 1 | 27 | 27 | | std::rt::lang_start | 1 | 27 | 27 | | std::ptr::NonNull::<T>::new | 1 | 24 | 24 | | std::fmt::ArgumentV1::<'a>::new_debug | 1 | 22 | 22 | | std::fmt::Arguments::<'a>::new_v1_formatted | 1 | 19 | 19 | | std::rt::lang_start::{closure#0} | 1 | 17 | 17 | | std::sys_common::backtrace::__rust_begin_short_backtrace | 1 | 16 | 16 | | std::slice::<impl [T]>::into_vec | 3 | 5 | 15 | | <std::ptr::NonNull<T> as std::convert::From<std::ptr::Unique<T>>>::from | 1 | 14 | 14 | | <&T as std::fmt::Debug>::fmt | 1 | 12 | 12 | | <&T as std::fmt::Display>::fmt | 1 | 12 | 12 | | std::vec::Vec::<T, A>::len | 3 | 2 | 6 | | <T as std::convert::Into<U>>::into | 1 | 5 | 5 | | <T as std::convert::From<T>>::from | 1 | 2 | 2 | | <() as std::process::Termination>::report | 1 | 2 | 2 | | std::hint::unreachable_unchecked | 1 | 2 | 2 | | core::fmt::UnsafeArg::new | 1 | 1 | 1 | </details> Since we discussed it together, r? `@wesleywiser.`
2022-12-15Auto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obkbors-32/+731
Custom MIR: Many more improvements Commits are each atomic changes, best reviewed one at a time, with the exception that the last commit includes all the documentation. ### First commit Unsafetyck was not correctly disabled before for `dialect = "built"` custom MIR. This is fixed and a regression test is added. ### Second commit Implements `Discriminant`, `SetDiscriminant`, and `SwitchInt`. ### Third commit Implements indexing, field, and variant projections. ### Fourth commit Documents the previous commits and everything else. There is some amount of weirdness here due to having to beat Rust syntax into cooperating with MIR concepts, but it hopefully should not be too much. All of it is documented. r? `@oli-obk`
2022-12-15Consider lifetimes when comparing assoc types in method chainEsteban Küber-14/+44
Do not say "Type changed to X here" when the only difference is caused by lifetimes.
2022-12-15Trim paths in E0599Esteban Küber-42/+46
2022-12-15Move `TypeckResults` to seperate moduleNilstrieb-684/+708
2022-12-15Small cleanup in parameterizedNilstrieb-22/+16
2022-12-16docs: rewrite E0158 error-code docs for clarityEzra Shaw-19/+34
2022-12-15rustdoc: remove unused CSS `.sub-settings`Michael Howell-6/+0
Obsoleted when 9625ed8be7fa66c3ee5f78180a3d5911817096f6 changed the DOM.
2022-12-15Shorten trimmed display of closuresEsteban Küber-8/+28
When `with_forced_trimmed_paths` is used, only print filename and start of the closure's span, to reduce their verbosity.
2022-12-15Use `with_forced_trimmed_paths` moreEsteban Küber-29/+34
2022-12-15Point at method chains on `E0271` errorsEsteban Küber-89/+138
2022-12-15rustdoc: simplify CSS for codeblock tooltipsMichael Howell-15/+9
Instead of making its parts `display: none` and then changing it on hover, just make the pseudo-element itself on hover.