about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-12-17Ensure param-env is const before calling eval_to_valtreeMichael Goulet-0/+47
2022-12-17Account for RPITITs in opt_suggest_box_spanMichael Goulet-0/+60
2022-12-17print argument name in arg mismatch if possibleMichael Goulet-7/+7
2022-12-17Suggest a `T: Send` bound for `&mut T` upvars in `Send` generatorsMatthew House-0/+81
2022-12-17Don't ICE in check_must_not_suspend_ty for mismatched tuple arityMichael Goulet-0/+21
2022-12-17Try to fix ICEmejrs-11/+11
2022-12-17./x.py test --blessTomasz Miąsko-8/+6
2022-12-17Rename CleanupNonCodegenStatements to CleanupPostBorrowckTomasz Miąsko-1/+1
2022-12-17Auto merge of #105800 - lqd:dylib-thinlto, r=bjorn3bors-0/+52
Don't copy symbols from dylibs with `-Zdylib-lto` When `rustc_driver` started being built with `-Zdylib-lto -Clto=thin`, some libstd symbols were copied by the LTO process into the dylib. That causes duplicate local symbols that are not present otherwise. Depending on the situation (lib loading order apparently), the duplicated symbols could cause issues: `rustc_driver` overrode the panic hook, but it didn't apply to rustc main's hook (the default from libstd). This is the cause of #105637, in some situations the panic hook installed by `rustc_driver` isn't executed, and only libstd's backtrace is shown (and a double panic). The query stack, as well as the various notes to open a GH about the ICE, don't appear. It's not clear exactly what is needed to trigger the issue, but I have simulated a reproducer [here](https://github.com/lqd/issue-105637) with cargo involved, the incorrect panic hook is executed on my machine. It is hard to reproduce in a unit test: `cargo run` + `rustup` involves LD_LIBRARY_PATH, which is not the case for `compiletest`. cargo also adds unconditional flags that are then overridden in [`bootstrap` when building rustc with `rust.lto = thin`](https://github.com/rust-lang/rust/blob/9c07efe84f28a44f3044237696acc295aa407ee5/src/bootstrap/compile.rs#L702-L714) as done on CI). All this to say the compilation and execution environment in `bootstrap` leading to the bug building `rustc_driver` is different from our UI tests, and I believe one of the reasons it's hard to make an exact reproducer test. Thankfully there's _still_ a difference in the behavior though: although in the unit test the correct panic hook seems to be executed compared to my repro and the current nightly, only the fix removes the double panic here. The `7e8277aefa12f1469fb1df01418ff5846a7854a9` `try` build: - fixes the reproducer repo linked above - restores the ICE messages from https://github.com/rust-lang/rust/issues/105321 back to the state in its OP compared to the description in https://github.com/rust-lang/rust/issues/105637 - restores the ICE message and the query stack from https://github.com/rust-lang/rust/issues/105777 compared to nightly While I believe this technically fixes the P-critical issue https://github.com/rust-lang/rust/issues/105637, I would not want to close it yet as we may want to backport to beta/stable (if a point release happens, it would fix the ICEs reported on 1.66.0, which is built with ThinLTO on linux). Once this PR lands, I'll also open another PR to re-enable ThinLTO on x64 darwin's dist builder.
2022-12-17Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisabors-2/+2
Check AArch64 branch-protection earlier in the pipeline. As suggested in #93516. r? `@nagisa`
2022-12-17Rollup merge of #105785 - JohnTitor:issue-55976-2, r=compiler-errorsMatthias Krüger-0/+13
Add regression test for #55976 Closes #55976 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-16Support call and drop terminators in custom mirJakob Degen-0/+180
2022-12-17Auto merge of #105811 - ojeda:Dwarnings-no_fp_fmt_parse, r=Mark-Simulacrumbors-1/+1
core: ensure `no_fp_fmt_parse` builds are warning-free Rust recently introduced a new `unused_imports` warning in `no_fp_fmt_parse` builds, which was fixed in https://github.com/rust-lang/rust/pull/105434. To avoid accumulating more over time, let's keep the builds warning-free. This ensures projects compiling `core` with this custom config do not see the warnings in the future and that they can keep enabling `-Dwarnings`. Similarly, https://github.com/rust-lang/rust/pull/98652 did it for `alloc`'s `no_global_oom_handling`.
2022-12-17Auto merge of #105804 - matthiaskrgr:rollup-iaqlbl3, r=matthiaskrgrbors-4/+124
Rollup of 6 pull requests Successful merges: - #105493 (Help rust-analyzer normalize query return types) - #105710 (Don't bug if we're trying to cast `dyn*` to another type) - #105711 (bail in `collect_trait_impl_trait_tys` if signatures reference errors) - #105768 (Detect inherent associated types not having CamelCase) - #105780 (rustdoc: Don't add "Read more" link if there is no extra content) - #105802 (Make enum-match.rs test robust against variable name changes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-17Rollup merge of #105802 - chbaker0:enum-match-filecheck, r=tmiaskoMatthias Krüger-2/+2
Make enum-match.rs test robust against variable name changes https://reviews.llvm.org/D140192 caused the LLVM variable generated for enum discriminant checks to be named differently (%narrow vs %1). This adjusts the test CHECK directives to match any name.
2022-12-17Rollup merge of #105780 - GuillaumeGomez:read-more-links, r=notriddleMatthias Krüger-2/+34
rustdoc: Don't add "Read more" link if there is no extra content Fixes #105677.
2022-12-17Rollup merge of #105768 - fee1-dead-contrib:iat-style, r=eholkMatthias Krüger-0/+26
Detect inherent associated types not having CamelCase Fixes #105341.
2022-12-17Rollup merge of #105711 - compiler-errors:rpitit-references-errors, r=eholkMatthias Krüger-0/+42
bail in `collect_trait_impl_trait_tys` if signatures reference errors Fixes #105290
2022-12-17Rollup merge of #105710 - compiler-errors:dyn-star-rigid-cast, r=eholkMatthias Krüger-0/+20
Don't bug if we're trying to cast `dyn*` to another type Fixes #105097
2022-12-17core: ensure `no_fp_fmt_parse` builds are warning-freeMiguel Ojeda-1/+1
Rust recently introduced a new `unused_imports` warning in `no_fp_fmt_parse` builds, which was fixed in https://github.com/rust-lang/rust/pull/105434. To avoid accumulating more over time, let's keep the builds warning-free. This ensures projects compiling `core` with this custom config do not see the warnings in the future and that they can keep enabling `-Dwarnings`. Similarly, https://github.com/rust-lang/rust/pull/98652 did it for `alloc`'s `no_global_oom_handling`. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-12-16Make enum-match.rs test robust against variable name changesCollin Baker-2/+2
https://reviews.llvm.org/D140192 caused the LLVM variable generated for enum discriminant checks to be named differently (%narrow vs %1). This adjusts the test CHECK directives to match any name.
2022-12-16Auto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obkbors-101/+34
Stabilize default_alloc_error_handler Tracking issue: #66741 This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided. The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked. Closes #66741
2022-12-16add simulated non-regression test for issue 105637Rémy Rakic-0/+52
2022-12-17docs: add long error explanation for error E0320Ezra Shaw-0/+4
2022-12-16Auto merge of #105775 - matthiaskrgr:rollup-2o8qn7e, r=matthiaskrgrbors-96/+127
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-16Detect inherent associated types not having CamelCaseDeadbeef-0/+26
Fixes #105341.
2022-12-16Add test for presence of read more linksGuillaume Gomez-2/+34
2022-12-16Little fixesDeep Majumder-1/+1
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-26/+26
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 #105756 - notriddle:notriddle/example-wrap-tooltip, ↵Matthias Krüger-3/+3
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 #105747 - chenyukang:yukang/fix-105732-auto-trait, ↵Matthias Krüger-0/+41
r=compiler-errors Fix ICE calling method on auto trait Fixes #105732 r? `@compiler-errors`
2022-12-16Rollup merge of #105725 - fee1-dead-contrib:allow-impl-const-trait, r=oli-obkMatthias Krüger-51/+57
Allow `impl ~const Trait` opaque types
2022-12-16Auto merge of #103880 - b-naber:field-ty-mir, r=lcnrbors-0/+76
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-16Auto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebankbors-6/+69
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-16Remove dead code after destination propagationTomasz Miąsko-0/+104
2022-12-15rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`Michael Howell-26/+26
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-80/+272
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-16fix #105732, Fix ICE calling method on auto traityukang-0/+41
2022-12-15Rollup merge of #105727 - estebank:use-impl-trait, r=oli-obkMatthias Krüger-15/+65
Tweak output for bare `dyn Trait` in arguments Fix #35825.
2022-12-15Rollup merge of #105694 - ouz-a:issue_105689, r=estebankMatthias Krüger-0/+14
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-0/+78
Suggest constraining type parameter with `Clone` Fix #34896.
2022-12-15Rollup merge of #105674 - estebank:iterator-chains, r=oli-obkMatthias Krüger-65/+114
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-0/+1
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-0/+376
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-13/+43
Do not say "Type changed to X here" when the only difference is caused by lifetimes.
2022-12-15Trim paths in E0599Esteban Küber-37/+37
2022-12-15Shorten trimmed display of closuresEsteban Küber-3/+3
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-13/+13