about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-01-31Auto merge of #106399 - estebank:type-err-span-label, r=nagisabors-888/+920
Modify primary span label for E0308 Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness. Fix #68220.
2023-01-31Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errorsbors-1/+1
incremental: migrate diagnostics - Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`. - Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. - Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. r? `@compiler-errors` cc #100717
2023-01-31Rollup merge of #107479 - compiler-errors:probe-can-call-ocx, r=BoxyUwUYuki Okushi-0/+56
Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env` We can evaluate nested `ConstEvaluatable` obligations in an evaluation probe, which will ICE if we use `ObligationCtxt::new`. Fixes #107474 Fixes #106666 r? `@BoxyUwU` but feel free to reassign cc `@JulianKnodt` who i think added this assertion code Not sure if the rustdoc test is needed, but can't hurt. They're the same root cause, though.
2023-01-31Rollup merge of #107476 - notriddle:notriddle/item-decl-3, r=GuillaumeGomezYuki Okushi-273/+272
rustdoc: remove unnecessary wrapper `div.item-decl` from HTML
2023-01-31Rollup merge of #107245 - compiler-errors:new-solver-unsizing, r=lcnrYuki Okushi-0/+66
Implement unsizing in the new trait solver This makes hello world compile! Ignore the first commit, that's just #107146 which is waiting on merge. I'll leave some comments inline about design choices that might be debatable. r? `@lcnr` (until we have a new trait solver reviewer group...)
2023-01-31Auto merge of #105650 - cassaundra:float-literal-suggestion, r=pnkfelixbors-0/+50
Fix invalid float literal suggestions when recovering an integer Only suggest adding a zero to integers with a preceding dot when the change will result in a valid floating point literal. For example, `.0x0` should not be turned into `0.0x0`. r? nnethercote
2023-01-30Fix unquoted projection types in labelEsteban Küber-1/+1
2023-01-30Make structured suggestion for fn casting verboseEsteban Küber-24/+35
2023-01-30Tweak E0271 wordingEsteban Küber-12/+12
2023-01-30Mention fn coercion rules (needs to be expanded)Esteban Küber-17/+36
2023-01-30Fix invalid float literal suggestions when recovering an integerCassaundra Smith-0/+50
Only suggest adding a zero to integers with a preceding dot when the change will result in a valid floating point literal. For example, `.0x0` should not be turned into `0.0x0`.
2023-01-30Tweak use of trimmed pathsEsteban Küber-37/+40
2023-01-30Hide lifetimes of `impl Trait` in force trimmed pathsEsteban Küber-1/+1
2023-01-30Do not mention lifetime names in force trimmed pathsEsteban Küber-40/+40
2023-01-30Don't show `for<'lt>` in force trimmed pathsEsteban Küber-14/+14
2023-01-30Modify primary span label for E0308Esteban Küber-790/+789
The previous output was unintuitive to users.
2023-01-30Trait upcasting support in new solverMichael Goulet-0/+41
2023-01-30Implement unsizing in the new trait solverMichael Goulet-0/+25
2023-01-30Use ObligationCtxt::new_in_snapshot in satisfied_from_param_envMichael Goulet-0/+56
2023-01-30rustdoc: remove unnecessary wrapper div.item-decl from HTMLMichael Howell-273/+272
2023-01-30incremental: migrate diagnosticsDavid Wood-1/+1
Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30Rollup merge of #107469 - LLBlumire:master, r=jyn514Matthias Krüger-1/+1
Change turbofish context link to an archive link The original tweet in the chain linked to (via quote tweet), and thus the through line of links back to Anna's tweet where she named the turbofish (https://web.archive.org/web/20210911061514/https://twitter.com/whoisaldeka/status/914914008225816576) are lost as the user whoisaldeka has deleted their twitter account. Switching to an archive link preserves this through line, allowing someone to browse back to see the point at which Anna created the turbofish, as was the original intent of including this context. I was sharing this test with some friends as I often do, and noticed the changes (I had only seen the version from before her death previously). Looking for context myself, I realized the deleted twitter account was breaking an important link in the chain for the context of who Anna was to begin with, and the exact moment the turbofish was so named. As an alternative to using an archive, we could link to both the tweet where Anna names the turbofish, and the tweet where she refers to herself as its guardian, as two separate links - not requiring the quote tweet to connect them.
2023-01-30Rollup merge of #107172 - cjgillot:no-nal, r=nagisaMatthias Krüger-182/+121
Reimplement NormalizeArrayLen based on SsaLocals Based on https://github.com/rust-lang/rust/pull/106908 Fixes https://github.com/rust-lang/rust/issues/105929 Only the last commit "Reimplement NormalizeArrayLen" is relevant.
2023-01-30Update bastion-of-the-turbofish.rsLucille Blumire-1/+1
The original tweet in the chain linked to, and thus the through line of links back to Anna's tweet where she named the turbofish (https://web.archive.org/web/20210911061514/https://twitter.com/whoisaldeka/status/914914008225816576) are lost as the user whoisaldeka has deleted their twitter account. Switching to an archive link preserves this through line, allowing someone to browse back to see the point at which Anna created the turbofish, as was the original intent of including this context.
2023-01-30Auto merge of #107463 - Dylan-DPC:rollup-6mq1li8, r=Dylan-DPCbors-6/+7
Rollup of 6 pull requests Successful merges: - #101569 (Don't re-export private/unstable ArgumentV1 from `alloc`.) - #106106 (Pass `branch.{branch}.remote=origin` to `git submodule update`) - #107146 (Make `unsizing_params_for_adt` into a query) - #107264 (Add option to include private items in library docs) - #107452 (Fix typo in `{Rc, Arc}::get_mut_unchecked` docs) - #107459 (end entry paragraph with a period (.)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-30Rollup merge of #101569 - m-ou-se:alloc-no-rexport-argumentv1, r=thomccDylan DPC-6/+7
Don't re-export private/unstable ArgumentV1 from `alloc`. The `alloc::fmt::ArgumentV1` re-export was marked as `#[stable]` even though the original `core::fmt::ArgumentV1` is `#[unstable]` (and `#[doc(hidden)]`). (It wasn't usable though: ``` error[E0658]: use of unstable library feature 'fmt_internals': internal to format_args! --> src/main.rs:4:12 | 4 | let _: alloc::fmt::ArgumentV1 = todo!(); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(fmt_internals)]` to the crate attributes to enable ``` ) Part of #99012
2023-01-30Auto merge of #104429 - nnethercote:more-deriving-on-packed-structs, r=RalfJungbors-201/+682
More deriving on packed structs See [here](https://github.com/rust-lang/rust/pull/104429#issuecomment-1320909245) for the t-lang nomination summary, and [here](https://github.com/rust-lang/rust/pull/104429#issuecomment-1360077895) for the approval. r? `@RalfJung`
2023-01-30Allow more deriving on packed structs.Nicholas Nethercote-201/+682
Currently, deriving on packed structs has some non-trivial limitations, related to the fact that taking references on unaligned fields is UB. The current approach to field accesses in derived code: - Normal case: `&self.0` - In a packed struct that derives `Copy`: `&{self.0}` - In a packed struct that doesn't derive `Copy`: `&self.0` Plus, we disallow deriving any builtin traits other than `Default` for any packed generic type, because it's possible that there might be misaligned fields. This is a fairly broad restriction. Plus, we disallow deriving any builtin traits other than `Default` for most packed types that don't derive `Copy`. (The exceptions are those where the alignments inherently satisfy the packing, e.g. in a type with `repr(packed(N))` where all the fields have alignments of `N` or less anyway. Such types are pretty strange, because the `packed` attribute is not having any effect.) This commit introduces a new, simpler approach to field accesses: - Normal case: `&self.0` - In a packed struct: `&{self.0}` In the latter case, this requires that all fields impl `Copy`, which is a new restriction. This means that the following example compiles under the old approach and doesn't compile under the new approach. ``` #[derive(Debug)] struct NonCopy(u8); #[derive(Debug) #[repr(packed)] struct MyType(NonCopy); ``` (Note that the old approach's support for cases like this was brittle. Changing the `u8` to a `u16` would be enough to stop it working. So not much capability is lost here.) However, the other constraints from the old rules are removed. We can now derive builtin traits for packed generic structs like this: ``` trait Trait { type A; } #[derive(Hash)] #[repr(packed)] pub struct Foo<T: Trait>(T, T::A); ``` To allow this, we add a `T: Copy` bound in the derived impl and a `T::A: Copy` bound in where clauses. So `T` and `T::A` must impl `Copy`. We can now also derive builtin traits for packed structs that don't derive `Copy`, so long as the fields impl `Copy`: ``` #[derive(Hash)] #[repr(packed)] pub struct Foo(u32); ``` This includes types that hand-impl `Copy` rather than deriving it, such as the following, that show up in winapi-0.2: ``` #[derive(Clone)] #[repr(packed)] struct MyType(i32); impl Copy for MyType {} ``` The new approach is simpler to understand and implement, and it avoids the need for the `unsafe_derive_on_repr_packed` check. One exception is required for backwards-compatibility: we allow `[u8]` fields for now. There is a new lint for this, `byte_slice_in_packed_struct_with_derive`.
2023-01-29Reimplement NormalizeArrayLen.Camille GILLOT-182/+121
2023-01-29Auto merge of #107451 - matthiaskrgr:rollup-m4ucfu8, r=matthiaskrgrbors-105/+531
Rollup of 11 pull requests Successful merges: - #96763 (Fix maintainer validation message) - #106540 (Insert whitespace to avoid ident concatenation in suggestion) - #106763 (print why a test was ignored if its the only test specified) - #106769 (libtest: Print why a test was ignored if it's the only test specified.) - #106798 (Implement `signum` with `Ord`) - #107006 (Output tree representation on thir-tree) - #107078 (Update wording of invalid_doc_attributes docs.) - #107169 (Pass `--locked` to the x test tidy call) - #107431 (docs: remove colon from time header) - #107432 (rustdoc: remove unused class `has-srclink`) - #107448 (When stamp doesn't exist, should say Error, and print path to stamp file) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-29Update tests.Mara Bos-6/+7
2023-01-29Rollup merge of #107432 - notriddle:notriddle/has-srclink, r=GuillaumeGomezMatthias Krüger-91/+91
rustdoc: remove unused class `has-srclink` Stopped being used in CSS with 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0.
2023-01-29Rollup merge of #107006 - b-naber:thir-tree, r=jackh726Matthias Krüger-6/+418
Output tree representation on thir-tree The current output of `-Zunpretty=thir-tree` is really cumbersome to work with, using an actual tree representation should make it easier to see what the thir looks like.
2023-01-29Rollup merge of #106540 - lowr:patch/remove-paren-whitespace, r=cjgillotMatthias Krüger-8/+22
Insert whitespace to avoid ident concatenation in suggestion This PR tweaks the suggestion of removing misplaced parentheses around trait bounds so as to avoid concatenating two identifiers. Although subtle, this should make outputs less surprising especially when applying the `MachineApplicable` suggestions automatically.
2023-01-29Auto merge of #100178 - mati865:upgrade-mingw-w64-on-CI, r=nikicbors-4/+24
Upgrade mingw-w64 on CI Continuation of https://github.com/rust-lang/rust/pull/99162 This will require copying related archives mentioned in https://github.com/rust-lang/rust/pull/100178#issuecomment-1352060140 to Rust's mirror. This should fix multiple issues with currently used ancient releases but I'll ask folks to retest them using nightly once it goes live.
2023-01-29Auto merge of #106908 - cjgillot:copyprop-ssa, r=oli-obkbors-274/+1528
Implement simple CopyPropagation based on SSA analysis This PR extracts the "copy propagation" logic from https://github.com/rust-lang/rust/pull/106285. MIR may produce chains of assignment between locals, like `_x = move? _y`. This PR attempts to remove such chains by unifying locals. The current implementation is a bit overzealous in turning moves into copies, and in removing storage statements.
2023-01-29Insert whitespace to avoid ident concatenation in suggestionRyo Yoshida-8/+22
2023-01-29Upgrade mingw-w64 on CIMateusz Mikuła-4/+24
2023-01-29Auto merge of #106253 - nbdd0121:upcast, r=compiler-errorsbors-0/+93
Skip possible where_clause_object_safety lints when checking `multiple_supertrait_upcastable` Fix #106247 To achieve this, I lifted the `WhereClauseReferencesSelf` out from `object_safety_violations` and move it into `is_object_safe` (which is changed to a new query). cc `@dtolnay` r? `@compiler-errors`
2023-01-29Auto merge of #107435 - matthiaskrgr:rollup-if5h6yu, r=matthiaskrgrbors-0/+88
Rollup of 8 pull requests Successful merges: - #106618 (Disable `linux_ext` in wasm32 and fortanix rustdoc builds.) - #107097 (Fix def-use dominance check) - #107154 (library/std/sys_common: Define MIN_ALIGN for m68k-unknown-linux-gnu) - #107397 (Gracefully exit if --keep-stage flag is used on a clean source tree) - #107401 (remove the usize field from CandidateSource::AliasBound) - #107413 (make more pleasant to read) - #107422 (Also erase substs for new infcx in pin move error) - #107425 (Check for missing space between fat arrow and range pattern) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-29Rollup merge of #107425 - clubby789:match-range-missing-space, r=compiler-errorsMatthias Krüger-0/+27
Check for missing space between fat arrow and range pattern Fixes #107420 Ideally we wouldn't emit an error about expecting `=>` etc., but I'm not sure how to recover from this. `@rustbot` label +A-diagnostics
2023-01-29Rollup merge of #107422 - Nilstrieb:erase-the-ice, r=compiler-errorsMatthias Krüger-0/+42
Also erase substs for new infcx in pin move error The code originally correctly erased the regions of the type it passed to the newly created infcx. But after the `fn_sig` query was made to return an `EarlyBinder<T>`, some substs that were around were substituted there without erasing their regions. They were then passed into the newly cerated infcx, which caused the ICE. Fixes #107419 r? compiler-errors who reviewed the original PR adding this diagnostic
2023-01-29Rollup merge of #107097 - tmiasko:ssa, r=cjgillotMatthias Krüger-0/+19
Fix def-use dominance check A definition does not dominate a use in the same statement. For example in MIR generated for compound assignment x += a (when overflow checks are disabled).
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-11/+225
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
2023-01-28rustdoc: remove unused class `has-srclink`Michael Howell-91/+91
Stopped being used in CSS with 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0
2023-01-28Auto merge of #103659 - clubby789:improve-partialord-derive, r=nagisabors-28/+23
Special-case deriving `PartialOrd` for enums with dataless variants I was able to get slightly better codegen by flipping the derived `PartialOrd` logic for two-variant enums. I also tried to document the implementation of the derive macro to make the special-case logic a little clearer. ```rs #[derive(PartialEq, PartialOrd)] pub enum A<T> { A, B(T) } ``` ```diff impl<T: ::core::cmp::PartialOrd> ::core::cmp::PartialOrd for A<T> { #[inline] fn partial_cmp( &self, other: &A<T>, ) -> ::core::option::Option<::core::cmp::Ordering> { let __self_tag = ::core::intrinsics::discriminant_value(self); let __arg1_tag = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match (self, other) { - (A::B(__self_0), A::B(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::option::Option::Some(::core::cmp::Ordering::Equal), - } + match (self, other) { + (A::B(__self_0), A::B(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) } - cmp => cmp, + _ => ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag), } } } ``` Godbolt: [Current](https://godbolt.org/z/GYjEzG1T8), [New](https://godbolt.org/z/GoK78qx15) I'm not sure how common a case comparing two enums like this (such as `Option`) is, and if it's worth the slowdown of adding a special case to the derive. If it causes overall regressions it might be worth just manually implementing this for `Option`.
2023-01-28Check for missing space between fat arrow and range patternclubby789-0/+27
2023-01-28Also erase substs for new infcx in pin move errorNilstrieb-0/+42
The code originally correctly erased the regions of the type it passed to the newly created infcx. But after the `fn_sig` query was made to return an `EarlyBinder<T>`, some substs that were around were substituted there without erasing their regions. They were then passed into the newly cerated infcx, which caused the ICE.
2023-01-28Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkinbors-1/+3
Remove HirId -> LocalDefId map from HIR. Having this map in HIR prevents the creating of new definitions after HIR has been built. Thankfully, we do not need it. Based on https://github.com/rust-lang/rust/pull/103902
2023-01-28Reintroduce multiple_supertrait_upcastable lintGary Guo-0/+93