about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-02-26Rollup merge of #108337 - tshepang:translatable-hir-analysis, r=cjgillotMatthias Krüger-1/+1
hir-analysis: make a helpful note
2023-02-26Rollup merge of #107941 - compiler-errors:str-has-u8-slice-for-auto, r=lcnrMatthias Krüger-0/+29
Treat `str` as containing `[u8]` for auto trait purposes Wanted to gauge ``@rust-lang/lang`` and ``@rust-lang/types`` teams' thoughts on treating `str` as "containing" a `[u8]` slice for auto-trait purposes. ``@dtolnay`` brought this up in https://github.com/rust-lang/rust/issues/13231#issuecomment-1399386472 as a blocker for future `str` type librarification, and I think it's both a valid concern and very easy to fix. I'm interested in actually doing that `str` type librarification (#107939), but this probably should be considered in the mean time regardless of that PR. r? types for the impl, though this definitely needs an FCP.
2023-02-26Auto merge of #108473 - matthiaskrgr:rollup-qjyae58, r=matthiaskrgrbors-12/+204
Rollup of 8 pull requests Successful merges: - #107062 (Do some cleanup of doc/index.md) - #107890 (Lint against `Iterator::map` receiving a callable that returns `()`) - #108431 (Add regression test for #107918) - #108432 (test: drop unused deps) - #108436 (make "proc macro panicked" translatable) - #108444 (docs/test: add UI test and docs for `E0476`) - #108449 (Do not lint ineffective unstable trait impl for unresolved trait) - #108456 (Complete migrating `ast_passes` to derive diagnostics) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-26Rollup merge of #108456 - clubby789:ast-passes-diag-migrate, r=compiler-errorsMatthias Krüger-12/+12
Complete migrating `ast_passes` to derive diagnostics cc #100717 ```@rustbot``` label +A-translation
2023-02-26Rollup merge of #108449 - fee1-dead-contrib:do_not_lint_unresolved, ↵Matthias Krüger-0/+17
r=compiler-errors Do not lint ineffective unstable trait impl for unresolved trait
2023-02-26Rollup merge of #108444 - Ezrashaw:add-test+docs-for-e0476, r=GuillaumeGomezMatthias Krüger-0/+44
docs/test: add UI test and docs for `E0476` Final undocumented error code. Not entirely sure about wording in the docs. Part of https://github.com/rust-lang/rust/issues/61137. r? ```@compiler-errors``` cc ```@compiler-errors```
2023-02-26Rollup merge of #108431 - GuillaumeGomez:regression-test-for-107918, r=notriddleMatthias Krüger-0/+21
Add regression test for #107918 Fixes https://github.com/rust-lang/rust/issues/107918. r? ```@notriddle```
2023-02-26Rollup merge of #107890 - obeis:mapping-to-unit, r=cjgillotMatthias Krüger-0/+110
Lint against `Iterator::map` receiving a callable that returns `()` Close #106991
2023-02-26hir-analysis: make a helpful noteTshepang Mbambo-1/+1
2023-02-25Special note for str in auto traitsMichael Goulet-1/+1
2023-02-25Treat `str` as containing `[u8]` for auto trait purposesMichael Goulet-0/+29
2023-02-25Rollup merge of #108333 - compiler-errors:new-solver-object-sound, r=lcnrMichael Goulet-0/+102
Make object bound candidates sound in the new trait solver r? `@lcnr`
2023-02-25Rollup merge of #107911 - blyxyas:issue-107231-fix, r=compiler-errorsMichael Goulet-0/+42
Add check for invalid #[macro_export] arguments Resolves #107231 Sorry if I made something wrong, this is my first contribution to the repo.
2023-02-25Rollup merge of #107675 - jsgf:link-directives, r=davidtwcoMichael Goulet-0/+11
Implement -Zlink-directives=yes/no `-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later. cc `@pcwalton` `@cramertj`
2023-02-25Rollup merge of #107291 - oli-obk:rustdoc_breaking_change, r=estebankMichael Goulet-0/+20
[breaking change] Remove a rustdoc back compat warning This warning was introduced in https://github.com/rust-lang/rust/pull/62855 for users who use `rustdoc` directly on proc macro crates (instead of using `cargo doc`) without passing `--crate-type proc-macro` (which `cargo doc` passed automatically).
2023-02-25Auto merge of #108450 - matthiaskrgr:rollup-rqvfgu3, r=matthiaskrgrbors-2/+11
Rollup of 7 pull requests Successful merges: - #108354 (Update `fuchsia-test-runner.py` and docs) - #108404 (support `x fmt` for sub and outside of rust directories) - #108407 (docs: use intra-doc links for `Vec::get(_mut)`) - #108410 (rustdoc: avoid including `<li>` tags in item table short desc) - #108412 (Fix GUI test navigation bug) - #108433 (Wrap missing provider message correctly) - #108434 (Migrate `rustc_hir_analysis` to session diagnostic [Part One]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-25Complete migrating `ast_passes` to derive diagnosticsclubby789-12/+12
2023-02-25Don't run issue-107918.rs test on windowsGuillaume Gomez-0/+1
2023-02-25Rollup merge of #108412 - GuillaumeGomez:fix-gui-test-navigation-bug, ↵Matthias Krüger-2/+1
r=notriddle Fix GUI test navigation bug Following https://github.com/GuillaumeGomez/browser-UI-test/pull/438, we can now remove this `wait-for`. Should help with #93784. r? ``@notriddle``
2023-02-25Rollup merge of #108410 - notriddle:notriddle/tag-item-summary, r=GuillaumeGomezMatthias Krüger-0/+10
rustdoc: avoid including `<li>` tags in item table short desc Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html
2023-02-25Auto merge of #108233 - ChrisDenton:move-std-tests, r=thomccbors-41/+0
Move some std tests from `tests/ui-fulldeps` into `library/std` This allows them to be tested normally along with other `./x test std` tests. Moving `rename_directory` is simple enough but `create_dir_all_bare` needed to be an std integration test. Additionally, some tests that I couldn't move atm have instead been placed in an `std` subdirectory. These tests include ones that do fun things with processes or that intentionally abort the test process. r? libs
2023-02-25Do not lint unresolved trait for ineffective unstable trait implDeadbeef-0/+17
2023-02-25docs/test: add UI test and docs for `E0476`Ezra Shaw-0/+44
2023-02-25Auto merge of #106430 - tmiasko:rm-dead-unwinds, r=cjgillotbors-326/+345
Remove dead unwinds before drop elaboration As a part of drop elaboration, we identify dead unwinds, i.e., unwind edges on a drop terminators which are known to be unreachable, because there is no need to drop anything. Previously, the data flow framework was informed about the dead unwinds, and it assumed those edges are absent from MIR. Unfortunately, the data flow framework wasn't consistent in maintaining this assumption. In particular, if a block was reachable only through a dead unwind edge, its state was propagated to other blocks still. This became an issue in the context of change removes DropAndReplace terminator, since it introduces initialization into cleanup blocks. To avoid this issue, remove unreachable unwind edges before the drop elaboration, and elaborate only blocks that remain reachable. cc `@Zeegomo`
2023-02-24Add regression test for #107918Guillaume Gomez-0/+20
2023-02-24Rollup merge of #108401 - notriddle:notriddle/diagnostics-article, ↵Dylan DPC-339/+339
r=compiler-errors diagnostics: remove inconsistent English article "this" from E0107 Consider [`tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`][issue-102768.stderr], the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in [`tests/ui/lint/dead-code/issue-85255.stderr`][issue-85255.stderr]. They don't have articles, so it seems unnecessary to have one here. [issue-102768.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr [issue-85255.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/lint/dead-code/issue-85255.stderr
2023-02-24Rollup merge of #108388 - ohno418:better-suggestion-on-malformed-closure, ↵Dylan DPC-6/+45
r=davidtwco parser: provide better suggestions and errors on closures with braces missing We currently provide wrong suggestions and unhelpful errors on closure bodies with braces missing. For example, given the following code: ```rust fn main() { let _x = Box::new(|x|x+1;); } ``` the current output is: ``` error: expected expression, found `)` --> ./main.rs:2:30 | 2 | let _x = Box::new(|x|x+1;); | ^ expected expression error: closure bodies that contain statements must be surrounded by braces --> ./main.rs:2:25 | 2 | let _x = Box::new(|x|x+1;); | ^ 3 | } | ^ | note: statement found outside of a block --> ./main.rs:2:29 | 2 | let _x = Box::new(|x|x+1;); | ---^ this `;` turns the preceding closure into a statement | | | this expression is a statement because of the trailing semicolon note: the closure body may be incorrectly delimited --> ./main.rs:2:23 | 2 | let _x = Box::new(|x|x+1;); | ^^^^^^ this is the parsed closure... 3 | } | - ...but likely you meant the closure to end here help: try adding braces | 2 ~ let _x = Box::new(|x| {x+1;); 3 ~ }} | error: expected `;`, found `}` --> ./main.rs:2:32 | 2 | let _x = Box::new(|x|x+1;); | ^ help: add `;` here 3 | } | - unexpected token error: aborting due to 3 previous errors ``` We got 3 errors, but all but the second are unnecessary or just wrong. This commit allows outputting correct suggestions and errors. The above code would output like this: ``` error: closure bodies that contain statements must be surrounded by braces --> ./main.rs:2:25 | 2 | let _x = Box::new(|x|x+1;); | ^ ^ | note: statement found outside of a block --> ./main.rs:2:29 | 2 | let _x = Box::new(|x|x+1;); | ---^ this `;` turns the preceding closure into a statement | | | this expression is a statement because of the trailing semicolon note: the closure body may be incorrectly delimited --> ./main.rs:2:23 | 2 | let _x = Box::new(|x|x+1;); | ^^^^^^ - ...but likely you meant the closure to end here | | | this is the parsed closure... help: try adding braces | 2 | let _x = Box::new(|x| {x+1;}); | + + error: aborting due to previous error ``` Fixes https://github.com/rust-lang/rust/issues/107959. r? diagnostics
2023-02-24Rollup merge of #108377 - clubby789:duplicate-diagnostic-ice, r=compiler-errorsDylan DPC-0/+31
Fix ICE in 'duplicate diagnostic item' diagnostic Not sure how to add this in a test; I found it by mistakenly running `cargo fix --lib -p std` rather than `x fix` at the root.
2023-02-24Rollup merge of #108287 - compiler-errors:new-solver-bad-cast, r=spastorinoDylan DPC-0/+15
Add test for bad cast with deferred projection equality 1. Unification during coercion (`Coerce::unify`) needs to consider deferred projection obligations (at least pass over them with `predicate_may_hold` or something, to disqualify any totally wrong unifications) -- otherwise, we'll shallowly consider `<u8 as Add>::Output` and `char` as coercible during `FnCtxt::try_coerce`, which will fail later when the nested obligations are registered and processed. 2. Cast checking needs to be able to structurally normalize types so it sees `u8` instead of `<u8 as Add>::Output`. Otherwise it'll always consider the latter as part of a non-primitive cast. Currently `FnCtxt::normalize` doesn't do anything useful here, interestingly. I tried looking into both of these and it's not immediately clear where to refactor existing typeck code to fix this (at least the latter), but I'm gonna commit a test for it at least so we don't forget. This is one of the issues that's keeping us from building larger projects.
2023-02-24Rollup merge of #106923 - mejrs:fluent_err, r=davidtwcoDylan DPC-0/+41
Restore behavior when primary bundle is missing Fixes https://github.com/rust-lang/rust/issues/106755 by restoring some of the behavior prior to https://github.com/rust-lang/rust/pull/106427 Still, I have no idea how this debug assertion can even hit while using `en-US` as primary bundle. r? ```@davidtwco```
2023-02-24Rollup merge of #106541 - fee1-dead-contrib:no-const-check-no, r=thomccDylan DPC-8/+83
implement const iterator using `rustc_do_not_const_check` Previous experiment: #102225. Explanation: rather than making all default methods work under `const` all at once, this uses `rustc_do_not_const_check` as a workaround to "trick" the compiler to not run any checks on those other default methods. Any const implementations are only required to implement the `next` method. Any actual calls to the trait methods other than `next` will either error in compile time (at CTFE runs), or run the methods correctly if they do not have any non-const operations. This is extremely easy to maintain, remove, or improve.
2023-02-24Comments, another testMichael Goulet-0/+46
2023-02-24Make higher-ranked projections in object types work in new solverMichael Goulet-0/+17
2023-02-24Check object's supertrait and associated type bounds in new solverMichael Goulet-0/+39
2023-02-23No need for the wait-for anymore to go around browser navigation bugGuillaume Gomez-2/+1
2023-02-23rustdoc: avoid including `<li>` tags in item table short descMichael Howell-0/+10
Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html
2023-02-23rustdoc: update UI test for dropping "this" articleMichael Howell-1/+1
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-338/+338
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-23Fix ICE in 'duplicate diagnostic item' diagnosticclubby789-0/+31
2023-02-23./x.py test --blessTomasz Miąsko-6/+4
2023-02-23Emit diff instead of after mir in ElaborateDrops testsTomasz Miąsko-326/+347
to make it easy to understand chnages made by elaboration.
2023-02-23Add ui test for `E0271` errorObei Sideg-0/+24
2023-02-23Add ui test for `map_unit_fn` lint in closure caseObei Sideg-1/+51
2023-02-23Add ui test for `map_unit_fn` lintObei Sideg-0/+36
2023-02-23parser: provide better errors on closures with braces missingYutaro Ohno-6/+45
We currently provide wrong suggestions and unhelpful errors on closure bodies with braces missing. For example, given the following code: ``` fn main() { let _x = Box::new(|x|x+1;); } ``` the current output is like this: ``` error: expected expression, found `)` --> ./main.rs:2:30 | 2 | let _x = Box::new(|x|x+1;); | ^ expected expression error: closure bodies that contain statements must be surrounded by braces --> ./main.rs:2:25 | 2 | let _x = Box::new(|x|x+1;); | ^ 3 | } | ^ | ... help: try adding braces | 2 ~ let _x = Box::new(|x| {x+1;); 3 ~ }} ... error: expected `;`, found `}` --> ./main.rs:2:32 | 2 | let _x = Box::new(|x|x+1;); | ^ help: add `;` here 3 | } | - unexpected token error: aborting due to 3 previous errors ``` This commit allows outputting correct suggestions and errors. The above code would output like this: ``` error: closure bodies that contain statements must be surrounded by braces --> ./main.rs:2:25 | 2 | let _x = Box::new(|x|x+1;); | ^ ^ | note: statement found outside of a block --> ./main.rs:2:29 | 2 | let _x = Box::new(|x|x+1;); | ---^ this `;` turns the preceding closure into a statement | | | this expression is a statement because of the trailing semicolon note: the closure body may be incorrectly delimited --> ./main.rs:2:23 | 2 | let _x = Box::new(|x|x+1;); | ^^^^^^ - ...but likely you meant the closure to end here | | | this is the parsed closure... help: try adding braces | 2 | let _x = Box::new(|x| {x+1;}); | + + error: aborting due to previous error ```
2023-02-23Test rustdoc encountering `proc_macro_derive` in a non-proc-macro crateOli Scherer-0/+20
2023-02-23Rollup merge of #108349 - GuillaumeGomez:fix-duplicated-imports2, r=notriddleMatthias Krüger-0/+26
rustdoc: Prevent duplicated imports Fixes #108163. Interestingly enough, the AST is providing us an import for each corresponding item, even though the `Res` links to multiple ones each time, which leaded to the same import being duplicated. So in this PR, I decided to prevent the add of the import before the clean pass. However, I originally took a different path by instead filtering after cleaning the path. You can see it [here](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:rust:fix-duplicated-imports?expand=1). Only the second commit differs. I think this approach is better though, but at least we can compare both if we want. The first commit adds the check for duplicated items in the rustdoc-json output as asked in #108163. cc `@aDotInTheVoid` r? `@notriddle`
2023-02-23Rollup merge of #108208 - cjgillot:flood-enum, r=oli-obkMatthias Krüger-2/+102
Correctly handle aggregates in DataflowConstProp The previous implementation from https://github.com/rust-lang/rust/pull/107411 flooded target of an aggregate assignment with `Bottom`, corresponding to the `deinit` that the interpreter does. As a consequence, when assigning `target = Enum::Variant#i(...)` all the `(target as Variant#j)` were at `Bottom` while they should have been `Top`. This PR replaces that flooding with `Top`. Aside, it corrects a second bug where the wrong place would be used to assign to enum variant fields, resulting to nothing happening. Fixes https://github.com/rust-lang/rust/issues/108166
2023-02-23Rollup merge of #108063 - ↵Matthias Krüger-172/+136
compiler-errors:associated-type-bounds-in-bad-position, r=cjgillot Ban associated type bounds in bad positions We should not try to lower associated type bounds into TAITs in positions where `impl Trait` is not allowed (except for in `where` clauses, like `where T: Trait<Assoc: Bound>`). This is achieved by using the same `rustc_ast_lowering` machinery as impl-trait does to characterize positions as universal/existential/disallowed. Fixes #106077 Split out the first commit into #108066, since it's not really related.
2023-02-23Add stderrmejrs-0/+22