about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
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-08Rollup merge of #114594 - compiler-errors:new-solver-resolve-aliases, r=lcnrMatthias Krüger-48/+47
Structurally normalize weak and inherent in new solver It seems pretty obvious to me that we should be normalizing weak and inherent aliases too, since they can always be normalized. This PR still leaves open the question of what to do with opaques, though 💀 **Also**, we need to structurally resolve the target of a coercion, for the UI test to work. r? `@lcnr`
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-0/+79
r=oli-obk Store the laziness of type aliases in their `DefKind` Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not. With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*: Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates. As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions. --- This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold. `@rustbot` label F-lazy_type_alias r? `@oli-obk`
2023-08-08Rollup merge of #114413 - CohenArthur:warn-macro-export-decl-macros, r=cjgillotMatthias Krüger-0/+25
Warn when #[macro_export] is applied on decl macros The existing code checks if `#[macro_export]` is being applied to an item other than a macro, and warns in that case, but fails to take into account macros 2.0/decl macros, despite the attribute having no effect on these macros. This PR adds a special case for decl macros with the aforementioned attribute, so that the warning is a bit more precise. Instead of just saying "this attribute has no effect", hint towards the fact that decl macros get exported and resolved like regular items. It also removes a `#[macro_export]` attribute which was applied on one of `core`'s decl macros. - core: Remove #[macro_export] from `debug_assert_matches` - check_attrs: Warn when #[macro_export] is used on macros 2.0
2023-08-07check_attrs: Warn when #[macro_export] is used on macros 2.0Arthur Cohen-0/+25
The compiler should emit a more specific error when the `#[macro_export]` attribute is present on a decl macro, instead of silently ignoring it. This commit adds the required error message in rustc_passes/messages.ftl, as well as a note. A new variant is added to the `errors::MacroExport` enum, specifically for the case where the attribute is added to a macro 2.0.
2023-08-07Resolve target type of coercionMichael Goulet-48/+47
2023-08-07Fix stack-protector.rs on LLVM 17Nikita Popov-0/+2
Prevent fill from being (correctly) optimized away by passing the address of the alloca to black_box.
2023-08-07Auto merge of #114585 - matthiaskrgr:rollup-h26pvus, r=matthiaskrgrbors-194/+58
Rollup of 9 pull requests Successful merges: - #113568 (Fix spurious test failure with `panic=abort`) - #114196 (Bubble up nested goals from equation in `predicates_for_object_candidate`) - #114485 (Add trait decls to SMIR) - #114495 (Set max_atomic_width for AVR to 16) - #114496 (Set max_atomic_width for sparc-unknown-linux-gnu to 32) - #114510 (llvm-wrapper: adapt for LLVM API changes) - #114562 (stabilize abi_thiscall) - #114570 ([miri][typo] Fix a typo in a vector_block comment.) - #114573 (CI: do not hide error logs in a group) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-07Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obkMatthias Krüger-188/+32
stabilize abi_thiscall Closes https://github.com/rust-lang/rust/issues/42202, stabilizing the use of the "thiscall" ABI. FCP was substituted by a poll, and the poll has been accepted.
2023-08-07Rollup merge of #114196 - compiler-errors:bubble-pls, r=lcnrMatthias Krüger-0/+20
Bubble up nested goals from equation in `predicates_for_object_candidate` This used to be needed for https://github.com/rust-lang/rust/pull/114036#discussion_r1273987510, but since it's no longer, I'm opening this as a separate PR. This also fixes one ICEing UI test: (`tests/ui/unboxed-closures/issue-53448.rs`) r? `@lcnr`
2023-08-07Rollup merge of #113568 - ferrocene:pa-spurious-weak-lang-item-2, r=b-naberMatthias Krüger-6/+6
Fix spurious test failure with `panic=abort` Description on why it happens and why the fix should work is in the code comments.
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-0/+79
2023-08-07change test to use `if black_box(false)`Pietro Albini-14/+6
2023-08-07Auto merge of #113902 - Enselic:lint-recursive-drop, r=oli-obkbors-0/+55
Make `unconditional_recursion` warning detect recursive drops Closes #55388 Also closes #50049 unless we want to keep it for the second example which this PR does not solve, but I think it is better to track that work in #57965. r? `@oli-obk` since you are the mentor for #55388 Unresolved questions: - [x] There are two false positives that must be fixed before merging (see diff). I suspect the best way to solve them is to perform analysis after drop elaboration instead of before, as now, but I have not explored that any further yet. Could that be an option? **Answer:** Yes, that solved the problem. `@rustbot` label +T-compiler +C-enhancement +A-lint
2023-08-07stabilize abi_thiscallBenedikt Radtke-188/+32
2023-08-07Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillotMatthias Krüger-2/+158
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly As discussed in #113435, this lets the backends be the place that can have the "don't call the function if n == 0" logic, if it's needed for the target. (I didn't actually *add* those checks, though, since as I understood it we didn't actually need them on known targets?) Doing this also let me make it `const` (unstable), which I don't think `extern "C" fn memcmp` can be. cc `@RalfJung` `@Amanieu`
2023-08-07Rollup merge of #114230 - workingjubilee:codegen-tests-that-nest, ↵Matthias Krüger-178/+0
r=Mark-Simulacrum Nest other codegen test topics This PR is like rust-lang/rust#114229 in that it mostly pushes codegen tests around, shoving them into their own directories, but because all of the changes are very simple cleanups I pulled them into a separate PR. The other PR might involve actually evaluating the correctness of the test after changes, but here it is mostly a matter of taste. The only "functional" change is deleting a few tests that... hinge on a version of LLVM that we don't support (as of rust-lang/rust#114148 anyways). I considered a few different ways to group other topics but I feel the question of whether `tests/codegen/{vec,array,slice}` should exist is more subtle than these choices, as it might be better to group such related tests by other topics like bounds check elision, thus I avoided making it.
2023-08-07Rollup merge of #114229 - workingjubilee:nest-sanitizer-dir, r=Mark-SimulacrumMatthias Krüger-54/+54
Nest tests/codegen/sanitizer*.rs tests in sanitizer dir The sanitizer tests are the largest and most meticulously tested set of tests in tests/codegen. That's good! They all clearly belong to a subject and thus could go in a directory, but are not, instead being placed simply in tests/codegen. That's bad! Fix this by placing them in their own directory and renaming them to be less repetitive after that move. A few tests are brittle, and embed their filename in the test's checks. This is acceptable for the ones where it is used only two times, but one test embeds the test's mangled filename in the test *over 50 times*! This may have been one of the things discouraging anyone from moving it, and thus from moving the set. Fortunately, I have some knowledge of Itanium mangling (involuntarily), regex, and the FileCheck syntax. With a capturing variable, FileCheck allows us to now move this test around again without diffing it on ~50 lines, while still guaranteeing that the mangled substring is the same each time. This also clarifies why the substring is repeated a zillion times, instead of being cryptic. They don't call it mangling because the result is pretty and easy to understand, but now it is slightly easier! Yay descriptive variables!
2023-08-07Rollup merge of #114093 - Enselic:stdin-unknown-mod, r=Mark-SimulacrumMatthias Krüger-0/+26
Add regression test for `echo 'mod unknown;' | rustc -` Closes #65601 The bug is fixed since long ago, probably by #69838 (see https://github.com/rust-lang/rust/issues/65601#issuecomment-1650508071 for more details). Add a regression test so we can close the issue.
2023-08-06Add a new `compare_bytes` intrinsic instead of calling `memcmp` directlyScott McMurray-2/+158
2023-08-07Rollup merge of #114558 - Enselic:lifetime-diagnostic-fixed, r=cjgillotMatthias Krüger-3/+1
Remove FIXME about NLL diagnostic that is already improved The FIXME was added in #46984 when the diagnostic message looked like this: // FIXME(#46983): error message should be better &s.0 //~ ERROR free region `` does not outlive free region `'static` The message was improved in #90667 and now looks like this: &s.0 //~ ERROR lifetime may not live long enough but the FIXME was not removed. The issue #46983 about that diagnostics should be improved has been closed. We can remove the FIXME now. (This PR was made for #44366.)
2023-08-07Rollup merge of #114543 - RalfJung:test-96944, r=compiler-errorsMatthias Krüger-0/+33
add tests for some fixed ConstProp ICEs Fixes https://github.com/rust-lang/rust/issues/96944 Fixes https://github.com/rust-lang/rust/issues/111353
2023-08-06Auto merge of #114553 - matthiaskrgr:rollup-5yddunv, r=matthiaskrgrbors-3/+3
Rollup of 5 pull requests Successful merges: - #114466 (Add Allocation to SMIR) - #114505 (Add documentation to has_deref) - #114519 (use offset_of! to calculate dirent64 field offsets) - #114537 (Migrate GUI colors test to original CSS color format) - #114539 (linkchecker: Remove unneeded FIXME about intra-doc links) Failed merges: - #114485 (Add trait decls to SMIR) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-06Remove FIXME about NLL diagnostic that is already improvedMartin Nordholts-3/+1
The FIXME was added in 46984 when the diagnostic message looked like this: // FIXME(#46983): error message should be better &s.0 //~ ERROR free region `` does not outlive free region `'static` The message was improved in 90667 and now looks like this: &s.0 //~ ERROR lifetime may not live long enough but the FIXME was not removed. The issue 46983 about that diagnostics should be improved has been closed. We can remove the FIXME now.
2023-08-06Rollup merge of #114537 - GuillaumeGomez:migrate-gui-test-color-29, r=notriddleMatthias Krüger-3/+3
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ``@notriddle``
2023-08-06add test for issue #111353Ralf Jung-0/+7
2023-08-06add test for issue #96944Ralf Jung-0/+26
2023-08-06don't replace opaque types under binders with infer varsAli MJ Al-Nasrawy-30/+26
2023-08-06Migrate GUI colors test to original CSS color formatGuillaume Gomez-3/+3
2023-08-06Rollup merge of #114509 - GuillaumeGomez:migrate-gui-test-color-28, r=notriddleMatthias Krüger-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-08-06Rollup merge of #114503 - ↵Matthias Krüger-0/+10
chenyukang:yukang-fix-114433-unused-qualifications, r=compiler-errors Remove invalid lint when there is a generic argument in prefix path Fixes #114433
2023-08-06Rollup merge of #114486 - Urgau:const-context-nan-suggestion-114471, ↵Matthias Krüger-5/+0
r=compiler-errors Avoid invalid NaN lint machine-applicable suggestion in const context This PR removes the machine-applicable suggestion in const context for the `invalid_nan_comparision` lint ~~and replace it with a simple help~~. Fixes https://github.com/rust-lang/rust/issues/114471
2023-08-06Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obkbors-0/+10
Fix missing dependency file with `-Zunpretty` This PR force the `output_filenames` to be run ~~in every early exits like~~ when using `-Zunpretty`, so to respect the `dep-info` flag. Fixes https://github.com/rust-lang/rust/issues/112898 r? `@oli-obk`
2023-08-05Avoid invalid NaN lint machine-applicable suggestion in const contextUrgau-5/+0
2023-08-05Auto merge of #114143 - Enselic:rename-issue-100605, r=eholkbors-13/+15
Rename tests/ui/issues/issue-100605.rs to ../type/option-ref-advice.rs The test is a regression test for a [bug ](https://github.com/rust-lang/rust/issues/100605) where the compiler gave bad advice for an `Option<&String>`. Rename the file appropriately. Part of #73494
2023-08-05Rename tests/ui/issues/issue-100605.rs to ../type/option-ref-advice.rsMartin Nordholts-13/+15
The test is a regression test for a bug where the compiler gave bad advice for an `Option<&String>`. Rename the file appropriately.
2023-08-05Auto merge of #114514 - matthiaskrgr:rollup-1rv4f3h, r=matthiaskrgrbors-0/+15
Rollup of 3 pull requests Successful merges: - #114029 (Explain more clearly why `fn() -> T` can't be `#[derive(Clone)]`) - #114248 (Make lint missing-copy-implementations honor negative `Copy` impls) - #114498 (Print tidy command with bless tidy check failure) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-05Rollup merge of #114248 - fmease:neg-copy-rules-out-missing-copy-impl, r=b-naberMatthias Krüger-0/+15
Make lint missing-copy-implementations honor negative `Copy` impls Fixes #101980. ``@rustbot`` label A-lint F-negative_impls
2023-08-05Auto merge of #109348 - cjgillot:issue-109146, r=petrochenkovbors-6/+26
Resolve visibility paths as modules not as types. Asking for a resolution with `opt_ns = Some(TypeNS)` allows path resolution to look for type-relative paths, leaving unresolved segments behind. However, for visibility paths we really need to look for a module, so we need to pass `opt_ns = None`. Fixes https://github.com/rust-lang/rust/issues/109146 r? `@petrochenkov`
2023-08-05Migrate GUI colors test to original CSS color formatGuillaume Gomez-6/+6
2023-08-05Remove invalid lint when there is a generic argument in prefix pathyukang-0/+10
2023-08-05Auto merge of #113734 - cjgillot:no-crate-lint, r=petrochenkovbors-152/+146
Convert builtin "global" late lints to run per module The compiler currently has 4 non-incremental lints: 1. `clashing_extern_declarations`; 2. `missing_debug_implementations`; 3. ~`unnameable_test_items`;~ changed by https://github.com/rust-lang/rust/pull/114414 4. `missing_docs`. Non-incremental lints get reexecuted for each compilation, which is slow. Moreover, those lints are allow-by-default, so run for nothing most of the time. This PR attempts to make them more incremental-friendly. `clashing_extern_declarations` is moved to a standalone query. `missing_debug_implementation` can use `non_blanket_impls_for_ty` instead of recomputing it. `missing_docs` is harder as it needs to track if there is a `doc(hidden)` module surrounding. I hack around this using the lint level engine. That's easy to implement and allows to re-enable the lint for a re-exported module, while a more proper solution would reuse the same device as `unnameable_test_items`.
2023-08-04Rollup merge of #114491 - ↵Michael Goulet-6/+6
sebastiantoh:add-context-to-issue-114423-test-names, r=compiler-errors Rename issue #114423 test files to include context Addresses feedback given in https://github.com/rust-lang/rust/pull/114461#discussion_r1284528863 r? `@estebank`
2023-08-04Rollup merge of #114490 - kernelmethod:error-reporting-typos, r=compiler-errorsMichael Goulet-1/+1
Fix a typo in the error reporting for sealed traits. Fixes a typo in error reporting: "implelement" -> "implement"
2023-08-04Rollup merge of #114475 - GuillaumeGomez:migrate-gui-test-color-27, r=notriddleMichael Goulet-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-08-04Rollup merge of #114287 - lcnr:overflow, r=compiler-errorsMichael Goulet-35/+185
update overflow handling in the new trait solver implements https://hackmd.io/QY0dfEOgSNWwU4oiGnVRLw?view. I want to clean up this doc and add it to the rustc-dev-guide, but I think this PR is ready for merge as is, even without the dev-guide entry. r? `@compiler-errors`
2023-08-05Rename issue #114423 test files to include contextSebastian Toh-6/+6
2023-08-05Fix a typo in the error reporting for sealed traits.kernelmethod-1/+1
2023-08-04Auto merge of #112117 - bryangarza:track-caller-feature-gate, r=compiler-errorsbors-51/+301
Add separate feature gate for async fn track caller This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately. Fixes #110009
2023-08-04Rollup merge of #114477 - estebank:arc-clone, r=compiler-errorsMatthias Krüger-1/+1
Account for `Rc` and `Arc` when suggesting to clone When suggesting to clone a reference-counted value, be less uncertain.