about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-06-03Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebankbors-594/+1268
rewrite error handling for unresolved inference vars Pretty much completely rewrites `fn emit_inference_failure_err`. This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments. Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs. r? `@estebank` `@petrochenkov`
2022-06-03Auto merge of #97679 - Dylan-DPC:rollup-nswmgmx, r=Dylan-DPCbors-10/+162
Rollup of 5 pull requests Successful merges: - #97366 (Stabilize `{slice,array}::from_ref`) - #97653 (add cast kind of from_exposed_addr (int-to-ptr casts)) - #97663 (take back half-baked noaliasing check in Assignment) - #97664 (On E0204 suggest missing type param bounds) - #97668 (rustdoc: clean up primitive.slice.html links) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-03Conservatively report "not sure" in cfg_accessibleUrgau-32/+56
2022-06-03Rollup merge of #97664 - estebank:suggest-bound-derive-copy, r=compiler-errorsDylan DPC-10/+162
On E0204 suggest missing type param bounds ``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-06-03Auto merge of #96296 - cjgillot:remove-label-lt-shadow, r=petrochenkovbors-1395/+78
Remove label/lifetime shadowing warnings This PR removes some pre-1.0 shadowing warnings for labels and lifetimes. The current behaviour of the compiler is to warn * labels that shadow unrelated labels in the same function --> removed ```rust 'a: loop {} 'a: loop {} // STOP WARNING ``` * labels that shadow enclosing labels --> kept, but only if shadowing is hygienic ```rust 'a: loop { 'a: loop {} // KEEP WARNING } ``` * labels that shadow lifetime --> removed ```rust fn foo<'a>() { 'a: loop {} // STOP WARNING } ``` * lifetimes that shadow labels --> removed ```rust 'a: loop { let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // STOP WARNING } ``` * lifetimes that shadow lifetimes --> kept ```rust fn foo<'a>() { let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // KEEP WARNING } ``` Closes https://github.com/rust-lang/rust/issues/31745. ----- From `@petrochenkov` in https://github.com/rust-lang/rust/pull/95781#issuecomment-1105199014 > I think we should remove these silly checks entirely. > They were introduced long time ago in case some new language features appear and require this space. > Now we have another mechanism for such language changes - editions, and if "lifetimes in expressions" or something like that needs to be introduced it could be introduced as an edition change. > However, there was no plans to introduce anything like for years, so it's unlikely that even the edition mechanism will be necessary. r? rust-lang/lang
2022-06-03Use the same message as type & const generics.Camille GILLOT-19/+19
2022-06-03Do not lower generic lifetime params when AST resolution emitted an error.Camille GILLOT-12/+2
2022-06-03Auto merge of #97497 - c410-f3r:z-errors, r=petrochenkovbors-0/+0
Move some tests to more reasonable places r? `@petrochenkov`
2022-06-02review commentsEsteban Küber-28/+28
2022-06-02Tweak outputEsteban Küber-6/+0
2022-06-02Rollup merge of #97645 - lcnr:derived-impl-debug, r=cjgillotMatthias Krüger-30/+5
don't use a `span_note` for ignored impls Searching for the `derive` isn't too difficult as it's right above the field definition. By using a span these errors are a lot more verbose than they should be, which is especially annoying as one can end up with a lot of `dead_code` warnings.
2022-06-02Rollup merge of #97640 - ↵Matthias Krüger-0/+24
TaKO8Ki:fix-wrong-suggestion-for-adding-where-clauses, r=lcnr Fix wrong suggestion for adding where clauses closes #97576
2022-06-02Rollup merge of #97627 - lcnr:comment-tick, r=Dylan-DPCMatthias Krüger-7/+7
update explicit impls error msg
2022-06-02On E0204 suggest missing type param boundsEsteban Küber-10/+168
``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-06-02Rebase fallout.Camille GILLOT-95/+7
2022-06-02Stop warning against unrelated labels.Camille GILLOT-427/+42
2022-06-02Bless tests.Camille GILLOT-267/+0
2022-06-02Bless tests.Camille GILLOT-774/+207
2022-06-02Auto merge of #97654 - Dylan-DPC:rollup-w6zrzxf, r=Dylan-DPCbors-86/+85
Rollup of 5 pull requests Successful merges: - #97420 (Be a little nicer with casts when formatting `fn` pointers) - #97450 ([RFC 2011] Basic compiler infrastructure) - #97599 (Fix JSON reexport ICE) - #97617 (Rustdoc anonymous reexports) - #97636 (Revert #96682.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-02Rollup merge of #97636 - nnethercote:revert-96682, r=dtolnayDylan DPC-86/+59
Revert #96682. The change was "Show invisible delimiters (within comments) when pretty printing". It's useful to show these delimiters, but is a breaking change for some proc macros. Fixes #97608. r? ``@petrochenkov``
2022-06-02Rollup merge of #97450 - c410-f3r:assert-compiler, r=oli-obkDylan DPC-0/+26
[RFC 2011] Basic compiler infrastructure Splitting https://github.com/rust-lang/rust/pull/96496 into smaller pieces as was done in https://github.com/rust-lang/rust/pull/97233. Hope review will be easier. This PR practically contains no logic and only serves as a building ground for the actual code that will be placed in a posterior step. * Adds `context.rs` to place the new `assert!` logic. Has a lot of unused elements but all of them are used by the implementation. * Creates an unstable flag because the feature is not yet complete and also to allow external feedback. * Creates the necessary `sym` identifiers that are mostly based on the library elements -> https://github.com/rust-lang/rust/blob/master/library/core/src/asserting.rs * Modifies `assert.rs` to branch to `context.rs` if the unstable flag is enabled. * Adds a test to satisfy tidy but the test does nothing in reality.
2022-06-02Auto merge of #97293 - est31:remove_box, r=oli-obkbors-1/+1
Add #[rustc_box] and use it inside alloc This commit adds an alternative content boxing syntax, and uses it inside alloc. ```Rust #![feature(box_syntax)] fn foo() { let foo = box bar; } ``` is equivalent to ```Rust #![feature(rustc_attrs)] fn foo() { let foo = #[rustc_box] Box::new(bar); } ``` The usage inside the very performance relevant code in liballoc is the only remaining relevant usage of box syntax in the compiler (outside of tests, which are comparatively easy to port). box syntax was originally designed to be used by all Rust developers. This introduces a replacement syntax more tailored to only being used inside the Rust compiler, and with it, lays the groundwork for eventually removing box syntax. [Earlier work](https://github.com/rust-lang/rust/pull/87781#issuecomment-894714878) by `@nbdd0121` to lower `Box::new` to `box` during THIR -> MIR building ran into borrow checker problems, requiring the lowering to be adjusted in a way that led to [performance regressions](https://github.com/rust-lang/rust/pull/87781#issuecomment-894872367). The proposed change in this PR lowers `#[rustc_box] Box::new` -> `box` in the AST -> HIR lowering step, which is way earlier in the compiler, and thus should cause less issues both performance wise as well as regarding type inference/borrow checking/etc. Hopefully, future work can move the lowering further back in the compiler, as long as there are no performance regressions.
2022-06-02make cenum_impl_drop_cast deny-by-default and show up as future breakage ↵Ralf Jung-0/+15
diagnostic
2022-06-02Basic compiler infraCaio-0/+26
2022-06-02fix wrong suggestion for adding where clausesTakayuki Maeda-0/+24
2022-06-02don't use a `span_note` for ignored implslcnr-30/+5
2022-06-02Rollup merge of #97023 - cjgillot:uniform-anon, r=estebankDylan DPC-26/+384
Diagnose anonymous lifetimes errors more uniformly between async and regular fns Async fns and regular fns are desugared differently. For the former, we create a generic parameter at HIR level. For the latter, we just create an anonymous region for typeck. I plan to migrate regular fns to the async fn desugaring. Before that, this PR attempts to merge the diagnostics for both cases. r? ```@estebank```
2022-06-02rebaselcnr-0/+1
2022-06-02remove unnecessary changelcnr-8/+8
2022-06-02`generic_arg_contains_target`: ignore closureslcnr-24/+14
2022-06-02use verbose suggestionslcnr-8/+24
2022-06-02add new `emit_inference_failure_err`lcnr-606/+1273
2022-06-02Revert #96682.Nicholas Nethercote-86/+59
The change was "Show invisible delimiters (within comments) when pretty printing". It's useful to show these delimiters, but is a breaking change for some proc macros. Fixes #97608.
2022-06-01Make output more specificEsteban Küber-215/+346
2022-06-02Rollup merge of #97605 - estebank:suggestion-filename, r=oli-obkYuki Okushi-0/+6
Mention filename in suggestion when it differs from primary span
2022-06-01Fix typoEsteban Küber-8/+8
2022-06-01update explicit impls error msglcnr-7/+7
2022-06-01Fix testEsteban Küber-0/+5
2022-06-01More accurately handle suggestionsEsteban Küber-24/+26
* Confirm the path segment being modified is an `enum` * Check whether type has type param before suggesting changing `Self` * Wording changes * Add clarifying comments * Suggest removing args from `Self` if the type doesn't have type params
2022-06-01Provide more context when denying invalid type paramsEsteban Küber-79/+418
2022-06-01Auto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgrbors-5/+291
Rollup of 4 pull requests Successful merges: - #96271 (suggest `?` when method is missing on `Result<T, _>` but found on `T`) - #97264 (Suggest `extern crate foo` when failing to resolve `use foo`) - #97592 (rustdoc: also index impl trait and raw pointers) - #97621 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-01Mention filename in suggestion when it differs from primary spanEsteban Küber-0/+6
2022-06-01Rollup merge of #97264 - ↵Matthias Krüger-5/+74
TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank Suggest `extern crate foo` when failing to resolve `use foo` closes #97095 r? ``@estebank``
2022-06-01Rollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebankMatthias Krüger-0/+217
suggest `?` when method is missing on `Result<T, _>` but found on `T` The wording needs help, I think. Fixes #95729
2022-06-01Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errorsYuki Okushi-0/+39
Add regression test for #71546 Closes #71546 r? `@compiler-errors`
2022-06-01Add regression test for #71546Yuki Okushi-0/+39
2022-06-01Add #[rustc_box]est31-1/+1
This commit adds an alternative content boxing syntax, and uses it inside alloc. The usage inside the very performance relevant code in liballoc is the only remaining relevant usage of box syntax in the compiler (outside of tests, which are comparatively easy to port). box syntax was originally designed to be used by all Rust developers. This introduces a replacement syntax more tailored to only being used inside the Rust compiler, and with it, lays the groundwork for eventually removing box syntax.
2022-05-31Auto merge of #97419 - WaffleLapkin:const_from_ptr_range, r=oli-obkbors-0/+765
Make `from{,_mut}_ptr_range` const This PR makes the following APIs `const`: ```rust // core::slice pub const unsafe fn from_ptr_range<'a, T>(range: Range<*const T>) -> &'a [T]; pub const unsafe fn from_mut_ptr_range<'a, T>(range: Range<*mut T>) -> &'a mut [T]; ``` Tracking issue: #89792. Feature for `from_ptr_range` as a `const fn`: `slice_from_ptr_range_const`. Feature for `from_mut_ptr_range` as a `const fn`: `slice_from_mut_ptr_range_const`. r? `@oli-obk`
2022-05-31Rollup merge of #97371 - ChayimFriedman2:closure-non-block-add-semicolon, ↵Dylan DPC-0/+27
r=oli-obk Suggest adding a semicolon to a closure without block This transforms `|| expr` into `|| { expr; }`. Closes #97359.
2022-05-31normalize harderMaybe Waffle-58/+59