about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-09-11Duplicate output for test.Camille GILLOT-0/+491
2023-09-11Support CopyForDeref.Camille GILLOT-4/+8
2023-09-11Handle reading statics.Camille GILLOT-2/+190
2023-09-11Support non-scalar constants.Camille GILLOT-12/+122
2023-09-11Auto merge of #115308 - chenyukang:yukang-fix-62387-iter-mut, r=davidtwcobors-0/+233
suggest iter_mut() where trying to modify elements from .iter() Fixes https://github.com/rust-lang/rust/issues/115259 Fixes https://github.com/rust-lang/rust/issues/62387
2023-09-11Auto merge of #115387 - weihanglo:merge-check-and-lint, r=oli-obkbors-19/+185
Make unknown/renamed/removed lints passed via command line respect lint levels
2023-09-11Auto merge of #115661 - nnethercote:disentangle-Debug-Display, r=compiler-errorsbors-54/+423
Disentangle `Debug` and `Display` for `Ty`. The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `rustc_layout(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attributes) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-54/+423
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-10Auto merge of #115682 - notriddle:notriddle/impl-sidebar, r=GuillaumeGomezbors-0/+5
rustdoc: add impl items from aliased type into sidebar Follow-up of https://github.com/rust-lang/rust/pull/115201.
2023-09-10Auto merge of #115306 - tmiasko:encode-reachable-mir, r=cjgillotbors-1/+1
Encode only MIR reachable from other crates Only reachable items might participate in the code generation in the downstream crates. Omit redundant optimized MIR of unreachable items from a crate metadata. Additionally, include reachable closures in reachable set, so that unreachable closures can be omitted on the same basis.
2023-09-10Auto merge of #115731 - GuillaumeGomez:migrate-gui-test-color-40, r=notriddlebors-6/+6
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-09-10Migrate GUI colors test to original CSS color formatGuillaume Gomez-6/+6
2023-09-10Encode only MIR that can be used by other cratesTomasz Miąsko-1/+1
Only reachable items might participate in the code generation in the downstream crates. Omit redundant optimized MIR of unreachable items from a crate metadata. Additionally, include reachable closures in reachable set, so that unreachable closures can be omitted on the same basis.
2023-09-10Auto merge of #115712 - RalfJung:wf, r=compiler-errorsbors-117/+152
rustc_layout, rustc_abi: make sure the types are well-formed Fixes https://github.com/rust-lang/rust/issues/115676
2023-09-09Auto merge of #115698 - gurry:115143-ice-normalization-error, r=compiler-errorsbors-9/+25
Fix ICE in improper_ctypes_definitions lint Fix #115143
2023-09-09Auto merge of #115700 - GuillaumeGomez:migrate-gui-test-color-39, r=notriddlebors-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-09-09better spans for WF errorsRalf Jung-16/+20
2023-09-09use hir_crate_items(()).definitions() instead of hir().items()Ralf Jung-100/+100
2023-09-09rustc_layout, rustc_abi: make sure the types are well-formedRalf Jung-9/+40
2023-09-09Migrate GUI colors test to original CSS color formatGuillaume Gomez-9/+9
2023-09-09Fix ICE in improper_ctypes_definitions lintGurinder Singh-9/+25
The lint panicked for an input like 'extern "C" fn(Option<&<T as FooTrait>::FooType>)' because the type T therein cannot be normalized. The normalization failure caused SizeSkeleton::compute() to return an error and trigger a panic in the unwrap().
2023-09-08Auto merge of #115685 - matthiaskrgr:rollup-t31gowy, r=matthiaskrgrbors-11/+91
Rollup of 5 pull requests Successful merges: - #113807 (Tests crash from inappropriate use of common linkage) - #115358 (debuginfo: add compiler option to allow compressed debuginfo sections) - #115630 (Dont suggest use between `use` and cfg attr) - #115662 (Improve "associated type not found" diagnostics) - #115673 (Fix sanitize/cfg.rs test) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-09Rollup merge of #115673 - tmiasko:sanitizer-cfg, r=compiler-errorsMatthias Krüger-8/+8
Fix sanitize/cfg.rs test * Move needs-sanitizer conditions to specific revisions that require them (otherwise the conditions are mutually exclusive with needs-sanitizer-kcfi and test is always ignored). * Add missing revisions
2023-09-09Rollup merge of #115662 - ShE3py:E0220-note, r=compiler-errorsMatthias Krüger-3/+3
Improve "associated type not found" diagnostics ```rs use core::ops::Deref; fn foo<T>() where T: Deref<Output = u32> {} ``` Before: ``` error[E0220]: associated type `Output` not found for `Deref` --> E0220.rs:5:28 | 5 | fn foo<T>() where T: Deref<Output = u32> {} | ^^^^^^ associated type `Output` not found ``` After: ``` error[E0220]: associated type `Output` not found for `Deref` --> E0220.rs:5:28 | 5 | fn foo<T>() where T: Deref<Output = u32> {} | ^^^^^^ help: `Deref` has the following associated type: `Target` ``` --- `@rustbot` label +A-diagnostics +D-papercut
2023-09-09Rollup merge of #115630 - compiler-errors:dont-suggest-use-btw-use-and-attr, ↵Matthias Krüger-0/+45
r=wesleywiser Dont suggest use between `use` and cfg attr Fixes #115618
2023-09-09Rollup merge of #115358 - durin42:compress-debuginfo, r=oli-obkMatthias Krüger-0/+18
debuginfo: add compiler option to allow compressed debuginfo sections LLVM already supports emitting compressed debuginfo. In debuginfo=full builds, the debug section is often a large amount of data, and it typically compresses very well (3x is not unreasonable.) We add a new knob to allow debuginfo to be compressed when the matching LLVM functionality is present. Like clang, if a known-but-disabled compression mechanism is requested, we disable compression and emit uncompressed debuginfo sections. The API is different enough on older LLVMs we just pretend the support is missing on LLVM older than 16.
2023-09-09Rollup merge of #113807 - mojingran:master, r=WaffleLapkinMatthias Krüger-0/+17
Tests crash from inappropriate use of common linkage Follows up my proposal under the [tracking issue for the linkage feature](https://github.com/rust-lang/rust/issues/29603#issuecomment-1597662999). Adds test for [issue 109681](https://github.com/rust-lang/rust/issues/109681).
2023-09-08rustdoc: add impl items from aliased type into sidebarMichael Howell-0/+5
2023-09-08Auto merge of #115417 - dpaoliello:fixdi, r=wesleywiserbors-0/+28
Use the same DISubprogram for each instance of the same inlined function within a caller # Issue Details: The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this are inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together. When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location. As an example of this, consider the following program: ```rust #[no_mangle] fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 { let x1 = x.unwrap(); let y1 = y.unwrap(); x1 + y1 } ``` When building for x86_64 Windows using 1.72 it generates (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction): ```llvm .cv_loc 0 1 3 0 # src\lib.rs:3:0 addq $40, %rsp retq leaq .Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx leaq .Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17h12e60b9063f6dee8E int3 ``` # Fix Details: Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again. Ideally, we would also deduplicate child scopes and variables, however my attempt to do that with #114643 resulted in asserts when building for Linux (#115156) which would require some deep changes to Rust to fix (#115455). Instead, when using an inlined function as a debug scope, we will also create a new child scope such that subsequent child scopes and variables do not collide (from LLVM's perspective). After this change the above assembly now (with <https://reviews.llvm.org/D159226> as well) shows the `panic!` was inlined from `unwrap` in `option.rs` at line 935 into the current function in `lib.rs` at line 0 (line 0 is emitted since it is ambiguous which line to use as there were two inline sites that lead to this same code): ```llvm .cv_loc 0 1 3 0 # src\lib.rs:3:0 addq $40, %rsp retq .cv_inline_site_id 6 within 0 inlined_at 1 0 0 .cv_loc 6 2 935 0 # library\core\src\option.rs:935:0 leaq .Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx leaq .Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17hde1558f32d5b1c04E int3 ```
2023-09-08Auto merge of #115612 - cjgillot:const-prop-int, r=oli-obkbors-26/+1695
Improvements to dataflow const-prop Partially cherry-picked from https://github.com/rust-lang/rust/pull/110719 r? `@oli-obk` cc `@jachris`
2023-09-08tests: use warning output from rustc to catch missing compressionAugie Fackler-4/+2
Using `ld.lld` may have been clever, but that was getting the /system/ ld.lld, not one we may have built as part of building llvm. By using the warning message coming directly from rustc we now correctly skip the zlib and zstd tests when the support is missing.
2023-09-08debuginfo: add compiler option to allow compressed debuginfo sectionsAugie Fackler-0/+20
LLVM already supports emitting compressed debuginfo. In debuginfo=full builds, the debug section is often a large amount of data, and it typically compresses very well (3x is not unreasonable.) We add a new knob to allow debuginfo to be compressed when the matching LLVM functionality is present. Like clang, if a known-but-disabled compression mechanism is requested, we disable compression and emit uncompressed debuginfo sections. The API is different enough on older LLVMs we just pretend the support is missing on LLVM older than 16.
2023-09-08Auto merge of #115672 - GuillaumeGomez:rollup-mjiy56f, r=GuillaumeGomezbors-0/+96
Rollup of 6 pull requests Successful merges: - #104299 (Clarify stability guarantee for lifetimes in enum discriminants) - #115088 (Fix Step Skipping Caused by Using the `--exclude` Option) - #115201 (rustdoc: list matching impls on type aliases) - #115633 (Lint node for `PRIVATE_BOUNDS`/`PRIVATE_INTERFACES` is the item which names the private type) - #115638 (`-Cllvm-args` usability improvement) - #115643 (fix: return early when has tainted in mir-lint) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-08Fix sanitize/cfg.rs testTomasz Miąsko-8/+8
* Move needs-sanitizer conditions to specific revisions that require them (otherwise the conditions are mutually exclusive with needs-sanitizer-kcfi and test is always ignored). * Add missing revisions
2023-09-08Rollup merge of #115643 - bvanjoi:fix-115203, r=RalfJung,oli-obkGuillaume Gomez-0/+30
fix: return early when has tainted in mir-lint Fixes #115203 `a[..]` is of indeterminate size, it had been reported error during borrow check, therefore we skip the mir lint process.
2023-09-08Rollup merge of #115633 - compiler-errors:PRIVATE_BOUNDS-lint-node, ↵Guillaume Gomez-0/+7
r=petrochenkov Lint node for `PRIVATE_BOUNDS`/`PRIVATE_INTERFACES` is the item which names the private type The HIR that the `PRIVATE_BOUNDS` lint should be attached to is the item that has the *bounds*, not the private type. This PR also aligns this behavior with the `EXPORTED_PRIVATE_DEPENDENCIES` lint, which also requires putting the `allow` on the item that names the private type. Fixes #115475 r? petrochenkov
2023-09-08Rollup merge of #115201 - notriddle:notriddle/type-alias-impl-list, ↵Guillaume Gomez-0/+59
r=GuillaumeGomez rustdoc: list matching impls on type aliases Fixes https://github.com/rust-lang/rust/issues/32077 Fixes #99952 Remake of https://github.com/rust-lang/rust/pull/112429 Partially reverts https://github.com/rust-lang/rust/pull/112543, but keeps the test case. This version of the PR avoids the infinite loop by structurally matching types instead of using full unification. This version does not support type alias trait bounds, but the compiler does not enforce those anyway (https://github.com/rust-lang/rust/issues/21903). r? `@GuillaumeGomez` CC `@lcnr`
2023-09-08Auto merge of #115372 - RalfJung:abi-assert-eq, r=davidtwcobors-21/+904
add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees This new repr(transparent) test is super useful, it would have found https://github.com/rust-lang/rust/issues/115336 and found https://github.com/rust-lang/rust/issues/115404, https://github.com/rust-lang/rust/issues/115481, https://github.com/rust-lang/rust/issues/115509.
2023-09-08need to disable part of this test on armRalf Jung-1/+8
2023-09-08Auto merge of #113492 - nebulark:pr_96475, r=petrochenkovbors-0/+20
Add CL and CMD into to pdb debug info Partial fix for https://github.com/rust-lang/rust/issues/96475 The Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set within https://github.com/rust-lang/rust/blob/bb548f964572f7fe652716f5897d9050a31c936e/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L378 This causes LLVM to not neither output any compiler path (cl) nor the arguments that were used when invoking it (cmd) in the PDB file. This fix adds the missing information to the target machine so LLVM can use it.
2023-09-08add a testcase for another MIPS64 bugRalf Jung-0/+1
2023-09-08also ensure that size and alignment are the sameRalf Jung-3/+154
2023-09-08merge transparent-abi test into general abi compatibility test, and test ↵Ralf Jung-81/+42
repr(transparent) unions
2023-09-08add tests for RFC 3391Ralf Jung-0/+25
2023-09-08accept some differences for rustc_abi(assert_eq), so that we can test more ↵Ralf Jung-1/+373
things to be compatible
2023-09-08E0220: only suggests associated types if there's only one candidateLieselotte-24/+8
2023-09-08Rollup merge of #115649 - notriddle:notriddle/82038, r=compiler-errorsMatthias Krüger-0/+18
diagnostics: add test case for trait bounds diagnostic Closes #82038 It was fixed by https://github.com/rust-lang/rust/pull/89580, a wide-reaching obligation tracking improvement. This commit adds a test case.
2023-09-08Rollup merge of #115629 - compiler-errors:sugg-deref-unsize, r=oli-obkMatthias Krüger-2/+39
Don't suggest dereferencing to unsized type Rudimentary check that the self type is Sized. I don't really like any of this diagnostics code -- it's really messy and also really prone to false positives and negatives, but oh well. Fixes #115569
2023-09-08Rollup merge of #115624 - compiler-errors:rtn-path, r=WaffleLapkinMatthias Krüger-2/+64
Print the path of a return-position impl trait in trait when `return_type_notation` is enabled When we're printing a return-position impl trait in trait, we usually just print it like an opaque. This is *usually* fine, but can be confusing when using `return_type_notation`. Print the path of the method from where the RPITIT originates when this feature gate is enabled.
2023-09-08Rollup merge of #115604 - GuillaumeGomez:private-fields-tuple-struct, ↵Matthias Krüger-8/+23
r=notriddle rustdoc: Render private fields in tuple struct as `/* private fields */` Reopening of https://github.com/rust-lang/rust/pull/110552. All that was missing was a test for the different cases so I added it into the second commit. Description from the original PR: > I've gotten some feedback that the current rustdoc rendering of... > > ``` > struct HasPrivateFields(_); > ``` > > ...is confusing, and I agree with that feedback, especially compared to the field struct case: > > ``` > struct HasPrivateFields { /* private fields */ } > ``` > > So this PR makes it so that when all of the fields of a tuple variant are private, just render it with the `/* private fields */` comment. We can't *always* render it like that, for example when there's a mix of private and public fields. cc ````@jsha```` r? ````@notriddle````