about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-07-18Rollup merge of #127888 - estebank:type-param-sugg, r=compiler-errorsMatthias Krüger-12/+18
More accurate span for type parameter suggestion After: ``` error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 | LL | impl Foo<T: Default> for String {} | ^^^^^^^^^^ associated item constraint not allowed here | help: declare the type parameter right after the `impl` keyword | LL - impl Foo<T: Default> for String {} LL + impl<T: Default> Foo<T> for String {} | ``` Before: ``` error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 | LL | impl Foo<T: Default> for String {} | ^^^^^^^^^^ associated item constraint not allowed here | help: declare the type parameter right after the `impl` keyword | LL | impl<T: Default> Foo<T> for String {} | ++++++++++++ ~ ```
2024-07-18Rollup merge of #127886 - estebank:as-rename-suggestion, r=compiler-errorsMatthias Krüger-37/+37
Accurate `use` rename suggestion span When suggesting to rename an import with `as`, use a smaller span to render the suggestion with a better format: ``` error[E0252]: the name `baz` is defined multiple times --> $DIR/issue-25396.rs:4:5 | LL | use foo::baz; | -------- previous import of the module `baz` here LL | use bar::baz; | ^^^^^^^^ `baz` reimported here | = note: `baz` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | LL | use bar::baz as other_baz; | ++++++++++++ ```
2024-07-18Rollup merge of #127878 - estebank:assoc-item-removal, r=fmeaseMatthias Krüger-56/+95
Fix associated item removal suggestion We were previously telling people to write what was already there, instead of removal (treating it as a `help`). We now properly suggest to remove the code that needs to be removed. ``` error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} | ^^^^^^^ associated item constraint not allowed here | help: consider removing this associated item binding | LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL + fn baz<I>(x: &<I as Foo>::A) {} | ```
2024-07-18Rollup merge of #127787 - Rejyr:migrate-atomic-lock-free-rmake, r=jieyouxuMatthias Krüger-48/+52
Migrate `atomic-lock-free` to `rmake` Also adds `llvm_components_contain` to `run-make-support`. Part of #121876. r? ``@jieyouxu`` try-job: dist-x86_64-linux
2024-07-18Rollup merge of #127783 - compiler-errors:rtn-pretty, r=fee1-deadMatthias Krüger-6/+109
Put the dots back in RTN pretty printing Also don't render RTN-like bounds for methods with ty/const params.
2024-07-17Rollup merge of #127664 - ↵Trevor Gross-1/+55
compiler-errors:precise-capturing-better-sugg-apit, r=oli-obk Fix precise capturing suggestion for hidden regions when we have APITs Suggests to turn APITs into type parameters so they can be named in precise capturing syntax for hidden type lifetime errors. We also note that it may change the API. This is currently done via a note *and* a suggestion, which feels a bit redundant, but I wasn't totally sure of a better alternative for the presentation. Code is kind of a mess but there's a lot of cases to consider. Happy to iterate on this if you think the approach is too messy. Based on #127619, only the last commit is relevant. r? oli-obk Tracking: - https://github.com/rust-lang/rust/issues/123432
2024-07-17Rollup merge of #127542 - c410-f3r:concat-again, r=petrochenkovTrevor Gross-14/+265
[`macro_metavar_expr_concat`] Add support for literals Adds support for literals in macro parameters. ```rust macro_rules! with_literal { ($literal:literal) => { const ${concat(FOO, $literal)}: i32 = 1; } } fn main() { with_literal!("_BAR"); assert_eq!(FOO_BAR, 1); } ``` cc #124225 r? ``@petrochenkov``
2024-07-18More accurate span for type parameter suggestionEsteban Küber-12/+18
After: ``` error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 | LL | impl Foo<T: Default> for String {} | ^^^^^^^^^^ associated item constraint not allowed here | help: declare the type parameter right after the `impl` keyword | LL - impl Foo<T: Default> for String {} LL + impl<T: Default> Foo<T> for String {} | ``` Before: ``` error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 | LL | impl Foo<T: Default> for String {} | ^^^^^^^^^^ associated item constraint not allowed here | help: declare the type parameter right after the `impl` keyword | LL | impl<T: Default> Foo<T> for String {} | ++++++++++++ ~ ```
2024-07-18Accurate `use` rename suggestion spanEsteban Küber-37/+48
When suggesting to rename an import with `as`, use a smaller span to render the suggestion with a better format: ``` error[E0252]: the name `baz` is defined multiple times --> $DIR/issue-25396.rs:4:5 | LL | use foo::baz; | -------- previous import of the module `baz` here LL | use bar::baz; | ^^^^^^^^ `baz` reimported here | = note: `baz` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | LL | use bar::baz as other_baz; | ++++++++++++ ```
2024-07-17Auto merge of #127865 - matthiaskrgr:rollup-8m49dlg, r=matthiaskrgrbors-187/+269
Rollup of 8 pull requests Successful merges: - #125042 (Use ordinal number in argument error) - #127229 (rustdoc: click target for sidebar items flush left) - #127337 (Move a few intrinsics to Rust abi) - #127472 (MIR building: Stop using `unpack!` for `BlockAnd<()>`) - #127579 (Solve a error `.clone()` suggestion when moving a mutable reference) - #127769 (Don't use implicit features in `Cargo.toml` in `compiler/`) - #127844 (Remove invalid further restricting suggestion for type bound) - #127855 (Add myself to review rotation) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-17Fix associated item removal suggestionEsteban Küber-56/+95
We were previously telling people to write what was already there, instead of removal. ``` error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} | ^^^^^^^ associated item constraint not allowed here | help: consider removing this associated item binding | LL - fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} LL + fn baz<I>(x: &<I as Foo>::A) {} | ```
2024-07-17Migrate `atomic-lock-free` to `rmake`Jerry Wang-48/+52
2024-07-17Add support for literalsCaio-14/+265
2024-07-17Put the dots backMichael Goulet-6/+109
2024-07-17Fix precise capturing suggestion for hidden type when APITs are involvedMichael Goulet-1/+55
2024-07-17Rollup merge of #127844 - chenyukang:yukang-fix-type-bound-127555, r=jieyouxuMatthias Krüger-33/+56
Remove invalid further restricting suggestion for type bound This PR partially addresses #127555, it will remove the obvious error suggestion: ```console | ^^^^ required by this bound in `<Baz as Foo>::bar` help: consider further restricting this bound | 12 | F: FnMut() + Send + std::marker::Send, | +++++++++++++++++++ ``` I may create another PR to get a better diagnostic for `impl has stricter requirements than trait` scenario.
2024-07-17Rollup merge of #127579 - surechen:fix_127285, r=lcnrMatthias Krüger-12/+55
Solve a error `.clone()` suggestion when moving a mutable reference If the moved value is a mut reference, it is used in a generic function and it's type is a generic param, suggest it can be reborrowed to avoid moving. for example: ```rust struct Y(u32); // x's type is '& mut Y' and it is used in `fn generic<T>(x: T) {}`. fn generic<T>(x: T) {} ``` fixes #127285
2024-07-17Rollup merge of #127337 - celinval:intrinsics-fallback, r=oli-obkMatthias Krüger-4/+4
Move a few intrinsics to Rust abi Move a few more intrinsic functions to the convention added in #121192. In the second commit, I added documentation about their safety requirements. Let me know if you would like me to move the second commit to a different PR. Note: I kept the same signature of `pref_align_of`, but I was wondering why this function is considered unsafe?
2024-07-17Rollup merge of #127229 - notriddle:notriddle/mile-wide-bar, r=GuillaumeGomezMatthias Krüger-3/+20
rustdoc: click target for sidebar items flush left This change adjusts the clickable area of sidebar links to touch the leftmost edge of the canvas, making them [much easier](https://www.nngroup.com/articles/fitts-law/) to click (when the browser window is maximized or tiled left, but those cases are common enough to matter). [Screencast from 2024-07-15 15-31-07.webm](https://github.com/user-attachments/assets/1e952d3a-e9e7-476b-b211-44a17c190b38) <details><summary>old screencast</summary> [Screencast from 2024-07-01 17-23-34.webm](https://github.com/rust-lang/rust/assets/1593513/dc6f9c2e-5904-403d-b353-d233e6e1afbc) </details>
2024-07-17Rollup merge of #125042 - long-long-float:suggest-move-arg-outside, r=fmeaseMatthias Krüger-135/+134
Use ordinal number in argument error Add an ordinal number to two argument errors ("unexpected" and "missing") for ease of understanding error. ``` error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> test.rs:11:5 | 11 | f(42, 'a'); | ^ --- 2nd argument of type `f32` is missing | (snip) error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> test.rs:12:5 | 12 | f(42, 42, 1.0, 'a'); | ^ ---- | | | | | unexpected 2nd argument of type `{integer}` | help: remove the extra argument ``` To get an ordinal number, I copied `ordinalize` from other crate `rustc_resolve` because I think it is too much to link `rustc_resolve` for this small function. Please let me know if there is a better way.
2024-07-17tests: update for `rfs` rename许杰友 Jieyou Xu (Joe)-82/+80
2024-07-17tests: update rustdoc test for renamed `assert_dirs_are_equal`许杰友 Jieyou Xu (Joe)-2/+2
2024-07-17tests: update for renamed `fs` module in run_make_support许杰友 Jieyou Xu (Joe)-239/+225
2024-07-17tests: update rustdoc test for renamed `assert_recursive_eq`许杰友 Jieyou Xu (Joe)-2/+2
2024-07-17Remove invalid further restricting for type boundyukang-33/+56
2024-07-17Auto merge of #127840 - tgross35:rollup-jfkg1dq, r=tgross35bors-0/+1
Rollup of 9 pull requests Successful merges: - #125206 (Simplify environment variable examples) - #126271 (Skip fast path for dec2flt when optimize_for_size) - #126776 (Clean up more comments near use declarations) - #127444 (`impl Send + Sync` and override `count` for the `CStr::bytes` iterator) - #127512 (Terminate `--print link-args` output with newline) - #127792 (std: Use `read_unaligned` for reads from DWARF) - #127807 (Use futex.rs for Windows thread parking) - #127833 (zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib`) - #127836 (std: Forbid unwrapped unsafe ops in xous and uefi modules) Failed merges: - #127813 (Prevent double reference in generic futex) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-17If the moved value is a mut reference, it is used in a generic function and ↵surechen-12/+55
it's type is a generic param, it can be reborrowed to avoid moving. for example: ```rust struct Y(u32); // x's type is '& mut Y' and it is used in `fn generic<T>(x: T) {}`. fn generic<T>(x: T) {} ``` fixes #127285
2024-07-16Rollup merge of #127512 - eggyal:newline-terminate-print-linkargs, ↵Trevor Gross-0/+1
r=compiler-errors Terminate `--print link-args` output with newline Fixes #127507
2024-07-17Auto merge of #126208 - Oneirical:one-flew-over-the-cuckoo's-test, r=jieyouxubors-61/+126
Migrate `compiler-lookup-paths`, `dump-mono-stats` and `prune-link-args` `run-make` tests to `rmake` or `ui` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: aarch64-apple try-job: dist-x86_64-linux try-job: armhf-gnu
2024-07-16Auto merge of #127831 - tgross35:rollup-c0j9n7b, r=tgross35bors-70/+298
Rollup of 7 pull requests Successful merges: - #124033 (Sync ar_archive_writer to LLVM 18.1.3) - #126699 (Delegation: support coercion for target expression) - #126762 (Deny keyword lifetimes pre-expansion) - #126967 (Promote the `wasm32-wasip2` target to Tier 2) - #127390 (Migrate `raw-dylib-inline-cross-dylib` and `raw-dylib-custom-dlltool` `run-make` tests to rmake) - #127501 (Invert infer `error_reporting` mod struture) - #127816 (Update method name to reflect changes to its internals) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-16Rollup merge of #127501 - compiler-errors:invert-infer-error-mod-struture, ↵Trevor Gross-1/+1
r=lcnr Invert infer `error_reporting` mod struture Parallel change to #127493, which moves `rustc_infer::infer::error_reporting` to `rustc_infer::error_reporting::infer`. After this, we should just be able to merge this into `rustc_trait_selection::error_reporting::infer`, and pull down `TypeErrCtxt` into that crate. 👍 r? lcnr
2024-07-16Rollup merge of #127390 - Oneirical:rough-testimation, r=jieyouxuTrevor Gross-42/+86
Migrate `raw-dylib-inline-cross-dylib` and `raw-dylib-custom-dlltool` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try: try-job: i686-mingw
2024-07-16Rollup merge of #126762 - compiler-errors:kw-lt, r=michaelwoeristerTrevor Gross-10/+53
Deny keyword lifetimes pre-expansion https://github.com/rust-lang/rust/pull/126452#issuecomment-2179464266 > Secondly, we confirmed that we're OK with moving the validation of keywords in lifetimes to pre-expansion from post-expansion. We similarly consider this a bug fix. While the breakage of the convenience feature of the with_locals crate that relies on this is unfortunate, and we wish we had not overlooked this earlier for that reason, we're fortunate that the breakage is contained to only one crate, and we're going to accept this breakage as the extra complexity we'd need to carry in the compiler to work around this isn't deemed worth it. T-lang considers it to be a bugfix to deny `'keyword` lifetimes in the parser, rather than during AST validation that only happens post-expansion. This has one breakage: https://github.com/rust-lang/rust/pull/126452#issuecomment-2171654756 This probably should get lang FCP'd just for consistency.
2024-07-16Rollup merge of #126699 - Bryanskiy:delegation-coercion, r=compiler-errorsTrevor Gross-17/+158
Delegation: support coercion for target expression (solves https://github.com/rust-lang/rust/issues/118212#issuecomment-2160723092) The implementation consist of 2 parts. Firstly, method call is generated instead of fully qualified call in AST->HIR lowering if there were no generic arguments or `Qpath` were provided. These restrictions are imposed due to the loss of information after desugaring. For example in ```rust trait Trait { fn foo(&self) {} } reuse <u8 as Trait>::foo; ``` We would like to generate such a code: ```rust fn foo<u8: Trait>(x: &u8) { x.foo(x) } ``` however, the signature is inherited during HIR analysis where `u8` was discarded. Then, we probe the single pre-resolved method. P.S In the future, we would like to avoid restrictions on the callee path by `Self` autoref/autoderef in fully qualified calls, but at the moment it didn't work out. r? `@petrochenkov`
2024-07-16rustdoc: add test cases for mile wide barMichael Howell-0/+16
2024-07-16build_native_static_lib with llvm_ar for run_make_supportOneirical-2/+10
2024-07-16rewrite prune-link-args to rmake formatOneirical-75/+66
2024-07-16rewrite dump-mono-stats to rmake formatOneirical-5/+12
2024-07-16rewrite compiler-lookup-paths to rmakeOneirical-44/+103
2024-07-16Auto merge of #126484 - Oneirical:test-in-peace, r=jieyouxu,kobzolbors-46/+83
Migrate `std-core-cycle`, `obey-crate-type-flag`, `mixing-libs` and `issue-18943` `run-make` tests to `rmake.rs` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-apple-1 try-job: x86_64-msvc try-job: aarch64-gnu
2024-07-16Deny keyword lifetimes pre-expansionMichael Goulet-10/+53
2024-07-16Delegation: support coercion for target expressionBryanskiy-17/+158
2024-07-16Fix the issue of invalid suggestion for a reference of iteratoryukang-8/+0
2024-07-16add test for issue 127590yukang-0/+87
2024-07-16Rollup merge of #127780 - compiler-errors:zip-args, r=jieyouxuTrevor Gross-20/+97
Make sure trait def ids match before zipping args in `note_function_argument_obligation` Fixes #126416 Fixes #127745 Didn't add both tests b/c I felt like it was unnecessary.
2024-07-16Rollup merge of #120990 - chenyukang:yukang-fix-120327-dbg, r=oli-obkTrevor Gross-0/+189
Suggest a borrow when using dbg Fixes #120327 r? ````@estebank````
2024-07-15rustdoc: make sidebar highlight cover whole click targetMichael Howell-2/+2
2024-07-15Move rustc_infer::infer::error_reporting to rustc_infer::error_reporting::inferMichael Goulet-1/+1
2024-07-15Auto merge of #127629 - tesuji:suggest-option-ref-unwrap_or, r=estebankbors-1/+85
Suggest using `map_or` when `Option<&T>::unwrap_or where T: Deref` fails Fix #127545 Split from https://github.com/rust-lang/rust/pull/127596#pullrequestreview-2171898588
2024-07-15Make sure trait def ids match before zipping args in ↵Michael Goulet-20/+97
note_function_argument_obligation