about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-10-06Rollup merge of #116458 - bjorn3:fix_global_asm_test, r=workingjubileeJubilee-1/+8
Properly export function defined in test which uses global_asm!() Currently the test passes with the LLVM backend as the codegen unit partitioning logic happens to place both the global_asm!() and the function which calls the function defined by the global_asm!() in the same CGU. With the Cranelift backend it breaks however as it will place all assembly in separate codegen units to be passed to an external linker.
2023-10-06Rollup merge of #116400 - estebank:issue-78585, r=WaffleLapkinJubilee-22/+136
Detect missing `=>` after match guard during parsing ``` error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/missing-fat-arrow.rs:25:14 | LL | Some(a) if a.value == b { | - while parsing this struct LL | a.value = 1; | -^ expected one of `,`, `:`, or `}` | | | while parsing this struct field | help: try naming a field | LL | a: a.value = 1; | ++ help: you might have meant to start a match arm after the match guard | LL | Some(a) if a.value == b => { | ++ ``` Fix #78585.
2023-10-06Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiserbors-314/+349
Show more information when multiple `impl`s apply - When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s). ``` error[E0283]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); | ^ ---- type must be known at this point | note: multiple `impl`s satisfying `_: From<Baz>` found --> $DIR/multiple-impl-apply.rs:14:1 | LL | impl From<Baz> for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl From<Baz> for Foo { | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); | ++++++++++++ ``` - Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user. - Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases. ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/cross-return-site-inference.rs:38:16 | LL | return Err(From::from("foo")); | ^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation | LL | return Err(</* self type */ as From>::from("foo")); | +++++++++++++++++++ + ``` Fix #88284.
2023-10-06Fix windows test that has different stderr outputEsteban Küber-8/+10
2023-10-06Auto merge of #115304 - Enselic:trailing-gt, r=cjgillotbors-0/+24
Allow file names to end with '>' The [`rustc_span::FileName`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_span/enum.FileName.html) enum already differentiates between real files and "fake" files such as `<anon>`. We do not need to artificially forbid real file names from ending in `>`. Closes #73419
2023-10-06Rollup merge of #116475 - notriddle:notriddle/impl-trait-null, r=GuillaumeGomezGuillaume Gomez-5/+20
rustdoc-search: fix bug with multi-item impl trait Preview searches: - https://notriddle.com/rustdoc-html-demo-5/compiler-doc-impl-trait-bugfix/index.html?search=-%3E%20globalctxt - https://notriddle.com/rustdoc-html-demo-5/compiler-doc-impl-trait-bugfix/index.html?search=globalctxt
2023-10-06Rollup merge of #116329 - RalfJung:swap-comments, r=scottmcmGuillaume Gomez-1/+2
update some comments around swap() Based on ``@eddyb's`` comment [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/461#issuecomment-1742156410). And then I noticed the wrong capitalization for Miri and fixed it in some other places as well.
2023-10-06Use pushsection/popsectionbjorn3-2/+2
2023-10-06Auto merge of #116018 - DianQK:simd-wide-sum-test, r=scottmcmbors-13/+13
Increasing the SIMD size improves the vectorization possibilities Change the `simd-wide-sum.rs` to pass tests based on the LLVM main branch. For smaller lengths, we cannot expect to always get vectorized. A related discussion at https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVM.20HEAD.3A.20codegen.2Fsimd.2Fsimd-wide-sum.2Ers.20newly.20failing. r? scottmcm
2023-10-06Add a wishlist FIXMEscottmcm-0/+2
2023-10-05rustdoc-search: fix bug with multi-item impl traitMichael Howell-5/+20
2023-10-06Rollup merge of #116421 - Urgau:inter-mut-invalid_ref_casting, r=oli-obkMatthias Krüger-21/+47
Clarify `invalid_reference_casting` lint around interior mutable types This is PR intends to clarify the `invalid_reference_casting` lint around interior mutable types by adding a note for them saying that they should go through `UnsafeCell::get`. So for this code: ```rust let cell = &std::cell::UnsafeCell::new(0); let _num = &mut *(cell as *const _ as *mut i32); ``` the following note will be added to the lint output: ```diff error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell` --> $DIR/reference_casting.rs:68:16 | LL | let _num = &mut *(cell as *const _ as *mut i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html> + = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get` ``` Suggestion are welcome around the note contents. Fixes https://github.com/rust-lang/rust/issues/116410 cc `@RalfJung`
2023-10-05Properly export function defined in test which uses global_asm!()bjorn3-1/+8
Currently the test passes with the LLVM backend as the codegen unit partitioning logic happens to place both the global_asm!() and the function which calls the function defined by the global_asm!() in the same CGU. With the Cranelift backend it breaks however as it will place all assembly in separate codegen units to be passed to an external linker.
2023-10-05Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errorsbors-0/+21
Remove is global hack In attempt to fix https://github.com/rust-lang/rust/issues/114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed. In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs This is a fix candidate opened for performance run. r? `@lcnr`
2023-10-05remove is global hackOğuz Ağcayazı-0/+21
2023-10-05Allow file names to end with '>'Martin Nordholts-0/+24
The `rustc_span::FileName` enum already differentiates between real files and "fake" files such as `<anon>`. We do not need to artificially forbid real file names from ending in `>`.
2023-10-05Rollup merge of #116428 - Alexendoo:note-duplicate-diagnostics, ↵Matthias Krüger-200/+452
r=compiler-errors,estebank Add a note to duplicate diagnostics Helps explain why there may be a difference between manual testing and the test suite output and highlights them as something to potentially look into For existing duplicate diagnostics I just blessed them other than a few files that had other `NOTE` annotations in
2023-10-05Rollup merge of #116415 - ouz-a:move_subtyper, r=oli-obkMatthias Krüger-52/+134
Move subtyper below reveal_all and change reveal_all In previous attempt https://github.com/rust-lang/rust/pull/116378 we tried to handle `Opaque` in few different places, but this isn't necessary, after moving subtyper below reveal_all and calling `super_place` on reveal_all, issues cease to exist. r? ``@oli-obk`` Fixes https://github.com/rust-lang/rust/issues/116332 Fixes https://github.com/rust-lang/rust/issues/116265 Fixes https://github.com/rust-lang/rust/issues/116383 Fixes https://github.com/rust-lang/rust/issues/116333
2023-10-05Rollup merge of #116288 - ouz-a:smir_spans, r=spastorinoMatthias Krüger-20/+20
Add Span to various smir types Had to make few extra changes to few structs to attach spans to them. r? ``@oli-obk``
2023-10-05move subtyper change reveal_allouz-a-52/+134
2023-10-05Auto merge of #116427 - cjgillot:no-internal, r=oli-obkbors-0/+92
Remove mir::LocalDecl::internal. It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
2023-10-05add span to statementsouz-a-20/+20
2023-10-05Rollup merge of #116432 - notriddle:master, r=fmeaseJubilee-8/+68
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 2) Follow up https://github.com/rust-lang/rust/pull/116214
2023-10-05Rollup merge of #116431 - estebank:issue-80476, r=compiler-errorsJubilee-135/+135
Tweak wording of E0562 Fix #80476.
2023-10-05Rollup merge of #116429 - fmease:clean-up-struct-field-suggs, r=compiler-errorsJubilee-43/+168
Diagnostics: Be more careful when suggesting struct fields Consolidate the various places which filter out struct fields that shouldn't be suggested into a single function. Previously, each of those code paths had slightly different and incomplete metrics for no good reason. Now, there's only a single 'complete' metric (namely `is_field_suggestable`) which also filters out hygienic fields that come from different syntax contexts. Fixes #116334.
2023-10-05Rollup merge of #116296 - compiler-errors:default-return, r=estebankJubilee-42/+59
More accurately point to where default return type should go When getting the "default return type" span, instead of pointing to the low span of the next token, point to the high span of the previous token. This: 1. Makes forming return type suggestions more uniform, since we expect them all in the same place. 2. Arguably makes labels easier to understand, since we're pointing to where the implicit `-> ()` would've gone, rather than the starting brace or the semicolon. r? ```@estebank```
2023-10-05Rollup merge of #116223 - catandcoder:master, r=cjgillotJubilee-3/+3
Fix misuses of a vs an Fixes the misuse of "a" vs "an", according to English grammatical expectations and using https://www.a-or-an.com/
2023-10-05Auto merge of #116273 - compiler-errors:refine2, r=tmandrybors-6/+17
Only trigger `refining_impl_trait` lint on reachable traits Public but unreachable traits don't matter 😸 r? `@tmandry`
2023-10-05Auto merge of #116184 - compiler-errors:afit-lint, r=tmandrybors-7/+83
Add `async_fn_in_trait` lint cc https://github.com/rust-lang/rust/pull/115822#issuecomment-1731168465 Mostly unsure what the messaging should be. Feedback required. r? `@tmandry`
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-200/+452
2023-10-04Point to where missing return type should goMichael Goulet-42/+59
2023-10-04Auto merge of #114417 - ↵bors-0/+30
chinedufn:fix-expect-unused-in-impl-block-rust-issue-114416, r=cjgillot Fix multiple `expect` attribs in impl block Closes #114416
2023-10-04Clarify `invalid_reference_casting` lint around interior mutable typesUrgau-21/+47
2023-10-04Add URL to test case issuesMichael Howell-1/+21
2023-10-04Rename issue-\d+.rs tests to have meaningful namesMichael Howell-1/+1
2023-10-04Tweak wording of E0562Esteban Küber-135/+135
Fix #80476.
2023-10-04clean up struct field suggestionsLeón Orell Valerian Liehr-43/+168
2023-10-04 Add `crate_name` to test so that it can be renamedMichael Howell-1/+41
2023-10-04Fix test on WASM target by making ambiguity pruning more agressiveEsteban Küber-2/+0
2023-10-04Remove mir::LocalDecl::internal.Camille GILLOT-0/+92
2023-10-04Auto merge of #116413 - nnethercote:rm-E0551, r=compiler-errorsbors-5/+5
Remove E0551 Because it's the same as E0539. Fixes #51489. r? `@Nilstrieb`
2023-10-04Auto merge of #116360 - compiler-errors:async-span, r=oli-obkbors-43/+43
Point to full `async fn` for future Semi-follow-up to https://github.com/rust-lang/rust/pull/116296#discussion_r1342007575 cc `@asquared31415`
2023-10-04Remove E0551.Nicholas Nethercote-5/+5
Because it's the same as E0539. Fixes #51489.
2023-10-04Rollup merge of #116393 - compiler-errors:auto-bad, r=WaffleLapkinMatthias Krüger-0/+22
Emit feature gate *warning* for `auto` traits pre-expansion Auto traits were introduced before we were more careful about not stabilizing new syntax pre-expansion. This is a more conservative step in the general direction we want to go in https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Removal.20of.20.60auto.20trait.60.20syntax. Fixes #116121
2023-10-04Rollup merge of #116388 - ↵Matthias Krüger-2/+38
fmease:rustdoc-fix-n-clean-up-x-crate-higher-ranked-params, r=notriddle rustdoc: fix & clean up handling of cross-crate higher-ranked parameters Preparatory work for the refactoring planned in #113015 (for correctness & maintainability). --- 1. Render the higher-ranked parameters of cross-crate function pointer types **(*)**. 2. Replace occurrences of `collect_referenced_late_bound_regions()` (CRLBR) with `bound_vars()`. The former is quite problematic and the use of the latter allows us to yank a lot of hacky code **(†)** as you can tell from the diff! :) 3. Add support for cross-crate higher-ranked types (`#![feature(non_lifetime_binders)]`). We were previously ICE'ing on them (see `inline_cross/non_lifetime_binders.rs`). --- **(*)**: Extracted from test `inline_cross/fn-type.rs`: ```diff - fn(_: &'z fn(_: &'b str), _: &'a ()) -> &'a () + for<'z, 'a, '_unused> fn(_: &'z for<'b> fn(_: &'b str), _: &'a ()) -> &'a () ``` **(†)**: It returns an `FxHashSet` which isn't *predictable* or *stable* wrt. source code (`.rmeta`) changes. To elaborate, the ordering of late-bound regions doesn't necessarily reflect the ordering found in the source code. It does seem to be stable across compilations but modifying the source code of the to-be-documented crates (like adding or renaming items) may result in a different order: <details><summary>Example</summary> Let's assume that we're documenting the cross-crate re-export of `produce` from the code below. On `master`, rustdoc would render the list of binders as `for<'x, 'y, 'z>`. However, once you add back the functions `a`–`l`, it would be rendered as `for<'z, 'y, 'x>` (reverse order)! Results may vary. `bound_vars()` fixes this as it returns them in source order. ```rs // pub fn a() {} // pub fn b() {} // pub fn c() {} // pub fn d() {} // pub fn e() {} // pub fn f() {} // pub fn g() {} // pub fn h() {} // pub fn i() {} // pub fn j() {} // pub fn k() {} // pub fn l() {} pub fn produce() -> impl for<'x, 'y, 'z> Trait<'z, 'y, 'x> {} pub trait Trait<'a, 'b, 'c> {} impl Trait<'_, '_, '_> for () {} ``` </details> Further, as the name suggests, CRLBR only collects *referenced* regions and thus we drop unused binders. `bound_vars()` contains unused binders on the other hand. Let's stay closer to the source where possible and keep unused binders. Lastly, using `bound_vars()` allows us to get rid of * the deduplication and alphabetical sorting hack in `simplify.rs` * the weird field `bound_params` on `EqPredicate` both of which were introduced by me in #102707 back when I didn't know better. To illustrate, let's look at the cross-crate bound `T: for<'a, 'b> Trait<A<'a> = (), B<'b> = ()>`. * With CRLBR + `EqPredicate.bound_params`, *before* bounds simplification we would have the bounds `T: Trait`, `for<'a> <T as Trait>::A<'a> == ()` and `for<'b> <T as Trait>::B<'b> == ()` which required us to merge `for<>`, `for<'a>` and `for<'b>` into `for<'a, 'b>` in a deterministic manner and without introducing duplicate binders. * With `bound_vars()`, we now have the bounds `for<'a, b> T: Trait`, `<T as Trait>::A<'a> == ()` and `<T as Trait>::B<'b> == ()` before bound simplification similar to rustc itself. This obviously no longer requires any funny merging of `for<>`s. On top of that `for<'a, 'b>` is guaranteed to be in source order.
2023-10-04Show suggestion for `<SelfTy as Trait>::assoc_fn` in more cases and fmt codeEsteban Küber-0/+10
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-376/+266
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
2023-10-04Show more information when multiple `impl` applyEsteban Küber-4/+139
2023-10-04review commentsEsteban Küber-9/+6
2023-10-04Fix misuses of a vs ancui fliter-3/+3
Signed-off-by: cui fliter <imcusg@gmail.com>