about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-01-13Auto merge of #117285 - joboet:move_platforms_to_pal, r=ChrisDentonbors-2/+2
Move platform modules into `sys::pal` This is the initial step of #117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
2024-01-13Auto merge of #119871 - nnethercote:overhaul-treat-err-as-bug, r=compiler-errorsbors-27/+28
Overhaul `-Ztreat-err-as-bug` It's current behaviour is surprising, in a bad way. This also makes the implementation more complex than it needs to be. r? `@oli-obk`
2024-01-13Auto merge of #119473 - Urgau:check-cfg-explicit-none, r=petrochenkovbors-4/+88
Add explicit `none()` value variant in check-cfg This PR adds an explicit none value variant in check-cfg values: `values(none())`. Currently the only way to define the none variant is with an empty `values()` which means that if someone has a cfg that takes none and strings they need to use two invocations: `--check-cfg=cfg(foo) --check-cfg=cfg(foo, values("bar"))`. Which would now be `--check-cfg=cfg(foo, values(none(),"bar"))`, this is simpler and easier to understand. `--check-cfg=cfg(foo)`, `--check-cfg=cfg(foo, values())` and `--check-cfg=cfg(foo, values(none()))` would be equivalent. *Another motivation for doing this is to make empty `values()` actually means no-values, but this is orthogonal to this PR and adding `none()` is sufficient in it-self.* `@rustbot` label +F-check-cfg r? `@petrochenkov`
2024-01-13Auto merge of #118947 - Bryanskiy:delegStep1, r=petrochenkov,lcnrbors-9/+809
Delegation implementation: step 1 See https://github.com/rust-lang/rust/issues/118212 for more details. r? `@petrochenkov`
2024-01-13Auto merge of #118924 - Urgau:check-cfg-exclude-well-known-from-diag, ↵bors-35/+0
r=petrochenkov Exclude well known names from showing a suggestion in check-cfg This PR adds an exclusion for well known names from showing in suggestions of check-cfg/`unexpected_cfgs`. Follow-up to https://github.com/rust-lang/rust/pull/118213 and fixes https://github.com/rust-lang/rust/pull/118213#issuecomment-1854189934. r? `@petrochenkov`
2024-01-13Don't consider delayed bugs for `-Ztreat-err-as-bug`.Nicholas Nethercote-27/+28
`-Ztreat-err-as-bug` treats normal errors and delayed bugs equally, which can lead to some really surprising results. This commit changes `-Ztreat-err-as-bug` so it ignores delayed bugs, unless they get promoted to proper bugs and are printed. This feels to me much simpler and more logical. And it simplifies the implementation: - The `-Ztreat-err-as-bug` check is removed from in `DiagCtxt::{delayed_bug,span_delayed_bug}`. - `treat_err_as_bug` doesn't need to count delayed bugs. - The `-Ztreat-err-as-bug` panic message is simpler, because it doesn't have to mention delayed bugs. Output of delayed bugs is now more consistent. They're always printed the same way. Previously when they triggered `-Ztreat-err-as-bug` they would be printed slightly differently, via `span_bug` in `span_delayed_bug` or `delayed_bug`. A minor behaviour change: the "no errors encountered even though `span_delayed_bug` issued" printed before delayed bugs is now a note rather than a bug. This is done so it doesn't get counted as an error that might trigger `-Ztreat-err-as-bug`, which would be silly. This means that if you use `-Ztreat-err-as-bug=1` and there are no normal errors but there are delayed bugs, the first delayed bug will be shown (and the panic will happen after it's printed). Also, I have added a second note saying "those delayed bugs will now be shown as internal compiler errors". I think this makes it clearer what is happening, because the whole concept of delayed bugs is non-obvious. There are some test changes. - equality-in-canonical-query.rs: Minor output changes, and the error count reduces by one because the "no errors encountered even though `span_delayed_bug` issued" message is no longer counted as an error. - rpit_tait_equality_in_canonical_query.rs: Ditto. - storage-live.rs: The query stack disappears because these delayed bugs are now printed at the end, rather than when they are created. - storage-return.rs, span_delayed_bug.rs: now need `-Zeagerly-emit-delayed-bugs` because they need the delayed bugs emitted immediately to preserve behaviour.
2024-01-12Auto merge of #117321 - chenyukang:yukang-fix-117142, r=petrochenkovbors-0/+19
Fix unused_parens issue when cast is followed LT Fixes #117142 The original check only checks `a as (i32) < 0`, this fix extends it to handle `b + a as (i32) < 0`. A better way is maybe we suggest `(a as i32) < 0` instead of suppressing the warning, maybe following PR could improve it.
2024-01-12Auto merge of #119452 - ↵bors-0/+83
AngelicosPhosphoros:make_nonzeroint_get_assume_nonzero, r=scottmcm Add assume into `NonZeroIntX::get` LLVM currently don't support range metadata for function arguments so it fails to optimize non zero integers using their invariant if they are provided using by-value function arguments. Related to https://github.com/rust-lang/rust/issues/119422 Related to https://github.com/llvm/llvm-project/issues/76628 Related to https://github.com/rust-lang/rust/issues/49572
2024-01-12Exclude well known names from showing a suggestion in check-cfgUrgau-35/+0
2024-01-12Rollup merge of #119885 - DianQK:revert-pr-113923, r=petrochenkovGuillaume Gomez-113/+9
Revert #113923 Per [#t-compiler/meetings > [weekly] 2024-01-11](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11) discussion, revert #113923. Also revert associated #118568. The PR #113923 causes the regression issue #118609. We need more time to find a proper solution. Discussions start at [412365838](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412365838) and continue to [412369643](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412369643). Fixes #118609. r? compiler
2024-01-12Rollup merge of #119884 - GuillaumeGomez:rename-env-opt, r=davidtwcoGuillaume Gomez-6/+6
Rename `--env` option flag to `--env-set` As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Stabilizing.20.60--env.60.20option.20flag.3F). We rename `--env` to not conflicting names with the [RFC](https://github.com/rust-lang/rfcs/pull/2794). r? `@davidtwco`
2024-01-12Rollup merge of #119872 - compiler-errors:eagerly-emit-delayed-bugs, ↵Guillaume Gomez-0/+39
r=oli-obk,nnethercote Give me a way to emit all the delayed bugs as errors (add `-Zeagerly-emit-delayed-bugs`) This is probably a *better* way to inspect all the delayed bugs in a program that what exists currently (and therefore makes it very easy to choose the right number `N` with `-Zemit-err-as-bug=N`, though I guess the naming is a bit ironic when you pair both of the flags together, but that feels like naming bikeshed more than anything). This pacifies my only concern with https://github.com/rust-lang/rust/pull/119871#issuecomment-1888170259, because (afaict?) that PR doesn't allow you to intercept a delayed bug's stack trace anymore, which as someone who debugs the compiler a lot, is something that I can *promise* that I do. r? `@nnethercote` or `@oli-obk`
2024-01-12Rollup merge of #119817 - compiler-errors:normalize-opaques, r=lcnrGuillaume Gomez-74/+134
Remove special-casing around `AliasKind::Opaque` when structurally resolving in new solver This fixes a few inconsistencies around where we don't eagerly resolve opaques to their (locally-defined) hidden types in the new solver. It essentially allows this code to work: ```rust fn main() { type Tait = impl Sized; struct S { i: i32, } let x: Tait = S { i: 0 }; println!("{}", x.i); } ``` Since `Tait` is defined in `main`, we are able to poke through the type of `x` with deref. r? lcnr
2024-01-12Auto merge of #119396 - Nadrieril:intersection-tracking, r=WaffleLapkinbors-25/+19
Exhaustiveness: track overlapping ranges precisely The `overlapping_range_endpoints` lint has false positives, e.g. https://github.com/rust-lang/rust/issues/117648. I expected that removing these false positives would have too much of a perf impact but never measured it. This PR is an experiment to see if the perf loss is manageable. r? `@ghost`
2024-01-12Delegation implementation: step 1Bryanskiy-9/+809
2024-01-12Revert "Auto merge of #113923 - DianQK:restore-no-builtins-lto, r=pnkfelix"DianQK-105/+9
This reverts commit 8c2b57721728233e074db69d93517614de338055, reversing changes made to 9cf18e98f82d85fa41141391d54485b8747da46f.
2024-01-12Revert "Auto merge of #118568 - DianQK:no-builtins-symbols, r=pnkfelix"DianQK-8/+0
This reverts commit 503e129328080e924c0ddfca6abf4c2812580102, reversing changes made to 0e7f91b75e7484a713e2f644212cfc1aa7478a28.
2024-01-12Rename `--env` option flag to `--env-set`Guillaume Gomez-6/+6
2024-01-12Auto merge of #119879 - matthiaskrgr:rollup-y710der, r=matthiaskrgrbors-0/+135
Rollup of 4 pull requests Successful merges: - #119781 (fix typo) - #119865 (Set `c_str_literals` stabilization version back to `CURRENT_RUSTC_VERSION`) - #119866 (Convert `effects` description to doc comment) - #119868 (Register even erroneous impls) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-12update debuginfo tests on Windowsjoboet-2/+2
2024-01-12Rollup merge of #119868 - oli-obk:unknown_lifetime_ice, r=compiler-errorsMatthias Krüger-0/+135
Register even erroneous impls Otherwise the specialization graph fails to pick it up, even though other code assumes that all impl blocks have an entry in the specialization graph. also includes an unrelated cleanup of the specialization graph query fixes #119827
2024-01-12Auto merge of #119735 - lcnr:provisional-cache-readd, r=compiler-errorsbors-0/+173
next solver: provisional cache this adds the cache removed in #115843. However, it should now correctly track whether a provisional result depends on an inductive or coinductive stack. While working on this, I was using the following doc: https://hackmd.io/VsQPjW3wSTGUSlmgwrDKOA. I don't think it's too helpful to understanding this, but am somewhat hopeful that the inline comments are more useful. There are quite a few future perf improvements here. Given that this is already very involved I don't believe it is worth it (for now). While working on this PR one of my few attempts to significantly improve perf ended up being unsound again because I was not careful enough :sparkles: r? `@compiler-errors`
2024-01-12Auto merge of #118548 - Enselic:bench-padding, r=thomcc,ChrisDentonbors-0/+50
libtest: Fix padding of benchmarks run as tests ### Summary The first commit adds regression tests for libtest padding. The second commit fixes padding for benches run as tests and updates the blessed output of the regression tests to make it clear what effect the fix has on padding. Closes #104092 which is **E-help-wanted** and **regression-from-stable-to-stable** ### More details Before this fix we applied padding _before_ manually doing what `convert_benchmarks_to_tests()` does which affects padding calculations. Instead use `convert_benchmarks_to_tests()` first if applicable and then apply padding afterwards so it becomes correct. Benches should only be padded when run as benches to make it easy to compare the benchmark numbers. Not when run as tests. r? `@ghost` until CI passes.
2024-01-12Give me a way to emit all the delayed bugsMichael Goulet-0/+39
2024-01-11Register even erroneous implsOli Scherer-0/+135
Otherwise the specialization graph fails to pick it up, even though other code assumes that all impl blocks have an entry in the specialization graph.
2024-01-11Rollup merge of #119852 - RalfJung:const-err4, r=compiler-errorsMatthias Krüger-11/+1
give const-err4 a more descriptive name Also, doesn't look like this still needs to be per-bitwidth r? ``@oli-obk``
2024-01-11Rollup merge of #119842 - Zalathar:kind, r=oli-obkMatthias Krüger-6/+6
coverage: Add enums to accommodate other kinds of coverage mappings Extracted from #118305. LLVM supports several different kinds of coverage mapping regions, but currently we only ever emit ordinary “code” regions. This PR performs the plumbing required to add other kinds of regions as enum variants, but does not add any specific variants other than `Code`. The main motivation for this change is branch coverage, but it will also allow separate experimentation with gap regions and skipped regions, which might help in producing more accurate and useful coverage reports. --- ``@rustbot`` label +A-code-coverage
2024-01-11Rollup merge of #119841 - nnethercote:rm-DiagnosticBuilder-buffer, r=oli-obkMatthias Krüger-5/+5
Remove `DiagnosticBuilder::buffer` `DiagnosticBuilder::buffer` doesn't do much, and part of what it does (for `-Ztreat-err-as-bug`) it shouldn't. This PR strips it back, replaces its uses, and finally removes it, making a few cleanups in the vicinity along the way. r? ``@oli-obk``
2024-01-11Rollup merge of #119836 - hi-rustin:rustin-patch-docs-blank-line, r=ChrisDentonMatthias Krüger-1/+1
chore: remove unnecessary blank line It seems no need to add an unnecessary line here.
2024-01-11Rollup merge of #119813 - oli-obk:even_more_follow_up_errors2, r=estebankMatthias Krüger-249/+47
Silence some follow-up errors [2/x] this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449 the `type_of` query frequently uses astconv to convert a `hir::Ty` to a `ty::Ty`. This process is infallible, but may produce errors as it goes. All the error reporting sites that had access to the `ItemCtxt` are now tainting it, causing `type_of` to return a `ty::Error` instead of anything else.
2024-01-11Remove special-casing around aliaskind in new solverMichael Goulet-74/+134
2024-01-11give const-err4 a more descriptive nameRalf Jung-11/+1
2024-01-11fix: update broken stderrhi-rustin-1/+1
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-11Only lint ranges that really overlapNadrieril-25/+19
2024-01-11Taint more aggressively in astconvOli Scherer-89/+15
2024-01-11Silence follow up errors if astconv already erroredOli Scherer-160/+32
2024-01-11Rollup merge of #116343 - ↵Takayuki Maeda-12/+56
Nilstrieb:maybe-dont-mention-all-the-weird-lang-items-just-saying, r=bjorn3 Stop mentioning internal lang items in no_std binary errors When writing a no_std binary, you'll be greeted with nonsensical errors mentioning lang items like eh_personality and start. That's pretty bad because it makes you think that you need to define them somewhere! But oh no, now you're getting the `internal_features` lint telling you that you shouldn't use them! But you need a no_std binary! What now? No problem! Writing a no_std binary is super easy. Just use panic=abort and supply your own platform specific entrypoint symbol (like `main`) and you're good to go. Would be nice if the compiler told you that, right? This makes it so that it does do that. I don't _love_ the new messages yet, but they're decent I think. They can probably be improved, please suggest improvements.
2024-01-11Use the right level with `-Ztreat-err-as-bug`.Nicholas Nethercote-5/+5
Errors in `DiagCtxtInner::emit_diagnostic` are never set to `Level::Bug`, because the condition never succeeds, because `self.treat_err_as_bug()` is called *before* the error counts are incremented. This commit switches to `self.treat_next_err_as_bug()`, fixing the problem. This changes the error message output to actually say "internal compiler error".
2024-01-11coverage: Add enums to accommodate other kinds of coverage mappingsZalathar-6/+6
2024-01-11Auto merge of #119677 - cjgillot:early-cfg-opt, r=oli-obkbors-38/+10
Reorder early post-inlining passes. `RemoveZsts`, `RemoveUnneededDrops` and `UninhabitedEnumBranching` only depend on types, so they should be executed together early after MIR inlining introduces those types. This does not change the end-result, but this makes the pipeline a bit more consistent.
2024-01-11Rollup merge of #119803 - oli-obk:even_more_follow_up_errors, r=compiler-errorsMatthias Krüger-26/+2
Silence some follow-up errors [1/x] this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449 When we use `-> impl SomeTrait<_>` as a return type, we are both using the "infer return type suggestion" code path, and the infer opaque type code path within the same function. That can lead to confusing diagnostics, so silence all opaque type diagnostics in that case.
2024-01-11Rollup merge of #119790 - celinval:smir-all-traits, r=oli-obkMatthias Krüger-0/+125
Fix all_trait* methods to return all traits available in StableMIR Also provide a mechanism to retrieve traits and implementations for a given crate. This fixes https://github.com/rust-lang/project-stable-mir/issues/37
2024-01-11Rollup merge of #119715 - Nadrieril:graceful-type-error, r=compiler-errorsMatthias Krüger-0/+91
Exhaustiveness: abort on type error This adds an error path to exhaustiveness checking so that we abort instead of ICEing when encountering a stray `ty::Error`. Fixes https://github.com/rust-lang/rust/issues/119493 Fixes https://github.com/rust-lang/rust/issues/119778 r? `@compiler-errors`
2024-01-10Stop mentioning internal lang items in no_std binary errorsNilstrieb-12/+56
When writing a no_std binary, you'll be greeted with nonsensical errors mentioning lang items like eh_personality and start. That's pretty bad because it makes you think that you need to define them somewhere! But oh no, now you're getting the `internal_features` lint telling you that you shouldn't use them! But you need a no_std binary! What now? No problem! Writing a no_std binary is super easy. Just use panic=abort and supply your own platform specific entrypoint symbol (like `main`) and you're good to go. Would be nice if the compiler told you that, right? This makes it so that it does do that.
2024-01-10Add test case for #119778Nadrieril-0/+48
2024-01-10Avoid follow up errorsOli Scherer-26/+2
2024-01-10Rollup merge of #119772 - oli-obk:whackamole, r=compiler-errorsMatthias Krüger-0/+47
Fix an ICE that occurs after an error has already been reported fixes #117491 cc `@jswrenn`
2024-01-10Rollup merge of #119769 - fmease:rustdoc-off-by-one-dyn-trait-def-gen-args, ↵Matthias Krüger-14/+30
r=GuillaumeGomez rustdoc: offset generic args of cross-crate trait object types when cleaning Fixes #119529. This PR contains several refactorings apart from the bug fix. Best reviewed commit by commit. r? GuillaumeGomez
2024-01-10Rollup merge of #106893 - clubby789:struct-update-help, r=compiler-errorsMatthias Krüger-3/+8
Explain base expression for struct update syntax Fixes #106890 `@rustbot` label +A-diagnostics
2024-01-09Fix all_trait* methods to return all trait availableCelina G. Val-0/+125
Also provide a mechanism to retrieve traits and implementations for a given crate.