about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-05-23Rollup merge of #111579 - scottmcm:enum-as-signed, r=oli-obkDylan DPC-24/+176
Also assume wrap-around discriminants in `as` MIR building Resolves this FIXME: https://github.com/rust-lang/rust/blob/8d18c32b61476ed16dd15074e71be3970368d6d7/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs#L231 r? `@oli-obk`
2023-05-23Rollup merge of #111461 - oli-obk:crate_collision, r=petrochenkovDylan DPC-1/+1
Fix symbol conflict diagnostic mistakenly being shown instead of missing crate diagnostic This was a refactoring mistake in https://github.com/rust-lang/rust/pull/109213 fixes #111284
2023-05-23Fix symbol conflict diagnostic mistakenly being shown instead of missing ↵Oli Scherer-1/+1
crate diagnostic
2023-05-23Auto merge of #110204 - compiler-errors:new-solver-hir-typeck-hacks, r=lcnrbors-0/+38
Deal with unnormalized projections when structurally resolving types with new solver 1. Normalize types in `structurally_resolved_type` when the new solver is enabled 2. Normalize built-in autoderef targets in `Autoderef` when the new solver is enabled 3. Normalize-erasing-regions in `resolve_type` in writeback This is motivated by the UI test provided, which currently fails with: ``` error[E0609]: no field `x` on type `<usize as SliceIndex<[Foo]>>::Output` --> <source>:9:11 | 9 | xs[0].x = 1; | ^ ``` I'm pretty happy with the approach in (1.) and (2.) and think we'll inevitably need something like this in the long-term, but (3.) seems like a hack to me. It's a *lot* of work to add tons of new calls to every user of these typeck results though (mir build, late lints, etc). Happy to discuss further. r? `@lcnr`
2023-05-22Structurally normalize in the new solverMichael Goulet-0/+38
2023-05-22Auto merge of #111848 - Dylan-DPC:rollup-7jqydzg, r=Dylan-DPCbors-234/+193
Rollup of 6 pull requests Successful merges: - #111501 (MIR drive-by cleanups) - #111609 (Mark internal functions and traits unsafe to reflect preconditions) - #111612 (Give better error when collecting into `&[T]`) - #111756 (Rename `{drop,forget}_{copy,ref}` lints to more consistent naming) - #111843 (move lcnr to only review types stuff) - #111844 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-23Rollup merge of #111844 - GuillaumeGomez:migrate-gui-test-color-4, r=notriddleDylan DPC-3/+3
Migrate GUI colors test to original CSS color format I updated the `browser-ui-test` version because I fixed https://github.com/GuillaumeGomez/browser-UI-test/issues/507. If inside a function, the colors were not considered, preventing the second commit of this PR. Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-05-23Rollup merge of #111756 - Urgau:rename_drop_forget_copy_ref_lints, r=fee1-deadDylan DPC-101/+101
Rename `{drop,forget}_{copy,ref}` lints to more consistent naming This PR renames previous uplifted lints in https://github.com/rust-lang/rust/pull/109732 to more consistent naming. I followed the renaming done [here](https://github.com/rust-lang/rust/issues/53224) and also advocated in this [clippy issue](https://github.com/rust-lang/rust-clippy/issues/2845): - `drop_copy` to `dropping_copy_types` - `forget_copy` to `forgetting_copy_types` - `drop_ref` to `dropping_references` - `forget_ref` to `forgetting_references`
2023-05-23Rollup merge of #111612 - ChayimFriedman2:collect-into-slice-ref, r=petrochenkovDylan DPC-1/+17
Give better error when collecting into `&[T]` The detection of slice reference of `{integral}` in `rustc_on_unimplemented` is hacky, but a proper solution requires changing `FmtPrinter` to add a parameter to print integers as `{integral}` and I didn't want to change it just for `rustc_on_unimplemented`. I can do that if requested, though. I'm open to better wording; this is the best I could come up with.
2023-05-23Rollup merge of #111501 - WaffleLapkin:drivebycleanupuwu, r=oli-obkDylan DPC-129/+72
MIR drive-by cleanups Some random drive-by cleanups I did while working with MIR/THIR.
2023-05-22Auto merge of #111754 - lcnr:recursion-depth, r=matthewjasperbors-1/+75
fix recursion depth handling after confirmation fixes #111729 I think having to use `Obligation::with_depth` correctly everywhere is very hard because e.g. the nested obligations from `eq` currently do not have the correct obligation depth. The new solver [completely removes `recursion_depth` from obligations](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/traits/solve/struct.Goal.html) and instead tracks the depth in the solver itself which is far easier to get right. Moving the old solver towards this shouldn't be that hard but is probably somewhat annoying. r? `@matthewjasper`
2023-05-22Migrate GUI colors test to original CSS color formatGuillaume Gomez-3/+3
2023-05-22Auto merge of #111634 - marc0246:arc-new-uninit-bloat, r=thomccbors-0/+28
Fix duplicate `arcinner_layout_for_value_layout` calls when using the uninit `Arc` constructors What this fixes is the duplicate calls to `arcinner_layout_for_value_layout` seen here: https://godbolt.org/z/jr5Gxozhj The issue was discovered alongside #111603 but is otherwise unrelated to the duplicate `alloca`s, which remain unsolved. Everything I tried to solve said main issue has failed. As for the duplicate layout calculations, I also tried slapping `#[inline]` and `#[inline(always)]` on everything in sight but the only thing that worked in the end is to dedup the calls by hand.
2023-05-22Auto merge of #111824 - lukas-code:strike, r=notriddlebors-0/+6
rustdoc: include strikethrough in item summary Fixes https://github.com/rust-lang/rust/issues/111822. Since **bold** and *italic* are included, I don't see why ~~strikethrough~~ shouldn't be.
2023-05-21Auto merge of #111731 - MU001999:fix/issue-111727, r=cjgillotbors-0/+14
Keep only the trait when emitting the error for `MyTrait + 'a` Fixes #111727
2023-05-21rustdoc: include strikethrough in item summaryLukas Markeffsky-0/+6
2023-05-21Auto merge of #111820 - matthiaskrgr:rollup-9sb2lw9, r=matthiaskrgrbors-27/+111
Rollup of 5 pull requests Successful merges: - #111745 (Fix overflow in error emitter) - #111770 (Read beta version from the version file if building from a source tarball) - #111797 (Migrate GUI colors test to original CSS color format) - #111809 (Unset MIRI_BLESS for mir-opt-level 4 miri tests) - #111817 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-21Rollup merge of #111817 - GuillaumeGomez:migrate-gui-test-color-3, r=notriddleMatthias Krüger-18/+18
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-05-21Rollup merge of #111797 - GuillaumeGomez:migrate-gui-test-color-2, r=notriddleMatthias Krüger-9/+9
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ``@notriddle``
2023-05-21Rollup merge of #111745 - Badel2:emitter-add-overflow, r=compiler-errorsMatthias Krüger-0/+84
Fix overflow in error emitter Fix #109854 Close #94171 (was already fixed before but missing test) This bug happens when a multipart suggestion spans more than one line. The fix is to update the `acc` variable, which didn't handle the case when the text to remove spans multiple lines but the text to add spans only one line. Also, use `usize::try_from` instead of `as usize` to detect overflows earlier in the future, and point to the source of the overflow (the original issue points to a different place where this value is used, not where the overflow had happened). And finally add an `if start != end` check to avoid doing any extra work in case of empty ranges. Long explanation: Given this test case: ```rust fn generate_setter() { String::with_capacity( //~^ ERROR this function takes 1 argument but 3 arguments were supplied generate_setter, r#" pub(crate) struct Person<T: Clone> {} "#, r#""#, ); } ``` The compiler will try to convert that code into the following: ```rust fn generate_setter() { String::with_capacity( //~^ ERROR this function takes 1 argument but 3 arguments were supplied /* usize */, ); } ``` So it creates a suggestion with 3 separate parts: ``` // Replace "generate_setter" with "/* usize */" SubstitutionPart { span: fuzz_input.rs:4:5: 4:20 (#0), snippet: "/* usize */" } // Remove second arg (multiline string) SubstitutionPart { span: fuzz_input.rs:4:20: 7:3 (#0), snippet: "" } // Remove third arg (r#""#) SubstitutionPart { span: fuzz_input.rs:7:3: 8:11 (#0), snippet: "" } ``` Each of this parts gets a separate `SubstitutionHighlight` (this marks the relevant text green in a terminal, the values are 0-indexed so `start: 4` means column 5): ``` SubstitutionHighlight { start: 4, end: 15 } SubstitutionHighlight { start: 15, end: 15 } SubstitutionHighlight { start: 18446744073709551614, end: 18446744073709551614 } ``` The 2nd and 3rd suggestion are empty (start = end) because they only remove text, so there are no additions to highlight. But the 3rd span has overflowed because the compiler assumes that the 3rd suggestion is on the same line as the first suggestion. The 2nd span starts at column 20 and the highlight starts at column 16 (15+1), so that suggestion is good. But since the 3rd span starts at column 3, the result is `3 - 4`, or column -1, which turns into -2 with 0-indexed, and that's equivalent to `18446744073709551614 as isize`. With this fix, the resulting `SubstitutionHighlight` are: ``` SubstitutionHighlight { start: 4, end: 15 } SubstitutionHighlight { start: 15, end: 15 } SubstitutionHighlight { start: 15, end: 15 } ``` As expected. I guess ideally we shouldn't emit empty highlights when removing text, but I am too scared to change that.
2023-05-21Rename `forget_ref` lint to `forgetting_references`Urgau-14/+14
2023-05-21Rename `drop_ref` lint to `dropping_references`Urgau-35/+35
2023-05-21Rename `forget_copy` lint to `forgetting_copy_types`Urgau-14/+14
2023-05-21Rename `drop_copy` lint to `dropping_copy_types`Urgau-42/+42
2023-05-21Auto merge of #111424 - JakobDegen:inline-unsized, r=tmiaskobors-0/+65
Don't inline functions with unsized args Fixes #111355 . I have some ideas for how we can get this back in the future, out of scope for this PR though. r? `@cjgillot`
2023-05-21Migrate GUI colors test to original CSS color formatGuillaume Gomez-18/+18
2023-05-21Auto merge of #111697 - rcvalle:rust-cfi-fix-111510, r=bjorn3bors-48/+137
CFI: Fix encode_ty: unexpected Param(B/#1) Fixes #111510 and complements #106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
2023-05-21Auto merge of #111696 - lukas-code:offset-of-erase-regions-harder, ↵bors-3/+33
r=compiler-errors don't skip inference for type in `offset_of!` Fixes https://github.com/rust-lang/rust/issues/111678 by no longer skipping inference on the type in `offset_of!`. Simply erasing the regions the during writeback isn't enough and can cause ICEs. A test case for this is included. This reverts https://github.com/rust-lang/rust/pull/111661, because it becomes redundant, since inference already erases the regions.
2023-05-21Auto merge of #111675 - Urgau:fix-local-libs-for-native-static-libs, r=bjorn3bors-0/+43
Fix local libs not included when printing native static libs This PR fixes https://github.com/rust-lang/rust/issues/111643 by adding the local used libs to the printed `--print=native-static-libs` output. It seems that `--print=native-static-libs` doesn't have any test, so I added one. It's very simple and doesn't even tries to compile the result to a binary as I don't know how to handle external library linking in CI. (Note that https://github.com/rust-lang/rust/blob/master/tests/run-make/staticlib-dylib-linkage/Makefile does compile to a binary) r? `@bjorn3`
2023-05-20Don't inline functions with unsized argsJakob Degen-0/+65
2023-05-20Rollup merge of #111765 - GuillaumeGomez:migrate-gui-test-color, r=notriddleGuillaume Gomez-18/+18
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-05-20Rollup merge of #111726 - GuillaumeGomez:gui-test-migrate-color, r=notriddleGuillaume Gomez-11/+11
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ```@notriddle```
2023-05-20Migrate GUI colors test to original CSS color formatGuillaume Gomez-9/+9
2023-05-20don't skip inference for type in `offset_of!`Lukas Markeffsky-3/+33
2023-05-20Rollup merge of #111762 - bvanjoi:fix-111749, r=compiler-errorsDylan DPC-0/+30
fix: emit error when fragment is `MethodReceiverExpr` and items is empty Fixes https://github.com/rust-lang/rust/issues/111749
2023-05-20Rollup merge of #111665 - est31:offset_of_tests, r=WaffleLapkinDylan DPC-7/+330
Add more tests for the offset_of macro Implements what I [suggested in the tracking issue](https://github.com/rust-lang/rust/issues/106655#issuecomment-1535007205), plus some further improvements: * ensuring that offset_of!(Self, ...) works iff inside an impl block * ensuring that the output type is usize and doesn't coerce. this can be changed in the future, but if it is done, it should be a conscious decision * improving the privacy checking test * ensuring that generics don't let you escape the unsized check r? `````@WaffleLapkin`````
2023-05-20Rollup merge of #111652 - clubby789:self-import-improvement, r=compiler-errorsDylan DPC-1/+1
Better diagnostic for `use Self::..` Fixes #111627 cc `@petrochenkov,` you might have thoughts on a better way to handle this (https://github.com/rust-lang/rust/issues/63720#issuecomment-591597466)
2023-05-20Rollup merge of #111491 - compiler-errors:nested-fut-must-use, r=wesleywiserDylan DPC-13/+29
Dont check `must_use` on nested `impl Future` from fn Fixes (but does not close, per beta policy) #111484 Also fixes a `FIXME` left in the code about (presumably) false-positives on non-async `#[must_use] fn() -> impl Future` cases, though if that's not desirable to include in the beta backport then I can certainly revert it. Beta nominating as it fixes a beta ICE.
2023-05-19Fix overflow in error emitterBadel2-0/+84
2023-05-19Drive-by-cleanup: Don't emit `thir::ExprKind::NeverToAny` for `! -> !`Maybe Waffle-129/+72
2023-05-19Migrate GUI colors test to original CSS color formatGuillaume Gomez-18/+18
2023-05-19Keep only the trait when emitting the error for `MyTrait + 'a`Mu001999-0/+14
2023-05-19fix: emit error when fragment is `MethodReceiverExpr` and items is emptybohan-0/+30
2023-05-19Auto merge of #111641 - michaelwoerister:debugger-visualizer-fixes, r=cjgillotbors-3/+82
Fix dependency tracking for debugger visualizers This PR fixes dependency tracking for debugger visualizer files by changing the `debugger_visualizers` query to an `eval_always` query that scans the AST while it is still available. This way the set of visualizer files is already available when dep-info is emitted. Since the query is turned into an `eval_always` query, dependency tracking will now reliably detect changes to the visualizer script files themselves. TODO: - [x] perf.rlo - [x] Needs a bit more documentation in some places - [x] Needs regression test for the incr. comp. case Fixes https://github.com/rust-lang/rust/issues/111226 Fixes https://github.com/rust-lang/rust/issues/111227 Fixes https://github.com/rust-lang/rust/issues/111295 r? `@wesleywiser` cc `@gibbyfree`
2023-05-19Fix run-make/inrcemental-debugger-visualizer test for macOS.Michael Woerister-3/+1
2023-05-19add testlcnr-1/+75
2023-05-19Auto merge of #111590 - dtolnay:panictemporaries, r=bjorn3bors-4/+83
Shorten even more panic temporary lifetimes Followup to #104134. As pointed out by `@bjorn3` in https://github.com/rust-lang/rust/pull/104134#pullrequestreview-1425585948, there are other cases in the panic macros which would also benefit from dropping their non-Send temporaries as soon as possible, avoiding pointlessly holding them across an await point. For the tests added in this PR, here are the failures you get today on master without the macro changes in this PR: <details> <summary>tests/ui/macros/panic-temporaries-2018.rs</summary> ```console error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries-2018.rs:52:18 | LL | require_send(panic_display()); | ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries-2018.rs:35:31 | LL | f(panic!("{}", NOT_SEND)).await; | -------- ^^^^^- `NOT_SEND` is later dropped here | | | | | await occurs here, with `NOT_SEND` maybe used later | has type `NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries-2018.rs:48:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries-2018.rs:52:18 | LL | require_send(panic_display()); | ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send` | = help: within `NotSend`, the trait `Sync` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries-2018.rs:35:31 | LL | f(panic!("{}", NOT_SEND)).await; | ---------------------- ^^^^^- the value is later dropped here | | | | | await occurs here, with the value maybe used later | has type `&NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries-2018.rs:48:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries-2018.rs:53:18 | LL | require_send(panic_str()); | ^^^^^^^^^^^ future returned by `panic_str` is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries-2018.rs:40:36 | LL | f(panic!((NOT_SEND, "...").1)).await; | -------- ^^^^^- `NOT_SEND` is later dropped here | | | | | await occurs here, with `NOT_SEND` maybe used later | has type `NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries-2018.rs:48:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries-2018.rs:54:18 | LL | require_send(unreachable_display()); | ^^^^^^^^^^^^^^^^^^^^^ future returned by `unreachable_display` is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries-2018.rs:45:31 | LL | f(unreachable!(NOT_SEND)).await; | -------- ^^^^^- `NOT_SEND` is later dropped here | | | | | await occurs here, with `NOT_SEND` maybe used later | has type `NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries-2018.rs:48:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries-2018.rs:54:18 | LL | require_send(unreachable_display()); | ^^^^^^^^^^^^^^^^^^^^^ future returned by `unreachable_display` is not `Send` | = help: within `NotSend`, the trait `Sync` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries-2018.rs:45:31 | LL | f(unreachable!(NOT_SEND)).await; | ---------------------- ^^^^^- the value is later dropped here | | | | | await occurs here, with the value maybe used later | has type `&NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries-2018.rs:48:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: aborting due to 5 previous errors ``` </details> <details> <summary>tests/ui/macros/panic-temporaries.rs</summary> ```console error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries.rs:42:18 | LL | require_send(panic_display()); | ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries.rs:35:31 | LL | f(panic!("{}", NOT_SEND)).await; | -------- ^^^^^- `NOT_SEND` is later dropped here | | | | | await occurs here, with `NOT_SEND` maybe used later | has type `NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries.rs:38:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely --> tests/ui/macros/panic-temporaries.rs:42:18 | LL | require_send(panic_display()); | ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send` | = help: within `NotSend`, the trait `Sync` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> tests/ui/macros/panic-temporaries.rs:35:31 | LL | f(panic!("{}", NOT_SEND)).await; | ---------------------- ^^^^^- the value is later dropped here | | | | | await occurs here, with the value maybe used later | has type `&NotSend` which is not `Send` note: required by a bound in `require_send` --> tests/ui/macros/panic-temporaries.rs:38:25 | LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: aborting due to 2 previous errors ``` </details> r? bjorn3
2023-05-19Auto merge of #110100 - compiler-errors:no-infer-pred-must-hold, r=jackh726bors-2/+15
do not allow inference in `predicate_must_hold` (alternative approach) See the FCP description for more info, but tl;dr is that we should not return `EvaluatedToOkModuloRegions` if an obligation may hold only with some choice of inference vars being constrained. Attempts to solve this in the approach laid out by lcnr here: https://github.com/rust-lang/rust/pull/109558#discussion_r1147318134, rather than by eagerly replacing infer vars with placeholders which is a bit too restrictive. r? `@ghost`
2023-05-19Auto merge of #109602 - bvanjoi:fix-issue-109343, r=petrochenkovbors-0/+21
fix(resolve): replace bindings to dummy for unresolved imports close #109343 In #109343, `f` in `pub use f as g` points to: |namespace| binding| |-|-| |type| `external crate f`| |value| `None` | |macro| `None` | When resolve `value_ns` during `resolve_doc_links`, the value of the binding of single_import `pub use f as g` goes to `pub use inner::f`, and since it does not satisfy [!self.is_accessible_from(binding.vis, single_import.parent_scope.module)](https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/ident.rs#L971) and returns `Err(Undetermined)`, which eventually goes to `PathResult::Indeterminate => unreachable!`. This PR replace all namespace binding to `dummy_binding` for indeterminate import, so, the bindings of `pub use f as g` had been changed to followings after finalize: |namespace| binding| |-|-| |type| `dummy`| |value| `dummy` | |macro| `dummy` | r?`@petrochenkov`
2023-05-18Auto merge of #111345 - jyn514:cfg-release-caching, r=cjgillot,est31bors-0/+15
Only depend on CFG_VERSION in rustc_interface This avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`. cc https://github.com/rust-lang/rust/issues/76720 - this won't fix it, and I'm not suggesting we turn this on by default, but it will make it less painful for people who do have `omit-git-hash` on as a workaround.