summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2022-12-08Rollup merge of #104922 - estebank:fur-elize, r=oli-obkMatthias Krüger-6/+6
Detect long types in E0308 and write them to disk On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-12-06Rollup merge of #105340 - estebank:ice-ice-baby, r=compiler-errorsMatthias Krüger-0/+130
Avoid ICE by accounting for missing type Fix #105330
2022-12-05Avoid ICE by accounting for missing typeEsteban Küber-0/+130
Fix #105330
2022-12-05Tweak "the following other types implement trait"Esteban Küber-8/+3
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-12-03Rollup merge of #105164 - compiler-errors:revert-import-filter, r=estebankMatthias Krüger-6/+15
Restore `use` suggestion for `dyn` method call requiring `Sized` Add the suggestion back that I accidentally removed in 88f2140d8736329610a4c0bd8000e164c9170537 because I didn't understand that suggestion was actually useful... Fixes #105159
2022-12-02Revert 88f2140Michael Goulet-6/+15
2022-11-28fix testEsteban Küber-1/+1
2022-11-28Further tweak the type shortening logicEsteban Küber-5/+5
2022-11-28Detect long types in E0308 and write them to diskEsteban Küber-5/+5
On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-11-28Change multiline span ASCII art visual orderEsteban Küber-3/+3
2022-11-24Rollup merge of #103908 - estebank:consider-cloning, r=compiler-errorsMatthias Krüger-0/+9
Suggest `.clone()` or `ref binding` on E0382
2022-11-24Auto merge of #104610 - ouz-a:revert-overflow, r=compiler-errorsbors-2/+9
Reverts check done by #100757 As my `fix` caused more issues than it resolved it's better to revert it. ( #103274 #104322 https://github.com/rust-lang/rust/issues/104606) r? `@compiler-errors` Reopens #95134
2022-11-23Tweak output in for loopsEsteban Küber-8/+0
Do not suggest `.clone()` as we already suggest borrowing the iterated value.
2022-11-23Suggest `.clone()` or `ref binding` on E0382Esteban Küber-0/+17
2022-11-22Auto merge of #103578 - petrochenkov:nofict, r=nagisabors-10/+8
Unreserve braced enum variants in value namespace With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed. Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-10/+8
2022-11-20Move testsCaio-238/+0
2022-11-19fix test errouz-a-3/+4
2022-11-19re-add test and blessouz-a-1/+1
2022-11-19revert-overflowouz-a-1/+7
2022-11-19Rollup merge of #104469 - estebank:long-types, r=oli-obkMatthias Krüger-21/+26
Make "long type" printing type aware and trim types in E0275 Instead of simple string cutting, use a custom printer to hide parts of long printed types. On E0275, check for type length before printing.
2022-11-18Only use `...` instead of `_` for type elisionEsteban Küber-2/+2
`_` 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-3/+3
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-14/+20
2022-11-18Make "long type" printing type awareEsteban Küber-4/+3
Instead of simple string cutting, use a custom printer to hide parts of long printed types.
2022-11-18rename `is_tainted_by_errors` Boxy-2/+1
2022-11-16Rollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obkMatthias Krüger-17/+16
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-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-17/+16
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-15Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebankMatthias Krüger-0/+6
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-14Show a note where a macro failed to matchNilstrieb-0/+6
This shows a small note on what the macro matcher was currently processing to aid with "no rules expected the token X" errors.
2022-11-14Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwcoMatthias Krüger-4/+4
Don't print full paths in overlap errors We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message. r? diagnostics
2022-11-14Fix test/ui/issues/issue-30490.rsAyush Singh-1/+1
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-12Move testsCaio-450/+0
2022-11-12Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebankDylan DPC-4/+1
Unhide unknown spans r? ```@estebank```
2022-11-12Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obkDylan DPC-2/+12
Add the `#[derive_const]` attribute Closes #102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? `````@oli-obk`````
2022-11-11Print all labels, even if they have no span. Fall back to main item's span.Oli Scherer-4/+1
2022-11-10Tweak span for `#[must_use]`Esteban Küber-2/+2
Do not point at whole statement, only at the expression (skip pointing at `;`)
2022-11-10Don't print full paths in overlap errorsMichael Goulet-4/+4
2022-11-10Auto merge of #101990 - clubby789:dont-machine-apply-placeholder-method, ↵bors-2/+2
r=compiler-errors Fix auto-application of associated generic functions with placeholders Fixes #101920
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-2/+2
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-08Rollup merge of #100508 - BoxyUwU:make_less_things_late_bound, r=nikomatsakisManish Goregaokar-44/+0
avoid making substs of type aliases late bound when used as fn args fixes #47511 fixes #85533 (although I did not know theses issues existed when i was working on this :upside_down_face:) currently `Alias<...>` is treated the same as `Struct<...>` when deciding if generics should be late bound or early bound but this is not correct as `Alias` might normalize to a projection which does not constrain the generics. I think this needs more tests before merging more explanation of PR [here](https://hackmd.io/v44a-QVjTIqqhK9uretyQg?view) Hackmd inline for future readers: --- This assumes reader is familiar with the concept of early/late bound lifetimes. There's a section on rustc-dev-guide if not (although i think some details are a bit out of date) ## problem & background Not all lifetimes on a fn can be late bound: ```rust fn foo<'a>() -> &'a (); impl<'a> Fn<()> for FooFnDef { type Output = &'a (); // uh oh unconstrained lifetime } ``` so we make make them early bound ```rust fn foo<'a>() -> &'a (); impl<'a> Fn<()> for FooFnDef<'a> {// wow look at all that lifetimey type Output = &'a (); } ``` (Closures have the same constraint however it is not enforced leading to soundness bugs, [#84385](https://github.com/rust-lang/rust/pull/84385) implements this "downgrading late bound to early bound" for closures) lifetimes on fn items are only late bound when they are "constrained" by the fn args: ```rust fn foo<'a>(_: &'a ()) -> &'a (); // late bound, not present on `FooFnItem` // vv impl<'a> Trait<(&'a (),)> for FooFnItem { type Output = &'a (); } // projections do not constrain inputs fn bar<'a, T: Trait>(_: <T as Trait<'a>>::Assoc) -> &'a (); // early bound // vv impl<'a, T: Trait> Fn<(<T as Trait<'a>>::Assoc,)> for BarFnItem<'a, T> { type Output = &'a (); } ``` current logic for determining if inputs "constrain" a lifetime works off of HIR so does not normalize aliases. It also assumes that any path with no self type constrains all its substs (i.e. `Foo<'a, u32>` has no self type but `T::Assoc` does). This falls apart for top level type aliases (see linked issues): ```rust type Alias<'a, T> = <T as Trait<'a>>::Assoc; // wow look its a path with no self type uwu // i bet that constrains `'a` so it should be latebound // vvvvvvvvvvv fn foo<'a, T: Trait>(_: Alias<'a, T>) -> &'a (); // `Alias` normalized to make things clearer // vvvvvvvvvvvvvvvvvvvvvvv impl<'a, T: Trait> Fn<(<T as Trait<'a>>::Assoc,)> for FooFnDef<T> { type Output = &'a (); // oh no `'a` isnt constrained wah wah waaaah *trumbone noises* // i think, idk what musical instrument that is } ``` ## solution The PR solves this by having the hir visitor that checks for lifetimes in constraining uses check if the path is a `DefKind::Alias`. If it is we ""normalize"" it by calling `type_of` and walking the returned type. This is a bit hacky as it requires a mapping between the substs on the path in hir, and the generics of the `type Alias<...>` which is on the ty layer. Alternative solutions may involve calculating the "late boundness" of lifetimes after/during astconv rather than relying on hir at all. We already have code to determine whether a lifetime SHOULD be late bound or not as this is currently how the error for `fn foo<'a, T: Trait>(_: Alias<'a, T>) -> &'a ();` gets emitted. It is probably not possible to do this right now, late boundness is used by `generics_of` and `gather_explicit_predicates_of` as we currently do not put late bound lifetimes in `Generics`. Although this seems sus to me as the long term goal is to make all generics late bound which would result in `generics_of(function)` being empty? [#103448](https://github.com/rust-lang/rust/pull/103448) places all lifetimes in `Generics` regardless of late boundness so that may be a good step towards making this possible.
2022-11-08selection failure: recompute applicable implslcnr-1/+2
2022-11-07Rollup merge of #104003 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-237/+0
Move some tests to more reasonable directories r? `@petrochenkov`
2022-11-06fixyfixfixBoxy-44/+0
2022-11-05Attempt to fix arguments of associated functionsclubby789-2/+2
2022-11-05Adjust diagnostics, bless testsMichael Goulet-5/+5
2022-11-05Move some tests to more reasonable directoriesCaio-237/+0
2022-11-05Specify that `break` cannot be used outside of loop *or* labeled blockclubby789-15/+15
2022-10-23Rollup merge of #103305 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-331/+0
Move some tests to more reasonable places r? `@petrochenkov`