about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-11-29Auto merge of #114841 - bvanjoi:fix-114814, r=cuviperbors-4/+81
add track_caller for arith ops Fixes #114814 `#[track_caller]` is works, r? `@scottmcm`
2023-11-28Auto merge of #118412 - matthiaskrgr:rollup-ghzhti2, r=matthiaskrgrbors-1/+1
Rollup of 6 pull requests Successful merges: - #118193 (Add missing period in `std::process::Command` docs) - #118222 (unify read_to_end and io::copy impls for reading into a Vec) - #118323 (give dev-friendly error message for incorrect config profiles) - #118378 (Perform LTO optimisations with wasm-ld + -Clinker-plugin-lto) - #118399 (Clean dead codes in miri) - #118410 (update test for new LLVM 18 codegen) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-28Rollup merge of #118410 - krasimirgg:llvm-18-test, r=nikicMatthias Krüger-1/+1
update test for new LLVM 18 codegen LLVM at HEAD now emits `or disjoint`: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24076#018c1596-8153-488e-b622-951266a02f6c/741-774
2023-11-28def collector: Set correct namespace in `DefPathData` for foreign typesVadim Petrochenkov-1/+1
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-2/+2
2023-11-28update test for new LLVM 18 codegenKrasimir Georgiev-1/+1
LLVM at HEAD now emits `or disjoint`: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24076#018c1596-8153-488e-b622-951266a02f6c/741-774
2023-11-28Auto merge of #118405 - matthiaskrgr:rollup-3a2eevc, r=matthiaskrgrbors-8/+35
Rollup of 7 pull requests Successful merges: - #115331 (optimize str::iter::Chars::advance_by) - #118236 (Update mod comment) - #118299 (Update `OnceLock` documentation to give a concrete 'lazy static' example, and expand on the existing example.) - #118314 (Rename `{collections=>alloc}{tests,benches}`) - #118341 (Simplify indenting in THIR printing) - #118366 (Detect and reject malformed `repr(Rust)` hints) - #118397 (Fix comments for unsigned non-zero `checked_add`, `saturating_add`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-28Rollup merge of #118366 - fmease:detect-reject-malformed-rust-repr, ↵Matthias Krüger-8/+35
r=compiler-errors Detect and reject malformed `repr(Rust)` hints Fixes #118334.
2023-11-28Auto merge of #118282 - fee1-dead-contrib:enforce-more, r=compiler-errorsbors-30/+75
effects: Run `enforce_context_effects` for all method calls So that we also perform checks when overloaded `PartialEq`s are called. r? `@compiler-errors`
2023-11-27Rollup merge of #118381 - Enselic:edit-dist-len, r=WaffleLapkinMichael Goulet-0/+13
rustc_span: Use correct edit distance start length for suggestions Otherwise the suggestions can be off-base for non-ASCII identifiers. For example suggesting that `Ok` is a name similar to `读文`. Closes https://github.com/rust-lang/rust/issues/72553.
2023-11-27Rollup merge of #118202 - azhogin:azhogin/link_args_wrapping, r=petrochenkovMichael Goulet-0/+9
Added linker_arg(s) Linker trait methods for link-arg to be prefixed "-Wl," for cc-like linker args and not verbatim https://github.com/rust-lang/rust/issues/99427#issuecomment-1234443468 > here's one possible improvement to -l link-arg making it more portable between linkers and useful - befriending it with the verbatim modifier (https://github.com/rust-lang/rust/issues/99425). > > -l link-arg:-verbatim=-foo would add -Wl,-foo (or equivalent) when C compiler is used as a linker, and just -foo when bare linker is used. > -l link-arg:+verbatim=-bar on the other hand would always pass just -bar.
2023-11-27Rollup merge of #117526 - estebank:issue-24157, r=b-naberMichael Goulet-0/+37
Account for `!` arm in tail `match` expr On functions with a default return type that influences the coerced type of `match` arms, check if the failing arm is actually of type `!`. If so, suggest changing the return type so the coercion against the prior arms is successful. ``` error[E0308]: `match` arms have incompatible types --> $DIR/match-tail-expr-never-type-error.rs:9:13 | LL | fn bar(a: bool) { | - help: try adding a return type: `-> i32` LL | / match a { LL | | true => 1, | | - this is found to be of type `{integer}` LL | | false => { LL | | never() | | ^^^^^^^ | | | | | expected integer, found `()` | | this expression is of type `!`, but it get's coerced to `()` due to its surrounding expression LL | | } LL | | } | |_____- `match` arms have incompatible types ``` Fix #24157.
2023-11-27Rollup merge of #111133 - hkmatsumoto:handle-python-slicing, r=TaKO8KiMichael Goulet-0/+20
Detect Python-like slicing and suggest how to fix Fix #108215
2023-11-27Auto merge of #117947 - Dirbaio:drop-llvm-15, r=cuviperbors-46/+1
Update the minimum external LLVM to 16. With this change, we'll have stable support for LLVM 16 and 17. For reference, the previous increase to LLVM 15 was #114148 [Relevant zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/riscv.20forced-atomics)
2023-11-27Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkinbors-1/+0
Don't add redundant help for object safety violations Fixes #117186 r? WaffleLapkin
2023-11-27rustc_span: Use correct edit distance start length for suggestionsMartin Nordholts-0/+13
Otherwise the suggestions can be off-base for non-ASCII identifiers. For example suggesting that `Ok` is a name similar to `读文`.
2023-11-27Auto merge of #118118 - spastorino:do-not-erase-late-bound-regions-on-iat, ↵bors-1/+24
r=compiler-errors Do not erase late bound regions when selecting inherent associated types In the fix for #97156 we would want the following code: ```rust #![feature(inherent_associated_types)] #![allow(incomplete_features)] struct Foo<T>(T); impl Foo<fn(&'static ())> { type Assoc = u32; } trait Other {} impl Other for u32 {} // FIXME(inherent_associated_types): Avoid emitting two diagnostics (they only differ in span). // FIXME(inherent_associated_types): Enhancement: Spruce up the diagnostic by saying something like // "implementation is not general enough" as is done for traits via // `try_report_trait_placeholder_mismatch`. fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} //~^ ERROR mismatched types //~| ERROR mismatched types fn main() {} ``` to fail with ... ``` error[E0220]: associated type `Assoc` not found for `Foo<for<'a> fn(&'a ())>` in the current scope --> tests/ui/associated-inherent-types/issue-109789.rs:18:36 | 4 | struct Foo<T>(T); | ------------- associated item `Assoc` not found for this struct ... 18 | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | ^^^^^ associated item not found in `Foo<for<'a> fn(&'a ())>` | = note: the associated type was found for - `Foo<fn(&'static ())>` error: aborting due to previous error For more information about this error, try `rustc --explain E0220`. ``` This PR fixes the ICE we are currently getting "was a subtype of Foo<Binder(fn(&ReStatic ()), [])> during selection but now it is not" Also fixes #112631 r? `@lcnr`
2023-11-27Account for `!` arm in tail `match` exprEsteban Küber-0/+37
On functions with a default return type that influences the coerced type of `match` arms, check if the failing arm is actually of type `!`. If so, suggest changing the return type so the coercion against the prior arms is successful. ``` error[E0308]: `match` arms have incompatible types --> $DIR/match-tail-expr-never-type-error.rs:9:13 | LL | fn bar(a: bool) { | - help: try adding a return type: `-> i32` LL | / match a { LL | | true => 1, | | - this is found to be of type `{integer}` LL | | false => { LL | | never() | | ^^^^^^^ | | | | | expected integer, found `()` | | this expression is of type `!`, but it get's coerced to `()` due to its surrounding expression LL | | } LL | | } | |_____- `match` arms have incompatible types ``` Fix #24157.
2023-11-27Added linker_arg(s) Linker trait methods for link-arg to be prefixed "-Wl," ↵Andrew Zhogin-0/+9
for cc-like linker args and not verbatim
2023-11-27Rollup merge of #118359 - hkmatsumoto:suggest-box-ref, r=TaKO8KiTakayuki Maeda-0/+36
Suggest swapping the order of `ref` and `box` It is not valid grammar to write `ref box <ident>` in patterns, but `box ref <ident>` is. This patch adds a diagnostic to suggest swapping them, analogous to what we do for `mut let`.
2023-11-27Change help message to make some sense in broader contextHirochika Matsumoto-2/+2
2023-11-27Address review feedbacksHirochika Matsumoto-7/+1
Also addressed merge conflicts upon rebasing.
2023-11-27Make tidy test happyHirochika Matsumoto-1/+1
2023-11-27Detect Python-like slicing and suggest how to fixHirochika Matsumoto-0/+26
Fix #108215
2023-11-27Suggest swapping the order of `ref` and `box`Hirochika Matsumoto-0/+36
2023-11-27Detect and reject malformed repr(Rust) hintsLeón Orell Valerian Liehr-8/+35
2023-11-27make const tests independent of std debug assertionsRalf Jung-232/+112
2023-11-26don't add redundant help for object safety violationsRyan Mehri-1/+0
2023-11-26Auto merge of #110303 - nbdd0121:master, r=Mark-Simulacrumbors-242/+237
Add `debug_assert_nounwind` and convert `assert_unsafe_precondition` `assert_unsafe_precondition` checks non-CTFE-evaluable conditions in runtime and performs no-op in compile time, while many of its current usage can be checked during const eval.
2023-11-26Auto merge of #118300 - compiler-errors:rollup-cm3i8fg, r=compiler-errorsbors-370/+358
Rollup of 7 pull requests Successful merges: - #117651 (coverage: Simplify building coverage expressions based on sums) - #117968 (Stabilize `ptr::addr_eq`) - #118158 (Reduce fluent boilerplate) - #118201 (Miscellaneous `ObligationCauseCode` cleanups) - #118288 (Use `is_{some,ok}_and` more in the compiler) - #118289 (`is_{some,ok}_and` for rustdoc) - #118290 (Don't ICE when encountering placeholders in implied bounds computation) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-26Bless MIR testsGary Guo-128/+120
2023-11-26Auto merge of #117611 - Nadrieril:linear-pass-take-4, r=cjgillotbors-238/+281
Rewrite exhaustiveness in one pass This is at least my 4th attempt at this in as many years x) Previous attempts were all too complicated or too slow. But we're finally here! The previous version of the exhaustiveness algorithm computed reachability for each arm then exhaustiveness of the whole match. Since each of these steps does roughly the same things, this rewrites the algorithm to do them all in one go. I also think this makes things much simpler. I also rewrote the documentation of the algorithm in depth. Hopefully it's up-to-date and easier to follow now. Plz comment if anything's unclear. r? `@oli-obk` I think you're one of the rare other people to understand the exhaustiveness algorithm? cc `@varkor` I know you're not active anymore, but if you feel like having a look you might enjoy this :D Fixes https://github.com/rust-lang/rust/issues/79307
2023-11-25Fix testsGary Guo-114/+117
2023-11-25Rollup merge of #118290 - compiler-errors:placeholder-implied, r=aliemjayMichael Goulet-0/+14
Don't ICE when encountering placeholders in implied bounds computation I *could* fix this the right way, though I don't really want to think about the implications of the change. This should have minimal side-effects. r? `@aliemjay` Fixes #118286
2023-11-25Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, ↵Michael Goulet-270/+244
r=compiler-errors Reduce fluent boilerplate Best reviewed one commit at a time. r? `@davidtwco`
2023-11-25Rollup merge of #117651 - Zalathar:fold-sums, r=cjgillotMichael Goulet-100/+100
coverage: Simplify building coverage expressions based on sums This is a combination of some interlinked changes to the code that creates coverage counters/expressions for nodes and edges in the coverage graph: - Some preparatory cleanups in `MakeBcbCounters::make_branch_counters` - Use `BcbCounter` (instead of `CovTerm`) when building coverage expressions - This makes it easier to introduce a fold for building sums - Simplify the creation of coverage expressions based on sums, by having `Iterator::fold` do much of the work - Get rid of the awkward `BcbBranch` enum, and replace it with graph edges represented as `(from_bcb, to_bcb)` - This further simplifies the body of the fold
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-269/+243
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+1
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-25Get rid of infer vars in inherent assoc types selection by using probeSantiago Pastorino-0/+14
2023-11-25Auto merge of #118294 - GuillaumeGomez:rollup-ij2bzwt, r=GuillaumeGomezbors-0/+24
Rollup of 6 pull requests Successful merges: - #116446 (Yeet `mir::Const::from_anon_const`) - #117871 (remove unused pub fns) - #118017 (rustc_lint: address latent TODO) - #118199 (Remove `HirId` from `QPath::LangItem`) - #118272 (resolve: Avoid clones of `MacroData`) - #118291 (rustdoc-search: clean up some DOM code) Failed merges: - #118201 (Miscellaneous `ObligationCauseCode` cleanups) - #118256 (rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` cleanup) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-25Do not erase late bound regions, replace them with placeholdersSantiago Pastorino-1/+10
2023-11-25make sure we still eagerly emit errorsMichael Goulet-0/+24
2023-11-25Don't ICE when encountering placeholders in implied bounds computationMichael Goulet-0/+14
2023-11-25Auto merge of #118127 - RalfJung:unadjusted-abi, r=compiler-errorsbors-0/+54
the unadjusted ABI needs to pass aggregates by-value Fixes https://github.com/rust-lang/rust/issues/118124, a regression introduced in https://github.com/rust-lang/rust/pull/117500
2023-11-25effects: Run `enforce_context_effects` for all method callsDeadbeef-30/+75
2023-11-25Auto merge of #118277 - fmease:rollup-itucldm, r=fmeasebors-0/+44
Rollup of 9 pull requests Successful merges: - #118220 (general improvements/fixes on bootstrap) - #118251 (rustdoc-search: avoid infinite where clause unbox) - #118253 (Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`) - #118255 (Request that rust-analyzer changes are sent upstream first if possible) - #118259 (Move EagerResolution to rustc_infer::infer::resolve) - #118262 (Relate Inherent Associated Types using eq) - #118266 (Move stuff around on `stable_mir` and `rustc_smir` crate) - #118271 (Separate `NaN`/`Inf` floats with `_`) - #118274 (Fix smir's `Ty::Ref` pretty printing) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-25Rollup merge of #118251 - notriddle:notriddle/less-recursion, r=GuillaumeGomezLeón Orell Valerian Liehr-0/+44
rustdoc-search: avoid infinite where clause unbox Fixes #118242
2023-11-25Auto merge of #118075 - tmiasko:validate-critical-call-edges, r=cjgillotbors-0/+31
Validate there are no critical call edges in optimized MIR
2023-11-25coverage: Simplify building coverage expressions based on sumsZalathar-100/+100
In some cases we need to prepare a coverage expression that is the sum of an arbitrary number of other terms. This patch simplifies the code paths that build those sums. This causes some churn in the mappings, because the previous code was building its sums in a somewhat idiosyncratic order.
2023-11-24Auto merge of #118138 - Nilstrieb:one-previous-error, r=WaffleLapkinbors-5154/+5161
Fixes error count display is different when there's only one error left Supersedes #114759 ### What did I do? I did the small change in `rustc_errors` by hand. Then I did the other changes in `/compiler` by hand, those were just find replace on `*.rs` in the workspace. The changes in run-make are find replace for `run-make` in the workspace. All other changes are blessed using `x test TEST --bless`. I blessed the tests that were blessed in #114759. ### how to review this nightmare ping bors with an `r+`. You should check that my logic is sound and maybe quickly scroll through the diff, but fully verifying it seems fairly hard to impossible. I did my best to do this correctly. Thank you `@adrianEffe` for bringing this up and your initial implementation. cc `@flip1995,` you said you want to do a subtree sync asap cc `@RalfJung` maybe you want to do a quick subtree sync afterwards as well for Miri r? `@WaffleLapkin`