about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
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`
2022-10-21Auto merge of #101263 - lopopolo:lopopolo/c-unwind-fn-ptr-impls, r=thomccbors-2/+2
Add default trait implementations for "c-unwind" ABI function pointers Following up on #92964, only add default trait implementations for the `c-unwind` family of function pointers. The previous attempt in #92964 added trait implementations for many more ABIs and ran into concerns regarding the increase in size of the libcore rlib. An attempt to abstract away function pointer types behind a unified trait to reduce the duplication of trait impls is being discussed in #99531 but this change looks to be blocked on a lang MCP. Following `@RalfJung's` suggestion in https://github.com/rust-lang/rust/pull/99531#issuecomment-1233440142, this commit is another cut at #92964 but it _only_ adds the impls for `extern "C-unwind" fn` and `unsafe extern "C-unwind" fn`. I am interested in landing this patch to unblock the stabilization of the `c_unwind` feature. RFC: https://github.com/rust-lang/rfcs/pull/2945 Tracking Issue: https://github.com/rust-lang/rust/issues/74990
2022-10-20Update tests to match error message changesb4den-2/+2
2022-10-20Move some tests for more reasonable placesCaio-331/+0
2022-10-19Adjust `transmute{,_copy}` to be clearer about which of `T` and `U` is input ↵Thom Chiovoloni-3/+3
vs output
2022-10-19Bless ui testsRyan Lopopolo-2/+2
2022-10-19instantiate -> constructMichael Goulet-1/+1
2022-10-19Generalize call suggestion for unsatisfied predicateMichael Goulet-1/+1
2022-10-18Rollup merge of #103023 - andrewpollack:i-fuchsia-finals, r=tmandryYuki Okushi-0/+1
Adding `fuchsia-ignore` and `needs-unwind` to compiler test cases Final tests covering missing privileges r? ``@tmandry`` cc. ``@djkoloski``
2022-10-14Rollup merge of #102938 - c410-f3r:here-we-go-again, r=petrochenkovDylan DPC-294/+0
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-13Adding fuchsia-ignore and needs-unwind to compiler test casesAndrew Pollack-0/+1
2022-10-13Report duplicate definition in impls with overlap check.Camille GILLOT-4/+4
2022-10-13Move some tests to more reasonable directoriesCaio-294/+0
2022-10-13Rollup merge of #102974 - Rageking8:fix-small-word-dupe-typos, r=JohnTitorYuki Okushi-3/+3
Fix small word dupe typos
2022-10-13fix small word dupe typosRageking8-3/+3
2022-10-12add test for issue 102964Rageking8-0/+29
2022-10-10Check representability in adt_sized_constraintCameron Steffen-18/+3
2022-10-10Rollup merge of #102055 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-87/+0
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-09fixup lint nameMaybe Waffle-1/+1
2022-10-09allow or avoid for loops over option in compiler and testsMaybe Waffle-0/+1
2022-10-07Rewrite representabilityCameron Steffen-96/+62
2022-10-07Rollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errorsMatthias Krüger-2/+2
do not reverse the expected type and found type for ObligationCauseCo… …de of IfExpressionWithNoElse this will fix #102397
2022-10-06Rollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwcoMatthias Krüger-6/+6
Suggest calling method if fn does not exist I tried to split this up into two commits, the first where we stash the resolution error until typeck (which causes a bunch of diagnostics changes because the ordering of error messages change), then the second commit is the actual logic that actually implements the suggestion. I am not in love with the presentation of the suggestion, so I could use some advice for how to format the actual messaging. r? diagnostics Fixes #102518
2022-10-05do not reverse the expected type and found type for ObligationCauseCode of ↵Yiming Lei-2/+2
IfExpressionWithNoElse this will fix #102397
2022-10-05Rollup merge of #100986 - ↵Dylan DPC-10/+0
TaKO8Ki:do-not-suggest-adding-generic-args-for-turbofish, r=compiler-errors Stop suggesting adding generic args for turbofish Fixes #100137
2022-10-05stop suggesting adding generic args for turbofishTakayuki Maeda-10/+0
2022-10-05Delay function resolution error until typeckMichael Goulet-6/+6
2022-10-04slightly improve no return for returning function errorRageking8-1/+1
2022-10-01bless ui testsMaybe Waffle-27/+27
2022-09-28Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwcobors-2/+2
Migrate more of rustc_parse to SessionDiagnostic Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.
2022-09-28Auto merge of #102388 - JohnTitor:rollup-mbyw6fl, r=JohnTitorbors-1/+1
Rollup of 8 pull requests Successful merges: - #100747 (Add long description and test for E0311) - #102232 (Stabilize bench_black_box) - #102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.) - #102338 (Deny associated type bindings within associated type bindings) - #102347 (Unescaping cleanups) - #102348 (Tweak `FulfillProcessor`.) - #102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`) - #102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-28Rollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8KiYuki Okushi-1/+1
Stabilize bench_black_box This PR stabilize `feature(bench_black_box)`. ```rust pub fn black_box<T>(dummy: T) -> T; ``` The FCP was completed in https://github.com/rust-lang/rust/issues/64102. `@rustbot` label +T-libs-api -T-libs
2022-09-27Migrate more diagnostics in rustc_parse to diagnostic structsXiretza-2/+2
2022-09-27Stabilize bench_black_boxUrgau-1/+1
2022-09-27Update tests.Mara Bos-6/+4
2022-09-26address reviewb-naber-9/+9
2022-09-24Auto merge of #102068 - cjgillot:erased-lifetime-print, r=eholkbors-2/+2
Always print '_, even for erased lifetimes. Explicit lifetime arguments are now the recommended syntax in rust 2018 and rust 2021. This PR applies this discipline to rustc itself.
2022-09-23Always print '_, even for erased lifetimes.Camille GILLOT-2/+2