about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
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-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-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-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-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
2023-02-23Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, ↵bors-640/+662
r=compiler-errors,davidtwco,estebank,oli-obk diagnostics: if AssocFn has self argument, describe as method Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods. For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods> > Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation. In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-23Test that choosing the default bundle does not icemejrs-0/+19
2023-02-22pluralize stuffMichael Goulet-80/+80
2023-02-22Suppress duplicated errors for associated type bounds in object typesMichael Goulet-104/+10
2023-02-22Auto merge of #108357 - matthiaskrgr:rollup-ceo3q2s, r=matthiaskrgrbors-2/+75
Rollup of 6 pull requests Successful merges: - #107736 ( Rename atomic 'as_mut_ptr' to 'as_ptr' to match Cell (ref #66893) ) - #108176 (Don't delay `ReError` bug during lexical region resolve) - #108315 (Lint dead code in closures and generators) - #108342 (apply query response: actually define opaque types) - #108344 (Fix test filename for #105700) - #108353 (resolve: Remove `ImportResolver`) Failed merges: - #107911 (Add check for invalid #[macro_export] arguments) r? `@ghost` `@rustbot` modify labels: rollup
2023-02-22Move associated type bounds check to ast loweringMichael Goulet-91/+149
This makes the check for when associated type bounds more accurate
2023-02-22Rollup merge of #108344 - Alexendoo:test-105700, r=compiler-errorsMatthias Krüger-2/+2
Fix test filename for #105700 The test is for #105700 rather than #21102
2023-02-22Rollup merge of #108315 - clubby789:dead-code-in-closure, r=compiler-errorsMatthias Krüger-0/+36
Lint dead code in closures and generators Fixes #108296 I think this might be a potentially breaking change, but restores the behaviour of pre-1.64. `@rustbot` label +A-lint
2023-02-22Rollup merge of #108176 - compiler-errors:bad-lexical-region-resolve-bug, ↵Matthias Krüger-0/+37
r=oli-obk Don't delay `ReError` bug during lexical region resolve Lexical region resolution returns a list of `RegionResolutionError` which don't necessarily correspond to diagnostics being emitted. The compiler may, validly, throw away these resolution errors and do something else. Therefore it's not valid to use `ReError` during lifetime resolution, since we may actually be on a totally fine compilation path. For example, the `implied_bounds_entailment` lint runs region resolution twice, and only emits an error if it fails both times. If we delay a bug and create a `ReError` during this first run, then we will ICE. Fixes #108170 ---- Side-note: this is conceptually equivalent to how we can't necessarily delay bugs or create `ty::Error` during trait solving/fulfillment, since the compiler is allowed to throw away these fulfillment errors to do other things. It's only once we actually emit an error (`report_region_errors` / `report_fulfillment_errors`)
2023-02-22Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obkbors-1/+2
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2023-02-22Normalize line+col in normalize-tait-in-const testAlan Egerton-1/+2
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-22Add test to ensure there are no duplicated importsGuillaume Gomez-0/+26
2023-02-22rustdoc: update test case with intra-doc link pointing to methodMichael Howell-4/+12
2023-02-22diagnostics: update test cases to refer to assoc fn with `self` as methodMichael Howell-636/+650
2023-02-22Lint dead code in closuresclubby789-0/+36