about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-05-24Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obkbors-2/+2
Refactor call terminator to always include destination place In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things. cc `@RalfJung` `@eddyb` who were involved in the original conversation r? rust-lang/mir-opt
2022-05-24Auto merge of #97342 - JohnTitor:rollup-zqxctaw, r=JohnTitorbors-0/+155
Rollup of 5 pull requests Successful merges: - #97240 (Typo suggestion for a variable with a name similar to struct fields) - #97289 (Lifetime variance fixes for clippy) - #97290 (Turn on `fast_submodules` unconditionally) - #97336 (typo) - #97337 (Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-24Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, ↵Yuki Okushi-0/+155
r=compiler-errors Typo suggestion for a variable with a name similar to struct fields closes #97133
2022-05-24Auto merge of #97272 - jackh726:ban-compare-mode-nll, r=Mark-Simulacrumbors-5/+4
Disallow compare-mode=nll test differences This ensures that new tests don't get added not as revisions if they have nll output. This will make stabilization PR easier. r? `@Mark-Simulacrum`
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-2/+2
2022-05-23Rollup merge of #97309 - JohnTitor:issue-90400, r=compiler-errorsDylan DPC-0/+106
Add some regression tests for #90400 This adds two regression tests taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836. Note that we cannot close the issue right now as the [original code](https://github.com/rust-lang/rust/issues/90400#issue-1039577786) still triggers an ICE. r? `@compiler-errors`
2022-05-23add typo suggestions for all `AssocSuggestion` variantsTakayuki Maeda-4/+104
2022-05-23Add some regression tests for #90400Yuki Okushi-0/+106
2022-05-23Rollup merge of #97303 - compiler-errors:arg-typos, r=jackh726Dylan DPC-1/+26
Fix some typos in arg checking algorithm Fixes #97197 Also fixes a typo where if we're missing args A, B, C, we actually say A, B, B
2022-05-23Rollup merge of #97271 - JohnTitor:issue-91949, r=compiler-errorsDylan DPC-0/+55
Add regression test for #91949 Closes #91949 This needs `build-fail` because the original bug only appeared with `cargo build`. r? `@compiler-errors`
2022-05-23Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillotDylan DPC-23/+1
Remove feature: `crate` visibility modifier FCP completed in #53120.
2022-05-22Fix some typos in arg checking algorithmMichael Goulet-1/+26
2022-05-22Disallow non-same compare-mode-nllJack Huey-5/+4
2022-05-23Auto merge of #96455 - dtolnay:writetmp, r=m-ou-sebors-0/+70
Make write/print macros eagerly drop temporaries This PR fixes the 2 regressions in #96434 (`println` and `eprintln`) and changes all the other similar macros (`write`, `writeln`, `print`, `eprint`) to match the old pre-#94868 behavior of `println` and `eprintln`. argument position | before #94868 | after #94868 | after this PR --- |:---:|:---:|:---: `write!($tmp, "…", …)` | :rage: | :rage: | :smiley_cat: `write!(…, "…", $tmp)` | :rage: | :rage: | :smiley_cat: `writeln!($tmp, "…", …)` | :rage: | :rage: | :smiley_cat: `writeln!(…, "…", $tmp)` | :rage: | :rage: | :smiley_cat: `print!("…", $tmp)` | :rage: | :rage: | :smiley_cat: `println!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat: `eprint!("…", $tmp)` | :rage: | :rage: | :smiley_cat: `eprintln!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat: `panic!("…", $tmp)` | :smiley_cat: | :smiley_cat: | :smiley_cat: Example of code that is affected by this change: ```rust use std::sync::Mutex; fn main() { let mutex = Mutex::new(0); print!("{}", mutex.lock().unwrap()) /* no semicolon */ } ``` You can see several real-world examples like this in the Crater links at the top of #96434. This code failed to compile prior to this PR as follows, but works after this PR. ```console error[E0597]: `mutex` does not live long enough --> src/main.rs:5:18 | 5 | print!("{}", mutex.lock().unwrap()) /* no semicolon */ | ^^^^^^^^^^^^--------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... 6 | } | - | | | `mutex` dropped here while still borrowed | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard` ```
2022-05-22Add test of temporaries inside format_args of core/std macrosDavid Tolnay-0/+70
2022-05-22Use revisions for NLL in lifetimesJack Huey-145/+398
2022-05-22Use revisions for NLL in suggestionsJack Huey-93/+330
2022-05-22Use revisions for NLL in issuesJack Huey-78/+159
2022-05-22Use revisions for NLL in hrtbJack Huey-71/+95
2022-05-22Use revisions for NLL in traitsJack Huey-26/+110
2022-05-22Use revisions for NLL in async-awaitJack Huey-31/+76
2022-05-22Use revisions or ignore-compare-mode-nll for NLL in generic-associated-typesJack Huey-44/+26
2022-05-22Use revisions for NLL in generatorJack Huey-24/+39
2022-05-22Use revisions for NLL in various directoriesJack Huey-120/+180
2022-05-22Use revisions for NLL in object-lifetimeJack Huey-35/+67
2022-05-22Use revisions for NLL in borrowckJack Huey-26/+121
2022-05-22Use revisions for NLL in const-generics and matchJack Huey-14/+30
2022-05-22Use revisions for NLL in closuresJack Huey-18/+36
2022-05-22Use revisions for NLL in associated-typesJack Huey-130/+280
2022-05-22Use revisions for NLL in nllJack Huey-41/+48
2022-05-22Use revisions for NLL in impl-traitJack Huey-45/+65
2022-05-22Use revisions for NLL (consistently) in higher-ranked-trait-boundsJack Huey-27/+49
2022-05-22For hr-subtype test, use check-pass instead of rustc_error and split nll ↵Jack Huey-112/+164
differences to separate test
2022-05-22Rollup merge of #97206 - jackh726:issue-73154, r=nikomatsakisJack Huey-200/+166
Do leak check after function pointer coercion cc #73154 I still need to clean diagnostics just a tad, but figured I would put this up anyways. This change is made in order to make match arm coercion order-independent. Basically, any time we do function pointer coercion, we follow it by doing a leak check. This is necessary because the LUB code doesn't handler higher-ranked things correctly, leading us to "coerce", but use the wrong type. A proper fix is to actually fix that code (so the type returned by `unify_and` is a supertype of both `a` and `b` if `Ok`). However, that requires a more in-depth fix, likely heavily overlapping with the new subtyping changes. Here, I've been conservative and error early if we generate unsatisfiable constraints. Note, this should *mostly* only affect NLL, since migrate mode falls back to the LUB implementation (followed by leak check), whereas NLL only does sub. There could be other coercion code that has an order-dependence where a leak check in the coercion code might be useful. However, this is more of a spot-fix for #73154 than a "permanent" fix, since we likely want to go the other way long-term, and allow this pattern without error. r? `@nikomatsakis`
2022-05-22Rollup merge of #97043 - c410-f3r:z-errors, r=petrochenkovJack Huey-0/+0
Move some tests to more reasonable directories r? `@petrochenkov`
2022-05-22Do leak check after function ptr coercionJack Huey-200/+166
2022-05-22Add regression test for #91949Yuki Okushi-0/+55
2022-05-22Auto merge of #97177 - oli-obk:const-stability, r=davidtwcobors-120/+157
Implement proper stability check for const impl Trait, fall back to unstable const when undeclared Continuation of #93960 `@jhpratt` it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?
2022-05-22Rollup merge of #97236 - cjgillot:recover-lifetime-res, r=jackh726Yuki Okushi-0/+83
Recover when resolution did not resolve lifetimes. This can happen for items inside a foreign fn's body, which are not visited at all. Fixes https://github.com/rust-lang/rust/issues/97193 Fixes https://github.com/rust-lang/rust/issues/97194
2022-05-21Auto merge of #96515 - lcnr:user-types-in-pat, r=nikomatsakisbors-46/+201
correctly deal with user type ascriptions in pat supersedes #93856 `thir::PatKind::AscribeUserType` previously resulted in `CanonicalUserTypeAnnotations` where the inferred type already had a subtyping relation according to `variance` to the `user_ty`. The bug can pretty much be summarized as follows: - during mir building - `user_ty -> inferred_ty`: considers variance - `StatementKind::AscribeUserType`: `inferred_ty` is the type of the place, so no variance needed - during mir borrowck - `user_ty -> inferred_ty`: does not consider variance - `StatementKind::AscribeUserType`: applies variance This mostly worked fine. The lifetimes in `inferred_ty` were only bound by its relation to `user_ty` and to the `place` of `StatementKind::AscribeUserType`, so it doesn't matter where exactly the subtyping happens. It does however matter when having higher ranked subtying. At this point the place where the subtyping happens is forced, causing this mismatch between building and borrowck to result in unintended errors. cc #96514 which is pretty much the same issue r? `@nikomatsakis`
2022-05-21Remove feature: `crate` visibility modifierJacob Pratt-23/+1
2022-05-21update nll testslcnr-0/+47
2022-05-21Rollup merge of #97237 - oberien:patch-1, r=Dylan-DPCGuillaume Gomez-1/+27
Add some more weird-exprs Continuing from https://github.com/rust-lang/rust/pull/86713 (which stalled due to a thinking emoji), I'd like to "improve" the `weird-exprs.rs`-file (as I can't reopen that PR).
2022-05-21Recover when resolution did not resolve lifetimes.Camille GILLOT-0/+83
2022-05-21Auto merge of #97239 - jhpratt:remove-crate-vis, r=joshtriplettbors-339/+107
Remove `crate` visibility modifier FCP to remove this syntax is just about complete in #53120. Once it completes, this should be merged ASAP to avoid merge conflicts. The first two commits remove usage of the feature in this repository, while the last removes the feature itself.
2022-05-21update mir user type printing and apparently fix an ICElcnr-46/+8
2022-05-21correctly deal with user type ascriptions in patlcnr-0/+146
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-339/+107
2022-05-21Auto merge of #96923 - eholk:fix-fake-read, r=nikomatsakisbors-0/+41
Drop Tracking: Implement `fake_read` callback This PR updates drop tracking's use of `ExprUseVisitor` so that we treat `fake_read` events as borrows. Without doing this, we were not handling match expressions correctly, which showed up as a breakage in the `addassign-yield.rs` test. We did not previously notice this because we still had rather large temporary scopes that we held borrows for, which changed in #94309. This PR also includes a variant of the `addassign-yield.rs` test case to make sure we continue to have correct behavior here with drop tracking. r? `@nikomatsakis`
2022-05-21typo suggestion for a variable with a name similar to struct fieldsTakayuki Maeda-0/+55