about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-04-23Auto merge of #95971 - workingjubilee:no-weird-fp-in-const, r=oli-obkbors-30/+181
No "weird" floats in const fn {from,to}_bits I suspect this code is subtly incorrect and that we don't even e.g. use x87-style floats in CTFE, so I don't have to guard against that case. A future PR will be hopefully removing them from concern entirely, anyways. But at the moment I wanted to get this rolling because small questions like that one seem best answered by review. r? `@oli-obk` cc `@eddyb` `@thomcc`
2022-04-23Add a couple tests for #90887 fixesAli MJ Al-Nasrawy-0/+48
2022-04-22Rollup merge of #96273 - TaKO8Ki:make-E0117-error-clear, r=davidtwcoMatthias Krüger-28/+28
Make `E0117` error clear closes #96227
2022-04-22Rollup merge of #96272 - tmiasko:validate-uninhabited, r=RalfJungMatthias Krüger-34/+55
Update `validate_uninhabited_zsts.rs` test after MIR building changes to ensure that it still tests validation, instead of failing earlier on during evaluation. r? `@RalfJung`
2022-04-22Auto merge of #96197 - erikdesjardins:scalarpairenum, r=oli-obkbors-0/+774
Mark payload fields of ScalarPair enums as Scalar::Union when they're not always initialized Fixes #96158 r? `@RalfJung`
2022-04-22normalize out pref_align (copied from another test)Erik Desjardins-56/+23
2022-04-22Auto merge of #96144 - c410-f3r:z-errors, r=petrochenkovbors-0/+0
Move some tests to more reasonable places cc #73494 r? `@petrochenkov`
2022-04-21Update `validate_uninhabited_zsts.rs` test after MIR building changesTomasz Miąsko-34/+55
to ensure that it still tests validation, instead of failing earlier on during evaluation.
2022-04-21Move some tests to more reasonable directoriesCaio-0/+0
2022-04-21make `E0117` error clearTakayuki Maeda-28/+28
2022-04-20Remove mutable_borrow_reservation_conflict lintJack Huey-276/+76
2022-04-21Rollup merge of #96236 - Aaron1011:constraint-debug, r=jackh726Dylan DPC-45/+17
Add an explicit `Span` field to `OutlivesConstraint` Previously, we would retrieve the span from the `Body` using the `locations` field. However, we may end up changing the `locations` field when moving a constraint from a promoted to a different body. We now store the original `Span` in a dedication field, so that changes to the `locations` do not affect the quality of our diagnostics.
2022-04-20Rollup merge of #93313 - tmiasko:uninhabited, r=tmandryDylan DPC-66/+128
Check if call return type is visibly uninhabited when building MIR The main motivation behind the change is to expose information about diverging calls to the generator transform and match the precision of drop range tracking which already understands that call expressions with visibly uninhabited types diverges. This change should also accept strictly more programs than before. That is programs that were previously rejected due to errors raised by control-flow sensitive checks in a code that is no longer considered reachable. Fixes #93161.
2022-04-19Add an explicit `Span` field to `OutlivesConstraint`Aaron Hill-45/+17
Previously, we would retrieve the span from the `Body` using the `locations` field. However, we may end up changing the `locations` field when moving a constraint from a promoted to a different body. We now store the original `Span` in a dedication field, so that changes to the `locations` do not affect the quality of our diagnostics.
2022-04-19Update line numbers in the expected output.Dan Gohman-2/+2
2022-04-19Add ignore-windows to a test.Dan Gohman-0/+1
This test has an expected stderr containing text like this: ``` help: the following other types implement trait `std::error::Error`: ... and 43 others ``` However, the number 43 is platform-specific; on Windows, there are two additional types, `InvalidHandleError` and `NullHandleError`, and the number of 45. So for now, disable this test on Windows.
2022-04-19Rollup merge of #95740 - Amanieu:kreg0, r=nagisaDylan DPC-10/+10
asm: Add a kreg0 register class on x86 which includes k0 Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19asm: Add a kreg0 register class on x86 which includes k0Amanieu d'Antras-10/+10
Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19Rollup merge of #96122 - ↵Dylan DPC-0/+50
TaKO8Ki:fix-invalid-error-for-suggestion-to-add-slice-in-pattern-matching, r=nagisa Fix an invalid error for a suggestion to add a slice in pattern-matching closes #96103
2022-04-19Rollup merge of #96086 - jsgf:remove-extern-location, r=davidtwcoDylan DPC-186/+0
Remove `--extern-location` and all associated code `--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-19Rollup merge of #94493 - ↵Dylan DPC-3/+15
oribenshir:feature/ISSUE-78543_async_fn_in_foreign_crate_diag_2, r=davidtwco Improved diagnostic on failure to meet send bound on future in a foreign crate Provide a better diagnostic on failure to meet send bound on futures in a foreign crate. fixes #78543
2022-04-19Auto merge of #95379 - icewind1991:suggest-associated-type-more, r=jackh726bors-10/+33
show suggestion to replace generic bounds with associated types in more cases Moves the hint to replace generic parameters with associated type bounds from the "not all associated type bounds are specified"(`E0191`) to "to many generic type parameters provided"(`E0107`). Since `E0191` is only emitted in places where all associated types must be specified (when creating `dyn` types), the suggesting is currently not shown for other generic type uses (such as in generic type bounds). With this change the suggesting is always emitted when the number of excess generic parameters matches the number of unbound associated types. Main motivation for the change was a lack of useful suggesting when doing ```rust fn foo<I: Iterator<usize>>(i: I) {} ```
2022-04-18mark payload fields of ScalarPair enums as Scalar::Union when they're not ↵Erik Desjardins-0/+807
always initialized
2022-04-18Update the expected stderr for coerce-issue-49593-box-never.Dan Gohman-2/+2
2022-04-18Update the expected stderr for coerce-issue-49593-box-never.Dan Gohman-2/+2
This test's expected stderr now includes a count of the number of types that implment `Error`. This PR introduces two new types, so increment the number by two.
2022-04-18Rollup merge of #96148 - marmeladema:nll-revisions-self, r=jackh726Dylan DPC-192/+360
Use revisions instead of nll compare mode for `/self/` ui tests r? ``@jackh726``
2022-04-18implement `Deref` for `Bar`Takayuki Maeda-2/+30
2022-04-17Use revisions instead of nll compare mode for `/self/` ui testsmarmeladema-192/+360
2022-04-17Auto merge of #95779 - cjgillot:ast-lifetimes-undeclared, r=petrochenkovbors-172/+673
Report undeclared lifetimes during late resolution. First step in https://github.com/rust-lang/rust/pull/91557 We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes. r? `@petrochenkov`
2022-04-17Bless nll test.Camille GILLOT-0/+106
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-14/+40
2022-04-17Bless tests.Camille GILLOT-158/+527
2022-04-17Auto merge of #96010 - eduardosm:Unique-on-top-of-NonNull, r=m-ou-se,tmiaskobors-17/+7
Implement `core::ptr::Unique` on top of `NonNull` Removes the use `rustc_layout_scalar_valid_range_start` and some `unsafe` blocks.
2022-04-17show suggestion to replace generic bounds with associated types in more casesRobin Appelman-10/+33
2022-04-17Rollup merge of #96112 - niluxv:strict-provenance-lint-improvements, r=nagisaDylan DPC-4/+39
Strict provenance lint diagnostics improvements Use `multipart_suggestion` instead of `span_suggestion` and getting a snippet for the expression. Also don't suggest unnecessary parenthesis in `lossy_provenance_casts`. cc ``@estebank`` ``@rustbot`` label A-diagnostics
2022-04-17Rollup merge of #95346 - Aaron1011:stablize-const-extern-fn, r=pnkfelixDylan DPC-52/+19
Stablize `const_extern_fn` for "Rust" and "C" All other ABIs are left unstable for now. cc #64926
2022-04-16Rollup merge of #95006 - tmiasko:thread-local-static, r=wesleywiserDylan DPC-0/+68
Reject `#[thread_local]` attribute on non-static items
2022-04-17fix an invalid error for a suggestion to add a slice in pattern-matchingTakayuki Maeda-0/+22
2022-04-16Rollup merge of #95887 - petrochenkov:doclink5, r=cjgillotDylan DPC-15/+3
resolve: Create dummy bindings for all unresolved imports Apparently such bindings weren't previously created for all unresolved imports, causing issues like https://github.com/rust-lang/rust/issues/95879. In this PR I'm trying to create such dummy bindings in a more centralized way by calling `import_dummy_binding` once for all imports in `finalize_imports`. Fixes https://github.com/rust-lang/rust/issues/95879.
2022-04-16Provide a better diagnostic on failure to meet send bound on futures in a ↵oribenshir-3/+15
foreign crate Adding diagnostic data on generators to the crate metadata and using it to provide a better diagnostic on failure to meet send bound on futures originated from a foreign crate
2022-04-16Auto merge of #96108 - Dylan-DPC:rollup-t5f2fc9, r=Dylan-DPCbors-37/+523
Rollup of 9 pull requests Successful merges: - #93969 (Only add codegen backend to dep info if -Zbinary-dep-depinfo is used) - #94605 (Add missing links in platform support docs) - #95372 (make unaligned_references lint deny-by-default) - #95859 (Improve diagnostics for unterminated nested block comment) - #95961 (implement SIMD gather/scatter via vector getelementptr) - #96004 (Consider lifetimes when comparing types for equality in MIR validator) - #96050 (Remove some now-dead code that was only relevant before deaggregation.) - #96070 ([test] Add test cases for untested functions for BTreeMap) - #96099 (MaybeUninit array cleanup) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-16Improve `fuzzy_provenance_casts` lint diagnosticsniluxv-1/+1
Use `multipart_suggestion` instead of getting a snippet.
2022-04-16Improve `lossy_provenance_casts` lint diagnosticsniluxv-3/+38
Use `multipart_suggestion` and don't suggested unnecessary parenthesis.
2022-04-16Auto merge of #92364 - jackh726:Quantumplation/65853/param-heuristics, ↵bors-2855/+9319
r=estebank Better method call error messages Rebase/continuation of #71827 ~Based on #92360~ ~Based on #93118~ There's a decent description in #71827 that I won't copy here (for now at least) In addition to rebasing, I've tried to restore most of the original suggestions for invalid arguments. Unfortunately, this does make some of the errors a bit verbose. To fix this will require a bit of refactoring to some of the generalized error suggestion functions, and I just don't have the time to go into it right now. I think this is in a state that the error messages are overall better than before without a reduction in the suggestions given. ~I've tried to split out some of the easier and self-contained changes into separate commits (mostly in #92360, but also one here). There might be more than can be done here, but again just lacking time.~ r? `@estebank` as the original reviewer of #71827
2022-04-16Implementation for 65853Jack Huey-2855/+9319
This attempts to bring better error messages to invalid method calls, by applying some heuristics to identify common mistakes. The algorithm is inspired by Levenshtein distance and longest common sub-sequence. In essence, we treat the types of the function, and the types of the arguments you provided as two "words" and compute the edits to get from one to the other. We then modify that algorithm to detect 4 cases: - A function input is missing - An extra argument was provided - The type of an argument is straight up invalid - Two arguments have been swapped - A subset of the arguments have been shuffled (We detect the last two as separate cases so that we can detect two swaps, instead of 4 parameters permuted.) It helps to understand this argument by paying special attention to terminology: "inputs" refers to the inputs being *expected* by the function, and "arguments" refers to what has been provided at the call site. The basic sketch of the algorithm is as follows: - Construct a boolean grid, with a row for each argument, and a column for each input. The cell [i, j] is true if the i'th argument could satisfy the j'th input. - If we find an argument that could satisfy no inputs, provided for an input that can't be satisfied by any other argument, we consider this an "invalid type". - Extra arguments are those that can't satisfy any input, provided for an input that *could* be satisfied by another argument. - Missing inputs are inputs that can't be satisfied by any argument, where the provided argument could satisfy another input - Swapped / Permuted arguments are identified with a cycle detection algorithm. As each issue is found, we remove the relevant inputs / arguments and check for more issues. If we find no issues, we match up any "valid" arguments, and start again. Note that there's a lot of extra complexity: - We try to stay efficient on the happy path, only computing the diagonal until we find a problem, and then filling in the rest of the matrix. - Closure arguments are wrapped in a tuple and need to be unwrapped - We need to resolve closure types after the rest, to allow the most specific type constraints - We need to handle imported C functions that might be variadic in their inputs. I tried to document a lot of this in comments in the code and keep the naming clear.
2022-04-16Rollup merge of #96004 - JakobDegen:fix-validator-ice, r=petrochenkovDylan DPC-0/+10
Consider lifetimes when comparing types for equality in MIR validator Closes #95978 .
2022-04-16Rollup merge of #95859 - rainy-me:unterminated-nested-block-comment, ↵Dylan DPC-0/+25
r=petrochenkov Improve diagnostics for unterminated nested block comment close #95283 (This is my first time try to messing around with rust compiler and might get a lot of things wrong... :bow: )
2022-04-16Rollup merge of #95372 - RalfJung:unaligned_references, r=oli-obkDylan DPC-37/+488
make unaligned_references lint deny-by-default This lint has been warn-by-default for a year now (since https://github.com/rust-lang/rust/pull/82525), so I think it is time to crank it up a bit. Code that triggers the lint causes UB (without `unsafe`) when executed, so we really don't want people to write code like this.
2022-04-16Auto merge of #94468 - Amanieu:global_asm_sym, r=nagisabors-57/+103
Implement sym operands for global_asm! Tracking issue: #93333 This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are: - At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`. - At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails). - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`. - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to. - The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression. - At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details. - On Mach-O, all symbols have a leading underscore. - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall. - No mangling is needed on other platforms. r? `@nagisa` cc `@eddyb`
2022-04-16Update tests for sym support in global_asm!Amanieu d'Antras-57/+103