-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Extend E0623 for fn items #44516
Extend E0623 for fn items #44516
Conversation
self.depth -= 1; | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace
[00:04:19] tidy error: /checkout/src/librustc/infer/error_reporting/different_lifetimes.rs:213: trailing whitespace
BTW you could run the tidy test locally using
./x.py test src/tools/tidy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to handle TyTraitObject
(aka the Fn
in Box<Fn<(&u8, &u8)>>
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah at it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arielb1 need an example to test
y.b = x; | ||
======= | ||
x = y.b; | ||
>>>>>>> Adding E0623 for structs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
????
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERROR: merge conflict marker in file
hir::TyBareFn(_) => { | ||
self.depth += 1; | ||
intravisit::walk_ty(self, arg); | ||
self.depth -= 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No such field depth
. Do you mean the depth of the de Bruijn index or something?
[00:06:31] error[E0609]: no field `depth` on type `&mut infer::error_reporting::different_lifetimes::FindNestedTypeVisitor<'a, 'gcx, 'tcx>`
[00:06:31] --> /checkout/src/librustc/infer/error_reporting/different_lifetimes.rs:208:22
[00:06:31] |
[00:06:31] 208 | self.depth += 1;
[00:06:31] | ^^^^^
[00:06:31]
[00:06:31] error[E0609]: no field `depth` on type `&mut infer::error_reporting::different_lifetimes::FindNestedTypeVisitor<'a, 'gcx, 'tcx>`
[00:06:31] --> /checkout/src/librustc/infer/error_reporting/different_lifetimes.rs:210:22
[00:06:31] |
[00:06:31] 210 | self.depth -= 1;
[00:06:31] | ^^^^^
[00:06:31]
[00:06:41] error: aborting due to 2 previous errors
[00:06:41]
[00:06:41] error: Could not compile `rustc`.
15 | fn foo(mut x: Ref) { | ||
| --- | ||
| | | ||
| these two types are declared with different lifetimes... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case differs from actual output.
error[E0623]: lifetime mismatch
--> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11
|
15 | fn foo(mut x: Ref) {
| ---
| |
- | these two types are declared with different lifetimes...
+ | this type was declared with multiple lifetimes...
16 | x.a = x.b;
| ^^^ ...but data with one lifetime flows into the other here
@@ -0,0 +1,10 @@ | |||
error[E0623]: lifetime mismatch | |||
--> src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs:11:10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
error[E0623]: lifetime mismatch
- --> src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs:11:10
+ --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:10
|
10 | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
| --- --- these two types are declared with different lifetimes...
11 | y.push(z);
| ^ ...but data from `z` flows into `y` here
error: aborting due to previous error
@bors r+ |
📌 Commit e71eef1 has been approved by |
I think this doesn't handle the case of structs struct Ref<'a>(&'a ());
fn foo(x:fn(Ref, Ref), y: Vec<&u8>, z: &u8) {
y.push(z);
} |
@bors p=1 This is blocking further work |
@arielb1 it does though
|
Extend E0623 for fn items This fixes #44516 The below example now gives ``` error[E0623]: lifetime mismatch --> gg.rs:3:10 | 2 | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... 3 | y.push(z); | ^ ...but data from `z` flows into `y` here error: aborting due to previous error ``` r? @nikomatsakis cc @arielb1
☀️ Test successful - status-appveyor, status-travis |
@@ -0,0 +1,8 @@ | |||
|
|||
fn foo(x: fn(&u8, &u8), y: Vec<&u8>, z: &u8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you accidentially left this file in the root dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah. I'm open a PR for that or I have an ongoing PR, I'll make sure to delete that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #44549. Thanks!
This fixes #44516
The below example now gives
r? @nikomatsakis
cc @arielb1