about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-11-18Add a detailed note for missing comma in FRU syntax typoMichael Goulet-19/+65
2022-11-18Auto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkovbors-102/+102
Shrink `ast::Expr` harder r? `@ghost`
2022-11-18Only use `...` instead of `_` for type elisionEsteban Küber-5/+5
`_` might confuse people into believing that the type isn't known, while `...` is not used anywhere else for types and is not valid syntax, making it more likely to convey the right understanding.
2022-11-18On E0275 do not print out the full type in the msgEsteban Küber-4/+4
When printing requirement overflow errors, do not print out the full type name when it is longer than 50 characters long.
2022-11-18On overflow errors, do not print out long typesEsteban Küber-23/+35
2022-11-18Make "long type" printing type awareEsteban Küber-21/+16
Instead of simple string cutting, use a custom printer to hide parts of long printed types.
2022-11-18deduplicate testslcnr-39/+9
2022-11-18rename `is_tainted_by_errors` Boxy-2/+1
2022-11-18Rollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errorsMatthias Krüger-0/+168
Detect incorrect chaining of if and if let conditions and recover Fixes #103381
2022-11-18Rollup merge of #103386 - compiler-errors:no-coerceunsized-to-dynstar, r=eholkMatthias Krüger-0/+44
Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting) This makes sure we don't accidentally allow coercions like `Box<T>` -> `Box<dyn* Trait>`, or in the case of this ICE, `&T` to `&dyn* Trait`. These coercions don't make sense, at least not via the `CoerceUnsized` trait. Fixes #102172 Fixes #102429
2022-11-18rename to `string_deref_patterns`Deadbeef-4/+4
2022-11-18Adding more testsDeadbeef-112/+28
2022-11-17Rollup merge of #104515 - chenyukang:yukang/fix-104510-ice, r=compiler-errorsMatthias Krüger-0/+25
ICE fixing, remove is_tainted_by_errors since we have ty_error for delay bug Fixes #104510
2022-11-17Rollup merge of #104508 - compiler-errors:dyn-return, r=oli-obkMatthias Krüger-0/+21
Check `dyn*` return type correctly In `check_fn`, if the declared return type is `dyn Trait`, then we check the return type separately to produce better diagnostics, because this is never valid -- however, when `dyn*` was introduced, this check was never adjusted to only account for *unsized* `dyn Trait` and not *sized* `dyn* Trait`. Fixes #104501
2022-11-17Rollup merge of #104496 - djkoloski:dont_normalize_compiler_backtraces, ↵Matthias Krüger-16/+1
r=jackh726 Don't attempt to normalize compiler backtraces Backtraces can very significantly depending on environment and cause spurious test suite failures. Ensuring a proper failure-status should be sufficient to keep a crash properly documented. This caused a failure in Fuchsia's test suite CI due to an extra newline between "stack" and "error" appearing after normalization. cc ````@jackh726```` r? ````@tmandry````
2022-11-17Rollup merge of #104444 - chenyukang:yukang/fix-104390, r=compiler-errorsMatthias Krüger-0/+75
Fix ICE in in_operand for ty error Fixes #104390 By the way, moving some test cases to proper directory for tidy bless.
2022-11-17Rollup merge of #104433 - TaKO8Ki:fix-104392, r=estebankMatthias Krüger-0/+38
Fix `emit_unused_delims_expr` ICE Fixes #104392
2022-11-17Rollup merge of #103852 - compiler-errors:rpitit-early-from-impl, r=lcnrMatthias Krüger-0/+32
Don't remap early-bound regions for return-position `impl Trait` in trait originating from `impl` long title :sweat: We don't want to remap early-bound regions that originate from the `impl`s themselves, since they have no corresponding region in the trait. Not sure if there's a better condition than checking if the EBR's def-id's parent is the impl -- maybe we should be checking if the region comes from the method or RPITIT... :shrug: r? types Fixes #103850
2022-11-17detect () to avoid redundant <> suggestion for typeYiming Lei-1/+20
fix #104379
2022-11-17Auto merge of #104219 - bryangarza:async-track-caller-dup, r=eholkbors-0/+76
Support `#[track_caller]` on async fns Adds `#[track_caller]` to the generator that is created when we desugar the async fn. Fixes #78840 Open questions: - What is the performance impact of adding `#[track_caller]` to every `GenFuture`'s `poll(...)` function, even if it's unused (i.e., the parent span does not set `#[track_caller]`)? We might need to set it only conditionally, if the indirection causes overhead we don't want.
2022-11-17Move a ui test to make space for new folderDeadbeef-0/+0
2022-11-17Add feature gateDeadbeef-44/+65
2022-11-17Minimal implementation of implicit deref patternsDeadbeef-0/+128
2022-11-17Add powerpc64-ibm-aix as Tier-3 targetQiu Chaofan-1/+1
2022-11-17Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-deadbors-135/+113
Record `LocalDefId` in HIR nodes instead of a side table This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR. This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed. This first part adds the information to HIR nodes themselves instead of a table. The second part is https://github.com/rust-lang/rust/pull/103902 The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter. The fourth part will be to completely remove the side table.
2022-11-17Use `ThinVec` in `ast::Path`.Nicholas Nethercote-98/+98
2022-11-17Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and ↵Nicholas Nethercote-89/+89
patterns.
2022-11-16Auto merge of #102944 - nnethercote:ast-Lit-third-time-lucky, r=petrochenkovbors-23/+201
Use `token::Lit` in `ast::ExprKind::Lit`. Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. r? `@petrochenkov`
2022-11-16Check `dyn*` return type correctlyMichael Goulet-0/+21
2022-11-16Don't attempt to normalize compiler backtracesDavid Koloski-16/+1
Backtraces can very significantly depending on environment and cause test suite failures spuriously. Ensuring a proper failure-status should be sufficient to keep a crash properly documented.
2022-11-16Rollup merge of #104335 - Nilstrieb:macrowo, r=compiler-errorsMatthias Krüger-0/+31
Only do parser recovery on retried macro matching Eager parser recovery can break macros, so we don't do it at first. But when we already know that the macro failed, we can retry it with recovery enabled to still emit useful diagnostics. Helps with #103534
2022-11-16Rollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obkMatthias Krüger-342/+500
cleanup and dedupe CTFE and Miri error reporting It looks like most of the time, this error raised from const_prop_lint is just redundant -- it duplicates the error reported when evaluating the const-eval query. This lets us make `ConstEvalErr` private to the const_eval module which I think is a good step. The Miri change mostly replaces a `match` by `if let`, and dedupes the "this error is impossible in Miri" checks. r? ``@oli-obk`` Fixes https://github.com/rust-lang/rust/issues/75461
2022-11-16fix #104510, Remove is_tainted_by_errors since we have ty_error for delay bugyukang-0/+25
2022-11-16fix #104390, fix ICE in in_operand for ty erroryukang-0/+75
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-342/+500
2022-11-16Rollup merge of #104419 - Ayush1325:test-issue-30490, r=lcnrMatthias Krüger-1/+1
Fix test/ui/issues/issue-30490.rs Since the empty main is used for `not(unix)`, all the targets that will use this empty main will also need `allow(unused_imports)`. Originally part of https://github.com/rust-lang/rust/pull/100316 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-16Rollup merge of #104348 - fmease:iat-vis-stab, r=cjgillotMatthias Krüger-1/+76
Respect visibility & stability of inherent associated types As discussed in #103621, this probably won't be the final location of the code that resolves inherent associated types. Still, I think it's valuable to push correctness fixes for this feature (in regards to visibility and stability). Let me know if I should write a translatable diagnostic instead and if I should move the tests to `privacy/` and `stability-attribute/` respectively. Fixes #104243. ````@rustbot```` label A-visibility F-inherent_associated_types r? ````@cjgillot```` (since you reviewed #103621, feel free to reroll though)
2022-11-16Rollup merge of #104193 - TaKO8Ki:fix-104142, r=cjgillotMatthias Krüger-0/+29
Shift no characters when using raw string literals Fixes #104142 Given the following code: ```rust fn main() { println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); } ``` The current output is: ``` error: invalid format string: unmatched `}` found --> src/main.rs:2:59 | 2 | println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` error: could not compile `debug_playground` due to previous error ``` The output should look like: ``` error: invalid format string: unmatched `}` found --> src/main.rs:2:45 | 2 | println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` error: could not compile `debug_playground` due to previous error ``` This pull request fixes the wrong span for `invalid format string` error and also solves the ICE.
2022-11-16Use `token::Lit` in `ast::ExprKind::Lit`.Nicholas Nethercote-89/+108
Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. This commit changes the language very slightly. Some programs that used to not compile now will compile. This is because some invalid literals that are removed by `cfg` or attribute macros will no longer trigger errors. See this comment for more details: https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-16Add some more bad suffix cases in a test.Nicholas Nethercote-17/+75
2022-11-16Add a test for different stages of lexer error reporting.Nicholas Nethercote-0/+101
2022-11-15Only do parser recovery on retried macro matchingNilstrieb-0/+31
This prevents issues with eager parser recovery during macro matching.
2022-11-15Auto merge of #104437 - matthiaskrgr:rollup-n5jdg9v, r=matthiaskrgrbors-0/+428
Rollup of 9 pull requests Successful merges: - #103439 (Show note where the macro failed to match) - #103734 (Adjust stabilization version to 1.65.0 for wasi fds) - #104148 (Visit attributes of trait impl items during AST validation) - #104241 (Move most of unwind's build script to lib.rs) - #104258 (Deduce closure signature from a type alias `impl Trait`'s supertraits) - #104296 (Walk types more carefully in `ProhibitOpaqueTypes` visitor) - #104309 (Slightly improve error message for invalid identifier) - #104316 (Simplify suggestions for errors in generators.) - #104339 (Add `rustc_deny_explicit_impl`) Failed merges: - #103484 (Add `rust` to `let_underscore_lock` example) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-15nll: correctly deal with bivariancelcnr-0/+26
2022-11-15Rollup merge of #104309 - chenyukang:yukang/fix-104088-identifier-error, ↵Matthias Krüger-0/+55
r=davidtwco Slightly improve error message for invalid identifier fixes #104088
2022-11-15Rollup merge of #104296 - compiler-errors:opaque-ty-ffi-normalization-cycle, ↵Matthias Krüger-0/+56
r=lcnr Walk types more carefully in `ProhibitOpaqueTypes` visitor The visitor didn't account for the case where you could have `<TAIT as Trait>::Assoc` normalize to itself, in the case of a `type TAIT = impl Trait` with an unconstrained associated type. That causes the visitor to loop on the same type over and over. Fixes #104291
2022-11-15Rollup merge of #104258 - compiler-errors:tait-closure-deduce, r=oli-obkMatthias Krüger-0/+15
Deduce closure signature from a type alias `impl Trait`'s supertraits r? `@oli-obk` Basically pass the TAIT's bounds through the same method that we're using to deduce a signature from infer var closure bounds. Does this need a new FCP? I see it as a logical extension of #101834, but happy to rfcbot a new one if it does.
2022-11-15Rollup merge of #104148 - fmease:fix-104140, r=petrochenkovMatthias Krüger-0/+23
Visit attributes of trait impl items during AST validation Fixes #104140. This fix might not be backward compatible (in practice) since we now validate more attributes than before. Should I write more tests? `@rustbot` label A-attributes
2022-11-15Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebankMatthias Krüger-0/+279
Show note where the macro failed to match When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong. ```rust macro_rules! uwu { (a a a b) => {}; } uwu! { a a a c } ``` ```diff error: no rules expected the token `c` --> macros.rs:5:14 | 1 | macro_rules! uwu { | ---------------- when calling this macro ... 4 | uwu! { a a a c } | ^ no rules expected this token in macro call | +note: while trying to match `b` + --> macros.rs:2:12 + | +2 | (a a a b) => {}; + | ^ ```
2022-11-15Auto merge of #101168 - jachris:dataflow-const-prop, r=oli-obkbors-6/+6
Add new MIR constant propagation based on dataflow analysis The current constant propagation in `rustc_mir_transform/src/const_prop.rs` fails to handle many cases that would be expected from a constant propagation optimization. For example: ```rust let x = if true { 0 } else { 0 }; ``` This pull request adds a new constant propagation MIR optimization pass based on the existing dataflow analysis framework. Since most of the analysis is not unique to constant propagation, a generic framework has been extracted. It works on top of the existing framework and could be reused for other optimzations. Closes #80038. Closes #81605. ## Todo ### Essential - [x] [Writes to inactive enum variants](https://github.com/rust-lang/rust/pull/101168#pullrequestreview-1089493974). Resolved by rejecting the registration of places with downcast projections for now. Could be improved by flooding other variants if mutable access to a variant is observed. - [X] Handle [`StatementKind::CopyNonOverlapping`](https://github.com/rust-lang/rust/pull/101168#discussion_r957774914). Resolved by flooding the destination. - [x] Handle `UnsafeCell` / `!Freeze` correctly. - [X] Overflow propagation of `CheckedBinaryOp`: Decided to not propagate if overflow flag is `true` (`false` will still be propagated) - [x] More documentation in general. - [x] Arguments for correctness, documentation of necessary assumptions. - [x] Better performance, or alternatively, require `-Zmir-opt-level=3` for now. ### Extra - [x] Add explicit unreachability, i.e. upgrading the lattice from $\mathbb{P} \to \mathbb{V}$ to $\set{\bot} \cup (\mathbb{P} \to \mathbb{V})$. - [x] Use storage statements to improve precision. - [ ] Consider opening issue for duplicate diagnostics: https://github.com/rust-lang/rust/pull/101168#issuecomment-1276609950 - [ ] Flood moved-from places with $\bot$ (requires some changes for places with tracked projections). - [ ] Add downcast projections back in. - [ ] [Algebraic simplifications](https://github.com/rust-lang/rust/pull/101168#discussion_r957967878) (possibly with a shared API; done by old const prop). - [ ] Propagation through slices / arrays. - [ ] Find other optimizations that are done by old `const_prop.rs`, but not by this one.