about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-05-01fix testsyukang-70/+37
2023-05-01fix test casesyukang-252/+121
2023-05-01Rip it outNilstrieb-703/+594
My type ascription Oh rip it out Ah If you think we live too much then You can sacrifice diagnostics Don't mix your garbage Into my syntax So many weird hacks keep diagnostics alive Yet I don't even step outside So many bad diagnostics keep tyasc alive Yet tyasc doesn't even bother to survive!
2023-05-01Rollup merge of #111037 - Nilstrieb:close-the-offsetof, r=compiler-errorsMatthias Krüger-0/+4
Close parentheses for `offset_of` in AST pretty printing HIR pretty printing already handles it correctly. This will conflict with #110694 but it seems like that PR is gonna take bit more time.
2023-05-01Rollup merge of #111023 - tmiasko:multi-variant-capture, r=compiler-errorsMatthias Krüger-0/+21
Test precise capture with a multi-variant enum and exhaustive patterns Add test checking that it is possible to capture fields of a multi-variant enum, when remaining variants are visibly uninhabited (under the `exhaustive_patterns` feature gate).
2023-05-01Rollup merge of #111015 - cjgillot:chained-let-and, r=compiler-errorsMatthias Krüger-0/+10
Remove wrong assertion in match checking. This assertions is completely misguided, introduced by https://github.com/rust-lang/rust/pull/108504. The responsible PR is on beta, nominating for backport. Instead of checking that this is not a `&&`, it would make sense to check that neither arms of that `&&` is a `let`. This seems like a lot of code for unclear benefit. r? `@saethlin`
2023-05-01Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naberMatthias Krüger-710/+459
Tweak await span to not contain dot Fixes a discrepancy between method calls and await expressions where the latter are desugared to have a span that *contains* the dot (i.e. `.await`) but method call identifiers don't contain the dot. This leads to weird suggestions suggestions in borrowck -- see linked issue. Fixes #110761 This mostly touches a bunch of tests to tighten their `await` span.
2023-04-30Close parentheses for `offset_of` in AST pretty printingNilstrieb-0/+4
HIR pretty printing already handles it correctly.
2023-04-30Test precise capture with a multi-variant enum and exhaustive patternsTomasz Miąsko-0/+21
Add test checking that it is possible to capture fields of a multi-variant enum, when remaining variants are visibly uninhabited (under the `exhaustive_patterns` feature gate).
2023-04-30Rollup merge of #110732 - cjgillot:unit-const-prop, r=tmiaskoMatthias Krüger-75/+79
Make ConstProp some tests unit. Part of the effort to tidy up mir-opt test suite.
2023-04-30Rollup merge of #110631 - notriddle:notriddle/impl-trait-cycle, r=GuillaumeGomezMatthias Krüger-0/+71
rustdoc: catch and don't blow up on impl Trait cycles Fixes #110629 An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay: type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>; type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>; To get it right, track every time rustdoc descends into a type alias, so if it shows up twice, it can be write the path instead of infinitely expanding it.
2023-04-30Remove wrong assertion.Camille GILLOT-0/+10
2023-04-30Auto merge of #110942 - Zalathar:coverage-tests, r=Mark-Simulacrumbors-1/+1
Don't accidentally ignore all output in `tests/run-make/coverage-reports` diffs Because the literal pipe `|` character was not escaped, these regexes ended up accidentally ignoring every line in the coverage report output, so the tests would not fail even if the output was wrong.
2023-04-29rustdoc: catch and don't blow up on impl Trait cyclesMichael Howell-0/+71
An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay: type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>; type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>; To get it right, track every time rustdoc descends into a type alias, so if it shows up twice, it can be write the path instead of infinitely expanding it.
2023-04-30Rollup merge of #110984 - cjgillot:const-infer-lifetime, r=compiler-errorsMatthias Krüger-0/+20
Do not resolve anonymous lifetimes in consts to be static. Fixes https://github.com/rust-lang/rust/issues/110931
2023-04-30Rollup merge of #110983 - GuillaumeGomez:foreign-repr, r=notriddleMatthias Krüger-5/+39
rustdoc: Get `repr` information through `AdtDef` for foreign items As suggested by `@notriddle,` this approach works too. The only downside is that the display of the original attribute isn't kept, but I think it's an acceptable downside. r? `@notriddle`
2023-04-30Rollup merge of #110981 - jyn514:rustdoc-tests, r=notriddleMatthias Krüger-29/+40
Move most rustdoc-ui tests into subdirectories This makes it easier to know where to add a new test, and makes the top-level directory less overwhelming.
2023-04-30Rollup merge of #110973 - bindsdev:packed-struct-ref-diagnostic-note, ↵Matthias Krüger-25/+50
r=compiler-errors improve error notes for packed struct reference diagnostic Addresses #110199
2023-04-30Rollup merge of #110652 - ojeda:core-no_global_oom_handling-test, ↵Matthias Krüger-0/+6
r=Mark-Simulacrum Add test for warning-free builds of `core` under `no_global_oom_handling` `tests/run-make/alloc-no-oom-handling` tests that `alloc` under `no_global_oom_handling` builds and is warning-free. Do the same for `core` to prevent issues such as [1]. Link: https://github.com/rust-lang/rust/pull/110649 [1]
2023-04-30Rollup merge of #110586 - ChrisDenton:msvc-oem-output, r=workingjubileeMatthias Krüger-0/+13
Fix Unreadable non-UTF-8 output on localized MSVC Fixes #35785 by converting non UTF-8 linker output to Unicode using the OEM code page. Before: ```text = note: Non-UTF-8 output: LINK : fatal error LNK1181: cannot open input file \'m\x84rchenhaft.obj\'\r\n ``` After: ```text = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj' ``` The difference is more dramatic if using a non-ascii language pack for Windows.
2023-04-29Extend foreign inlined item with `#[repr()]` testGuillaume Gomez-5/+39
2023-04-29move lint tests into subdirectoriesjyn-0/+0
2023-04-29Move some rustdoc-ui tests to subdirectoriesjyn-29/+40
2023-04-29Rollup merge of #110964 - notriddle:notriddle/deref-impl, r=GuillaumeGomezMatthias Krüger-0/+43
rustdoc: fix weird margins between Deref impl items ## Before ![image](https://user-images.githubusercontent.com/1593513/235245977-90770591-22c1-4a27-9464-248a3729a2b7.png) ## After ![image](https://user-images.githubusercontent.com/1593513/235246009-0e83113e-42b7-4e29-981d-969f9d20af01.png) ## Description In the old setup, if the dereffed-to item has multiple impl blocks, each one gets its own `div.impl-items` in the section, but there are no headers separating them. Since the last method in a `div.impl-items` has no bottom margin, and there are no margins between these divs, there is no margin between the last method of one impl and the first method of the following impl. This patch fixes it by simplifying the HTML. Each Deref block gets exactly one `div.impl-items`, no matter how many impl blocks it actually has.
2023-04-29Rollup merge of #110644 - pietroalbini:pa-json-formatting-tests, ↵Matthias Krüger-3/+23
r=Mark-Simulacrum Update tests for libtest `--format json` This PR makes the test work on beta and stable, and adds a test ensuring the option is not available on beta and stable. Backported these commits from https://github.com/rust-lang/rust/pull/110414.
2023-04-29Rollup merge of #105848 - lukas-code:backticks, ↵Matthias Krüger-0/+1301
r=GuillaumeGomez,jyn514,notriddle rustdoc: Add a new lint for broken inline code This patch adds `rustdoc::unescaped_backticks`, a new rustdoc lint that will detect broken inline code nodes. The lint woks by finding stray backticks and with some heuristics tries to guess where the second backtick might be missing. Here is how it looks: ```rust #![warn(rustdoc::unescaped_backticks)] /// `add(a, b) is the same as `add(b, a)`. pub fn add(a: i32, b: i32) -> i32 { a + b } ``` ```text warning: unescaped backtick --> src/lib.rs:3:41 | 3 | /// `add(a, b) is the same as `add(b, a)`. | ^ | help: a previous inline code might be longer than expected | 3 | /// `add(a, b)` is the same as `add(b, a)`. | + help: if you meant to use a literal backtick, escape it | 3 | /// `add(a, b) is the same as `add(b, a)\`. | + ``` If we can't get proper spans, for example if the doc comment comes from a macro expansion, we print the suggestion in help messages instead. Here's a [real-world example](https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/trait.Filter.html#method.max_level_hint): ```text warning: unescaped backtick --> /tracing-subscriber-0.3.17/src/layer/mod.rs:1400:9 | 1400 | / /// Returns an optional hint of the highest [verbosity level][level] that 1401 | | /// this `Filter` will enable. 1402 | | /// 1403 | | /// If this method returns a [`LevelFilter`], it will be used as a hint to ... | 1427 | | /// [`Interest`]: tracing_core::subscriber::Interest 1428 | | /// [rebuild]: tracing_core::callsite::rebuild_interest_cache | |_____________________________________________________________________^ | = help: a previous inline code might be longer than expected change: Therefore, if the `Filter will change the value returned by this to this: Therefore, if the `Filter` will change the value returned by this = help: if you meant to use a literal backtick, escape it change: [`rebuild_interest_cache`][rebuild] is called after the value of the max to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max ``` You can find more examples [here](https://gist.github.com/lukas-code/7678ddf5c608aee97b3a669de80d3465). A limitation of the current implementation is, that it cannot suggest removing misplaced backticks, for example [here](https://docs.rs/tikv-jemalloc-sys/0.5.3+5.3.0-patched/tikv_jemalloc_sys/fn.mallctl.html). The lint is allowed by default ~~and nightly-only~~ for now, ~~but without a feature gate. This is similar to how `rustdoc::invalid_html_tags` and `rustdoc::bare_urls` were handled.~~
2023-04-29Add `rustdoc::unescaped_backtick` lintLukas Markeffsky-0/+1301
2023-04-29Do not force anonymous lifetimes in consts to be static.Camille GILLOT-0/+20
2023-04-29Auto merge of #108106 - the8472:layout-opt, r=wesleywiserbors-88/+140
Improve niche placement by trying two strategies and picking the better result Fixes #104807 Fixes #105371 Determining which sort order is better requires calculating the struct size (so we can calculate the niche offset). But that in turn depends on the field order, so happens after sorting. So the simple way to solve that is to run the whole thing twice and pick the better result. 1st commit is just code motion, the meat is in the later ones.
2023-04-29Rollup merge of #110965 - compiler-errors:anon-lt-dupe-oops, r=cjgillotDylan DPC-3/+163
Don't duplicate anonymous lifetimes for async fn in traits `record_lifetime_params_for_async` needs to be called outside of the scope of the function, or else it'll end up collecting anonymous lifetimes twice (those on the function and those within the `AnonymousCreateParameter` rib). This matches how `record_lifetime_params_for_async` is being used for functions with bodies below. This fixes (partially) #110963 when the lifetimes are late-bound, but does not do so when the lifetimes are early-bound (as seen from the known-bug that I added).
2023-04-29Rollup merge of #110962 - cjgillot:no-hash-drops, r=compiler-errorsDylan DPC-1/+1
Make drop_flags an IndexVec. Fixes https://github.com/rust-lang/rust/issues/91943
2023-04-29Rollup merge of #110614 - compiler-errors:new-solver-overflow-response, r=lcnrDylan DPC-0/+43
Clear response values for overflow in new solver When we have an overflow, return a trivial query response. This fixes an ICE with the code described in #110544: ```rust trait Trait {} struct W<T>(T); impl<T, U> Trait for W<(W<T>, W<U>)> where W<T>: Trait, W<U>: Trait, {} fn impls<T: Trait>() {} fn main() { impls::<W<_>>() } ``` Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE. Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver. r? ``@lcnr``
2023-04-29Auto merge of #110643 - pietroalbini:pa-bump-stage0, r=Mark-Simulacrumbors-4/+3
[master] Bump stage0 r? `@Mark-Simulacrum`
2023-04-28improve error notes for packed struct reference diagnosticbindsdev-25/+50
2023-04-28Auto merge of #110967 - matthiaskrgr:rollup-vfbl7gm, r=matthiaskrgrbors-71/+184
Rollup of 8 pull requests Successful merges: - #110877 (Provide better type hints when a type doesn't support a binary operator) - #110917 (only error combining +whole-archive and +bundle for rlibs) - #110921 (Use `NonNull::new_unchecked` and `NonNull::len` in `rustc_arena`.) - #110927 (Encoder/decoder cleanups) - #110944 (share BinOp::Offset between CTFE and Miri) - #110948 (run-make test: using single quotes to not trigger the shell) - #110957 (Fix an ICE in conflict error diagnostics) - #110960 (fix false negative for `unused_mut`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-28layout-alignment-promotion logic should depend on the niche-biasThe 8472-0/+19
For start-biased layout we want to avoid overpromoting so that the niche doesn't get pushed back. For end-biased layout we want to avoid promoting fields that may contain one of the niches of interest.
2023-04-28fix codegen testThe 8472-3/+6
2023-04-28Rollup merge of #110960 - lukas-code:unused-mut, r=compiler-errorsMatthias Krüger-8/+24
fix false negative for `unused_mut` fixes https://github.com/rust-lang/rust/issues/110849 We want to avoid double diagnostics for code like this, but only if an error actually occurs: ```rust fn main() { let mut x: (i32, i32); x.0 = 1; } ``` The first commit fixes the lint and the second one removes all the unused `mut`s it found.
2023-04-28Rollup merge of #110957 - WaffleLapkin:reach_generator_conflict_error, ↵Matthias Krüger-0/+30
r=cjgillot Fix an ICE in conflict error diagnostics Fixes #110929 r? ``@cjgillot``
2023-04-28Rollup merge of #110948 - TimNN:patch-1, r=WaffleLapkinMatthias Krüger-1/+1
run-make test: using single quotes to not trigger the shell This test got added in #110801. I'm no expert on Makefiles, but IIUC this command is passed to the shell, which usually tries to execute commands specified in between backticks in double-quoted strings. Using single quotes should fix this, I think. (Note: Waiting for CI to test this, since I only have a web browser available right now). r? ``@jyn514`` cc ``@WaffleLapkin`` Since this is breaking our build bot, even if it is not directly LLVM related: ``@rustbot`` label: +llvm-main
2023-04-28Rollup merge of #110877 - compiler-errors:binop-err, r=cjgillotMatthias Krüger-62/+129
Provide better type hints when a type doesn't support a binary operator For example, when checking whether `vec![A] == vec![A]` holds, we first evaluate the LHS's ty, then probe for any `PartialEq` implementations for that. If none is found, we report an error by evaluating `Vec<A>: PartialEq<?0>` for fulfillment errors, but the RHS is not yet evaluated and remains an inference variable `?0`! To fix this, we evaluate the RHS and equate it to that RHS infer var `?0`, so that we are able to provide more detailed fulfillment errors for why `Vec<A>: PartialEq<Vec<A>>` doesn't hold (namely, the nested obligation `A: PartialEq<A>` doesn't hold). Fixes #95285 Fixes #110867
2023-04-28Auto merge of #110901 - GuillaumeGomez:inlined-repr-rustdoc, r=notriddlebors-0/+17
rustdoc: Fix missing `repr` attribute in doc(inline) on foreign items Fixes https://github.com/rust-lang/rust/issues/110698. r? `@notriddle`
2023-04-28Don't duplicate anonymous lifetimes for async fn in traitsMichael Goulet-3/+163
2023-04-28rustdoc: fix weird margins between Deref impl itemsMichael Howell-0/+43
In the old setup, if the dereffed-to item has multiple impl blocks, each one gets its own `div.impl-items` in the section, but there are no headers separating them. Since the last method in a `div.impl-items` has no bottom margin, and there are no margins between these divs, there is no margin between the last method of one impl and the first method of the following impl. This patch fixes it by simplifying the HTML. Each Deref block gets exactly one `div.impl-items`, no matter how many impl blocks it actually has.
2023-04-28Make drop_flags an IndexVec.Camille GILLOT-1/+1
2023-04-28rustdoc: move deref tests into a directoryMichael Howell-0/+0
2023-04-28remove unused `mut`sLukas Markeffsky-7/+7
2023-04-28Fix an ICE in conflict errors diagnosticsMaybe Waffle-314/+17
2023-04-28fix false negative for `unused_mut`Lukas Markeffsky-1/+17
2023-04-28Add regression test for issue 110929Maybe Waffle-0/+327