8000 Rollup of 5 pull requests by Dylan-DPC · Pull Request #99231 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 5 pull requests #99231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9395103
Give a better error when `x dist` fails for an optional tool
jyn514 Jul 11, 2022
40ae7b5
Parse closure binders
WaffleLapkin Jun 2, 2022
97fcead
--bless tests
WaffleLapkin Jun 2, 2022
f89ef3c
Comment out expr size check
WaffleLapkin Jul 12, 2022
c2dbd62
Lower closure binders to hir & properly check them
WaffleLapkin Jul 12, 2022
0c28484
make for<> in closures a possible place to suggest adding named lifetime
WaffleLapkin Jun 30, 2022
577f3c6
add test for implicit stuff in signatures of closures with `for<>`
WaffleLapkin Jun 24, 2022
3ebb852
Add `LifetimeBinderKind::Closure`
WaffleLapkin Jul 3, 2022
df4fee9
Add an indirection for closures in `hir::ExprKind`
WaffleLapkin Jul 11, 2022
d2923b4
Add back expr size checks
WaffleLapkin Jul 11, 2022
b504a18
implement rustfmt formatting for `for<>` closure binders
WaffleLapkin Jun 30, 2022
30a3673
Add rustfmt test for formatting `for<>` before closures
WaffleLapkin Jul 3, 2022
9aa142b
Fix clippy build
WaffleLapkin Jun 30, 2022
031b2c5
Always use CreateParameter mode for function definitions.
cjgillot Jun 19, 2022
c7ac816
Clippy fallout.
cjgillot Jun 4, 2022
3b1b38d
Bless ui-fulldeps tests.
cjgillot Jun 4, 2022
5a20834
Add feature gate.
cjgillot Jun 22, 2022
f94484f
reduce scope of allow(rustc::potential_query_instability) in rustc_span
NiklasJonsson Jul 10, 2022
d431338
Stabilize `core::ffi:c_*` and rexport in `std::ffi`
joshtriplett Jun 20, 2022
f5e9cb5
Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov
Dylan-DPC Jul 14, 2022
103b860
Rollup merge of #98315 - joshtriplett:stabilize-core-ffi-c, r=Mark-Si…
Dylan-DPC Jul 14, 2022
e5a86d7
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Dylan-DPC Jul 14, 2022
85159a4
Rollup merge of #99126 - NiklasJonsson:84447/rustc_span, r=petrochenkov
Dylan-DPC Jul 14, 2022
c1b43ef
Rollup merge of #99139 - jyn514:dist-tool-help, r=Mark-Simulacrum
Dylan-DPC Jul 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test for implicit stuff in signatures of closures with for<>
  • Loading branch information
WaffleLapkin committed Jul 12, 2022
commit 577f3c6f52f641a8a8f2b2e39ee9784bbf76d25d
27 changes: 27 additions & 0 deletions src/test/ui/closures/binder/implicit-stuff.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#![feature(closure_lifetime_binder)]

fn main() {
// Implicit types
let _ = for<> || {}; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> || -> &'a _ { &() }; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> |x| -> &'a () { x }; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> |x: &'a _| -> &'a () { x }; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> |x: &'a Vec::<_>| -> &'a Vec::<()> { x }; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> |x: &'a Vec<()>| -> &'a Vec<_> { x }; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> |x: &'a _| -> &'a &'a () { x }; //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _ = for<'a> |x: &'a _, y, z: _| -> &'a _ { //~ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
let _: &u8 = x;
let _: u32 = y;
let _: i32 = z;
x
};

// Lifetime elision
let _ = for<> |_: &()| -> () {}; //~ ERROR `&` without an explicit lifetime name cannot be used here
let _ = for<> |x: &()| -> &() { x }; //~ ERROR `&` without an explicit lifetime name cannot be used here
//~| ERROR `&` without an explicit lifetime name cannot be used here
let _ = for<> |x: &'_ ()| -> &'_ () { x }; //~ ERROR `'_` cannot be used here
//~| ERROR `'_` cannot be used here
let _ = for<'a> |x: &()| -> &'a () { x }; //~ ERROR `&` without an explicit lifetime name cannot be used here
let _ = for<'a> |x: &'a ()| -> &() { x }; //~ ERROR `&` without an explicit lifetime name cannot be used here
}
107 changes: 107 additions & 0 deletions src/test/ui/closures/binder/implicit-stuff.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/implicit-stuff.rs:20:23
|
LL | let _ = for<> |_: &()| -> () {};
| ^ explicit lifetime name needed here

error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/implicit-stuff.rs:21:23
|
LL | let _ = for<> |x: &()| -> &() { x };
| ^ explicit lifetime name needed here

error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/implicit-stuff.rs:21:31
|
LL | let _ = for<> |x: &()| -> &() { x };
| ^ explicit lifetime name needed here

error[E0637]: `'_` cannot be used here
--> $DIR/implicit-stuff.rs:23:24
|
LL | let _ = for<> |x: &'_ ()| -> &'_ () { x };
| ^^ `'_` is a reserved lifetime name

error[E0637]: `'_` cannot be used here
--> $DIR/implicit-stuff.rs:23:35
|
LL | let _ = for<> |x: &'_ ()| -> &'_ () { x };
| ^^ `'_` is a reserved lifetime name

error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/implicit-stuff.rs:25:25
|
LL | let _ = for<'a> |x: &()| -> &'a () { x };
| ^ explicit lifetime name needed here

error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/implicit-stuff.rs:26:36
|
LL | let _ = for<'a> |x: &'a ()| -> &() { x };
| ^ explicit lifetime name needed here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:5:22
|
LL | let _ = for<> || {};
| ----- ^
| |
| `for<...>` is here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:6:31
|
LL | let _ = for<'a> || -> &'a _ { &() };
| ------- ^
| |
| `for<...>` is here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:7:22
|
LL | let _ = for<'a> |x| -> &'a () { x };
| ------- ^
| |
| `for<...>` is here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:8:29
|
LL | let _ = for<'a> |x: &'a _| -> &'a () { x };
| ------- ^
| |
| `for<...>` is here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:9:35
|
LL | let _ = for<'a> |x: &'a Vec::<_>| -> &'a Vec::<()> { x };
| ------- ^
| |
| `for<...>` is here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:10:49
|
LL | let _ = for<'a> |x: &'a Vec<()>| -> &'a Vec<_> { x };
| ------- `for<...>` is here ^

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:11:29
|
LL | let _ = for<'a> |x: &'a _| -> &'a &'a () { x };
| ------- ^
| |
| `for<...>` is here

error: implicit types in closure signatures are forbidden when `for<...>` is present
--> $DIR/implicit-stuff.rs:12:29
|
LL | let _ = for<'a> |x: &'a _, y, z: _| -> &'a _ {
| ------- ^ ^ ^ ^
| |
| `for<...>` is here

error: aborting due to 15 previous errors

For more information about this error, try `rustc --explain E0637`.
0