about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-08-14Add GUI test for warning blocksGuillaume Gomez-0/+57
2023-08-14Auto merge of #114787 - compiler-errors:issue-114783, r=jackh726bors-0/+52
Select obligations before processing wf obligation in `compare_method_predicate_entailment` We need to select obligations before processing the WF obligation for the `IMPLIED_BOUNDS_ENTAILMENT` lint, since it skips over type variables. Fixes #114783 r? `@jackh726`
2023-08-13Auto merge of #114742 - compiler-errors:opaques-are-not-injective, r=aliemjaybors-7/+42
TAITs do not constrain generic params Fixes #108425 Not sure if I should rework those two failing tests. I guess `tests/ui/type-alias-impl-trait/coherence.rs` could just have the type parameter removed from it? IDK what `tests/ui/type-alias-impl-trait/coherence_generalization.rs` is even testing, though. r? `@aliemjay` cc `@lcnr` `@oli-obk` (when he's back from :palm_tree:)
2023-08-13Select obligations before processing wf obligation in ↵Michael Goulet-0/+52
compare_method_predicate_entailment
2023-08-13Rollup merge of #114777 - GuillaumeGomez:migrate-gui-test-color-32, r=notriddleGuillaume Gomez-26/+26
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-08-13Auto merge of #114758 - fmease:fix-nice-re-err-ice-gci, r=cjgillotbors-0/+29
Don't crash when reporting nice region errors for generic const items Fixes #114714.
2023-08-13Auto merge of #114757 - Urgau:transmute-with-invalid_reference_casting, r=est31bors-9/+26
Also consider `mem::transmute` with the `invalid_reference_casting` lint This PR extend the `invalid_reference_casting` lint with regard to the `std::mem::transmute` function. ``` error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell` --> $DIR/reference_casting.rs:27:16 | LL | let _num = &mut *std::mem::transmute::<_, *mut i32>(&num); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` *I encourage anyone reviewing this PR to do so [without whitespaces](https://github.blog/2011-10-21-github-secrets/#whitespace).*
2023-08-13Migrate GUI colors test to original CSS color formatGuillaume Gomez-26/+26
2023-08-13Auto merge of #114457 - lcnr:trait_ref_is_knowable-normalize, r=compiler-errorsbors-0/+103
normalize in `trait_ref_is_knowable` in new solver fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/51 Alternatively we could avoid normalizing the self type and do this at the end of the `assemble_candidates_via_self_ty` stack by splitting candidates into: - applicable without normalizing self type - applicable for aliases, even if they can be normalized - applicable for stuff which cannot get normalized further I don't think this would have any significant benefits and it also seems non-trivial to avoid normalizing only the self type in `trait_ref_is_knowable`. r? `@compiler-errors`
2023-08-13Auto merge of #114755 - GuillaumeGomez:migrate-gui-test-color-31, r=notriddlebors-63/+63
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-08-12normalize in `trait_ref_is_knowable` in new solverlcnr-0/+103
2023-08-12Auto merge of #114756 - matthiaskrgr:rollup-4m7l4p6, r=matthiaskrgrbors-67/+101
Rollup of 7 pull requests Successful merges: - #94455 (Partially stabilize `int_roundings`) - #114132 (Better Debug for Vars and VarsOs) - #114584 (E0277 nolonger points at phantom `.await`) - #114667 (Record binder for bare trait object in LifetimeCollectVisitor) - #114692 (downgrade `internal_features` to warn) - #114703 (Cover ParamConst in smir) - #114734 (Mark oli as "on vacation") r? `@ghost` `@rustbot` modify labels: rollup
2023-08-12Fix testsMichael Goulet-24/+21
Co-authored-by: Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
2023-08-12Opaques do not constrain generic paramsMichael Goulet-12/+50
2023-08-12Auto merge of #114710 - Urgau:fix-expect-dead_code-114557, r=cjgillotbors-0/+70
Respect `#[expect]` the same way `#[allow]` is with the `dead_code` lint This PR makes the `#[expect]` attribute being respected in the same way the `#[allow]` attribute is with the `dead_code` lint. The fix is much more involved than I would have liked (and it's not because I didn't tried!), because the implementation took advantage of the fact that firing a lint in a allow context is a nop (for the user, as the lint is suppressed) to not fire-it at all. And will it's fine for `#[allow]`, it definitively isn't for `#[expect]`, as the presence and absence of the lint is significant. So a big part of the PR is just adding the context information of whenever an item is on the worklist because of an `[allow]`/`#[expect]` or not. Fixes https://github.com/rust-lang/rust/issues/114557
2023-08-12Don't crash when reporting nice region errors for generic const itemsLeón Orell Valerian Liehr-0/+29
2023-08-12Also consider `transmute` with the `invalid_reference_casting` lintUrgau-9/+26
2023-08-12Rollup merge of #114667 - compiler-errors:issue-114664, r=davidtwcoMatthias Krüger-0/+64
Record binder for bare trait object in LifetimeCollectVisitor The `LifetimeCollectVisitor` had a bug where it was not recording the binder of bate trait objects. This was uncovered in #114487, when I changed opaque type lowering to ICE if it encountered a captured fresh lifetime with no def-id to map back to: https://github.com/rust-lang/rust/pull/114487/files#diff-ad0c15bbde97a607d4758ec7eaf88248be5d6b8ae084dfc84127f81e3f7a9bb4R1585 Fixes #114664
2023-08-12Rollup merge of #114584 - darklyspaced:master, r=cjgillotMatthias Krüger-67/+37
E0277 nolonger points at phantom `.await` fixes #113203
2023-08-12Migrate GUI colors test to original CSS color formatGuillaume Gomez-63/+63
2023-08-12Auto merge of #109356 - jackh726:issue-108544, r=lcnrbors-0/+38
Only check outlives goals on impl compared to trait Fixes #108544 r? `@compiler-errors`
2023-08-11Only check outlives goals on impl compared to traitJack Huey-0/+38
2023-08-11Auto merge of #114720 - scottmcm:better-sub, r=workingjubileebors-0/+34
Tell LLVM that the negation in `<*const T>::sub` cannot overflow Today it's just `sub` <https://rust.godbolt.org/z/8EzEPnMr5>; with this PR it's `sub nsw`.
2023-08-11Auto merge of #114672 - lenawanel:master, r=compiler-errorsbors-0/+15
make `typeid::typeid_itanium_cxx_abi::transform_ty` evaluate length in array types the ICE in https://github.com/rust-lang/rust/issues/114275 was caused by `transform_ty` in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs encountering an unevaluated const, while expecting it to already be evaluated.
2023-08-10Tell LLVM that the negation in `<*const T>::sub` cannot overflowScott McMurray-0/+34
Today it's just `sub` <https://rust.godbolt.org/z/8EzEPnMr5>; with this PR it's `sub nsw`.
2023-08-11Auto merge of #114718 - compiler-errors:rollup-1am5rpn, r=compiler-errorsbors-18/+303
Rollup of 7 pull requests Successful merges: - #114599 (Add impl trait declarations to SMIR) - #114622 (rustc: Move `crate_types` and `stable_crate_id` from `Session` to `GlobalCtxt`) - #114662 (Unlock trailing where-clauses for lazy type aliases) - #114693 (Remove myself from the review rotation) - #114694 (make the provisional cache slightly less broken) - #114705 (Add spastorino to mailmap) - #114712 (Fix a couple of bad comments) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-10Rollup merge of #114694 - lcnr:provisional-cache, r=compiler-errorsMichael Goulet-16/+217
make the provisional cache slightly less broken It is still broken for the following cycles: ```mermaid graph LR R["R: coinductive"] --> A["A: inductive"] R --> B["B: coinductive"] A --> B B --> R ``` the `R -> A -> B -> R` cycle should be considered to not hold, as it is mixed, but because we first put `B` into the cache from the `R -> B -> R` cycle which is coinductive, it does hold. This issue will also affect our new coinduction approach. Longterm cycles are coinductive as long as one step goes through an impl where-clause, see https://github.com/rust-lang/a-mir-formality/blob/f4fc5bae36ab1a9fefddd54e5ccffc5f671467ec/crates/formality-prove/src/prove/prove_wc.rs#L51-L62. Here we would first have a fully inductive cycle `R -> B -> R` which is then entered by a cycle with a coinductive step `R -> A -coinductive-> B -> R`. I don't know how to soundly implement a provisional cache for goals not on the stack without tracking all cycles the goal was involved in and whether they were inductive or not. We could then only use goals from the cache if the *inductivity?* of every cycle remained the same. This is a mess to implement. I therefore want to rip out the provisional cache entirely, but will wait with this until I talked about it with `@nikomatsakis.` r? `@compiler-errors`
2023-08-10Rollup merge of #114662 - fmease:lazy-ty-aliases-unlock-trailing-wcs, r=oli-obkMichael Goulet-2/+86
Unlock trailing where-clauses for lazy type aliases Allows trailing where-clauses on lazy type aliases and forbids[^1] leading ones. Completes #89122 (see section *Top-level type aliases*). `@rustbot` label F-lazy_type_alias r? `@oli-obk` [^1]: This is absolutely fine since lazy type aliases are only meant to be stabilized as part of a new edition.
2023-08-11Record binder for bare trait object in LifetimeCollectVisitorMichael Goulet-0/+64
2023-08-11Auto merge of #114507 - sebastiantoh:issue-114235, r=jackh726bors-0/+85
Add suggestion to quote inlined format argument as string literal Fixes #114235
2023-08-10Respect `#[expect]` the same way `#[allow]` is with the `dead_code` lintUrgau-0/+70
2023-08-10Auto merge of #114474 - estebank:missing-semi, r=compiler-errorsbors-1/+152
Detect missing `;` that parses as function call Fix #106515.
2023-08-10Unlock trailing where-clauses for lazy type aliasesLeón Orell Valerian Liehr-2/+86
2023-08-10Rollup merge of #114678 - MortenLohne:bugfix/hir-has-side-effects, ↵Matthias Krüger-4/+60
r=compiler-errors `Expr::can_have_side_effects()` is incorrect for struct/enum/array/tuple literals It would return 'false' unless *all* sub-expressions had side effects. This would easily allow side effects to slip through, and also wrongly label empty literals as having side effects. Add some tests for the last point The function is only used for simple lints and error messages, so not a serious bug.
2023-08-10add and move trait solver cycle testslcnr-1/+215
2023-08-10make the provisional cache slightly less brokenlcnr-15/+2
2023-08-10fix #114275lena-0/+15
this ICE was caused by `transform_ty` in compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs encountering an unevaluated const, while expecting it to already be evaluated. add a regression test Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs Co-authored-by: Michael Goulet <michael@errs.io> Update tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs Co-authored-by: Michael Goulet <michael@errs.io> fix test compiling for targets with -crt-static and failing this was causign https://github.com/rust-lang/rust/pull/114686 to fail
2023-08-10Bugfix: 'can_have_side_effects()' would return 'false' for ↵Morten Lohne-4/+60
struct/enum/array/tuple literals unless *all* sub-expressions had side effects. This would easily allow side effects to slip through, and also wrongly label empty literals as having side effects. Add some tests for the last point
2023-08-09Rollup merge of #114670 - compiler-errors:issue-114660, r=cjgillotMatthias Krüger-0/+10
Don't use `type_of` to determine if item has intrinsic shim When we're calling `resolve_instance` on an inline const, we were previously looking at the `type_of` for that const, seeing that it was an `extern "intrinsic"` fn def, and treating it as if we were computing the instance of that intrinsic itself. This is incorrect. Instead, we should be using the def-id of the item we're computing to determine if it's an intrinsic. Fixes #114660
2023-08-09Rollup merge of #114469 - estebank:arbitrary-self-types-mut-diff, r=davidtwcoMatthias Krüger-0/+207
Detect method not found on arbitrary self type with different mutability ``` error[E0599]: no method named `x` found for struct `Pin<&S>` in the current scope --> $DIR/arbitrary_self_type_mut_difference.rs:11:18 | LL | Pin::new(&S).x(); | ^ help: there is a method with a similar name: `y` | note: method is available for `Pin<&mut S>` --> $DIR/arbitrary_self_type_mut_difference.rs:6:5 | LL | fn x(self: Pin<&mut Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` Related to #57994, as one of the presented cases can lead to code like this.
2023-08-09Rollup merge of #111891 - rustbox:feat/riscv-isr-cconv, r=jackh726Matthias Krüger-56/+399
feat: `riscv-interrupt-{m,s}` calling conventions Similar to prior support added for the mips430, avr, and x86 targets this change implements the rough equivalent of clang's [`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling e.g. ```rust static mut CNT: usize = 0; pub extern "riscv-interrupt-m" fn isr_m() { unsafe { CNT += 1; } } ``` to produce highly effective assembly like: ```asm pub extern "riscv-interrupt-m" fn isr_m() { 420003a0: 1141 addi sp,sp,-16 unsafe { CNT += 1; 420003a2: c62a sw a0,12(sp) 420003a4: c42e sw a1,8(sp) 420003a6: 3fc80537 lui a0,0x3fc80 420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0> 420003ae: 0585 addi a1,a1,1 420003b0: 62b52e23 sw a1,1596(a0) } } 420003b4: 4532 lw a0,12(sp) 420003b6: 45a2 lw a1,8(sp) 420003b8: 0141 addi sp,sp,16 420003ba: 30200073 mret ``` (disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`) This outcome is superior to hand-coded interrupt routines which, lacking visibility into any non-assembly body of the interrupt handler, have to be very conservative and save the [entire CPU state to the stack frame][full-frame-save]. By instead asking LLVM to only save the registers that it uses, we defer the decision to the tool with the best context: it can more accurately account for the cost of spills if it knows that every additional register used is already at the cost of an implicit spill. At the LLVM level, this is apparently [implemented by] marking every register as "[callee-save]," matching the semantics of an interrupt handler nicely (it has to leave the CPU state just as it found it after its `{m|s}ret`). This approach is not suitable for every interrupt handler, as it makes no attempt to e.g. save the state in a user-accessible stack frame. For a full discussion of those challenges and tradeoffs, please refer to [the interrupt calling conventions RFC][rfc]. Inside rustc, this implementation differs from prior art because LLVM does not expose the "all-saved" function flavor as a calling convention directly, instead preferring to use an attribute that allows for differentiating between "machine-mode" and "superivsor-mode" interrupts. Finally, some effort has been made to guide those who may not yet be aware of the differences between machine-mode and supervisor-mode interrupts as to why no `riscv-interrupt` calling convention is exposed through rustc, and similarly for why `riscv-interrupt-u` makes no appearance (as it would complicate future LLVM upgrades). [clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v [full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469 [implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67 [callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37 [rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-08-09Rollup merge of #110435 - aDotInTheVoid:rdj-field-ordering, r=GuillaumeGomezMatthias Krüger-0/+154
rustdoc-json: Add test for field ordering. Inspired by [this on twitter](https://twitter.com/PredragGruevski/status/1647705616650043392), the ordering of fields really matters, so we should test we preserve it through json. r? rustdoc
2023-08-09Don't use type_of to determine if item has intrinsic shimMichael Goulet-0/+10
2023-08-09Suggest using `Arc` on `!Send`/`!Sync` typesEsteban Kuber-11/+209
2023-08-09Rollup merge of #114638 - compiler-errors:rpitit-test-revisions, r=spastorinoMatthias Krüger-1483/+0
Remove old RPITIT tests (revisions were removed) These tests were not cleaned up after #112988. r? `@spastorino`
2023-08-09Rollup merge of #114606 - bvanjoi:fix-113462, r=compiler-errorsMatthias Krüger-5/+27
fix: not insert missing lifetime for `ConstParamTy` Fixes #113462 We should ignore the missing lifetime, as it's illegal to include a lifetime in a const param. r? ``@compiler-errors``
2023-08-08fix(test): improve sensitivity of hygene testsSeth Pellegrino-11/+17
The change in 07f855d7817aa53af8adbb385407f6c2cacc2702 introduced a trailing numeral of some kind after the `extern crate compiler_builtins`, which appears to have caused at least two false negatives (654b924 and 657fd24). Instead, this change normalizes the test output to ignore the number (of symbols rustc recognizes?) to avoid needing to re-`--bless` these two tests for unrelated changes.
2023-08-08feat: `riscv-interrupt-{m,s}` calling conventionsSeth Pellegrino-45/+382
Similar to prior support added for the mips430, avr, and x86 targets this change implements the rough equivalent of clang's [`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling e.g. ```rust static mut CNT: usize = 0; pub extern "riscv-interrupt-m" fn isr_m() { unsafe { CNT += 1; } } ``` to produce highly effective assembly like: ```asm pub extern "riscv-interrupt-m" fn isr_m() { 420003a0: 1141 addi sp,sp,-16 unsafe { CNT += 1; 420003a2: c62a sw a0,12(sp) 420003a4: c42e sw a1,8(sp) 420003a6: 3fc80537 lui a0,0x3fc80 420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0> 420003ae: 0585 addi a1,a1,1 420003b0: 62b52e23 sw a1,1596(a0) } } 420003b4: 4532 lw a0,12(sp) 420003b6: 45a2 lw a1,8(sp) 420003b8: 0141 addi sp,sp,16 420003ba: 30200073 mret ``` (disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`) This outcome is superior to hand-coded interrupt routines which, lacking visibility into any non-assembly body of the interrupt handler, have to be very conservative and save the [entire CPU state to the stack frame][full-frame-save]. By instead asking LLVM to only save the registers that it uses, we defer the decision to the tool with the best context: it can more accurately account for the cost of spills if it knows that every additional register used is already at the cost of an implicit spill. At the LLVM level, this is apparently [implemented by] marking every register as "[callee-save]," matching the semantics of an interrupt handler nicely (it has to leave the CPU state just as it found it after its `{m|s}ret`). This approach is not suitable for every interrupt handler, as it makes no attempt to e.g. save the state in a user-accessible stack frame. For a full discussion of those challenges and tradeoffs, please refer to [the interrupt calling conventions RFC][rfc]. Inside rustc, this implementation differs from prior art because LLVM does not expose the "all-saved" function flavor as a calling convention directly, instead preferring to use an attribute that allows for differentiating between "machine-mode" and "superivsor-mode" interrupts. Finally, some effort has been made to guide those who may not yet be aware of the differences between machine-mode and supervisor-mode interrupts as to why no `riscv-interrupt` calling convention is exposed through rustc, and similarly for why `riscv-interrupt-u` makes no appearance (as it would complicate future LLVM upgrades). [clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v [full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469 [implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67 [callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37 [rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-08-09Auto merge of #114470 - ↵bors-0/+33
pnkfelix:dont-export-no-mangle-from-proc-macros-issue-99978, r=bjorn3 Restrict linker version script of proc-macro crates to just its two symbols Restrict linker version script of proc-macro crates to just the two symbols of each proc-macro crate. The main known effect of doing this is to stop including `#[no_mangle]` symbols in the linker version script. Background: The combination of a proc-macro crate with an import of another crate that itself exports a no_mangle function was broken for a period of time, because: * In PR #99944 we stopped exporting no_mangle symbols from proc-macro crates; proc-macro crates have a very limited interface and are meant to be treated as a blackbox to everything except rustc itself. However: he constructed linker version script still referred to them, but resolving that discrepancy was left as a FIXME in the code, tagged with issue #99978. * In PR #108017 we started telling the linker to check (via the`--no-undefined-version` linker invocation flag) that every symbol referenced in the "linker version script" is provided as linker input. So the unresolved discrepancy from #99978 started surfacing as a compile-time error (e.g. #111888). Fix #111888 Fix #99978.
2023-08-09rustdoc-json: Add tests for field/variant ordering.Alona Enraght-Moony-0/+154