-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Do not use non-wf input expectations from fudge when checking function calls #150316
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
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
86d2cf1
Add tests for issue number 89299 and 149881
ShoyuVanilla dadf2ee
Do not use ill-formed input expectations when checking function calls
ShoyuVanilla 94e58c0
fix fudging
lcnr bec4304
Clarify old solver behavior with revisions in a test
ShoyuVanilla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-149881.current.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time | ||
| --> $DIR/expectated-input-not-satisfying-fn-bounds-issue-149881.rs:15:24 | ||
| | | ||
| LL | <[_]>::into_vec(id(Box::new([0, 1, 2]))); | ||
| | -- ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | | | ||
| | required by a bound introduced by this call | ||
| | | ||
| = help: the trait `Sized` is not implemented for `[{integer}]` | ||
| note: required by an implicit `Sized` bound in `id` | ||
| --> $DIR/expectated-input-not-satisfying-fn-bounds-issue-149881.rs:10:7 | ||
| | | ||
| LL | fn id<T>(x: Box<T>) -> Box<T> { | ||
| | ^ required by the implicit `Sized` requirement on this type parameter in `id` | ||
| help: consider relaxing the implicit `Sized` restriction | ||
| | | ||
| LL | fn id<T: ?Sized>(x: Box<T>) -> Box<T> { | ||
| | ++++++++ | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0277`. |
22 changes: 22 additions & 0 deletions
22
...ercion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-149881.next.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time | ||
| --> $DIR/expectated-input-not-satisfying-fn-bounds-issue-149881.rs:15:24 | ||
| | | ||
| LL | <[_]>::into_vec(id(Box::new([0, 1, 2]))); | ||
| | -- ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | | | ||
| | required by a bound introduced by this call | ||
| | | ||
| = help: the trait `Sized` is not implemented for `[{integer}]` | ||
| note: required by an implicit `Sized` bound in `id` | ||
| --> $DIR/expectated-input-not-satisfying-fn-bounds-issue-149881.rs:10:7 | ||
| | | ||
| LL | fn id<T>(x: Box<T>) -> Box<T> { | ||
| | ^ required by the implicit `Sized` requirement on this type parameter in `id` | ||
| help: consider relaxing the implicit `Sized` restriction | ||
| | | ||
| LL | fn id<T: ?Sized>(x: Box<T>) -> Box<T> { | ||
| | ++++++++ | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0277`. |
17 changes: 17 additions & 0 deletions
17
tests/ui/coercion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-149881.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //@ revisions: current next | ||
| //@ ignore-compare-mode-next-solver (explicit revisions) | ||
| //@[next] compile-flags: -Znext-solver | ||
|
|
||
| // FIXME(#149379): This should pass, but fails due to fudged expactation | ||
| // types which are potentially not well-formed or for whom the function | ||
| // where-bounds don't actually hold. And this results in weird bugs when | ||
| // later treating these expectations as if they were actually correct.. | ||
|
|
||
| fn id<T>(x: Box<T>) -> Box<T> { | ||
| x | ||
| } | ||
|
|
||
| fn main() { | ||
| <[_]>::into_vec(id(Box::new([0, 1, 2]))); | ||
| //~^ ERROR: the size for values of type `[{integer}]` cannot be known at compilation time | ||
| } |
16 changes: 16 additions & 0 deletions
16
...cion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-89299.current.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| error[E0277]: `dyn Trait + Send` cannot be unpinned | ||
| --> $DIR/expectated-input-not-satisfying-fn-bounds-issue-89299.rs:20:27 | ||
| | | ||
| LL | let _x = Foo(Pin::new(&mut a)); | ||
| | -------- ^^^^^^ the trait `Unpin` is not implemented for `dyn Trait + Send` | ||
| | | | ||
| | required by a bound introduced by this call | ||
| | | ||
| = note: consider using the `pin!` macro | ||
| consider using `Box::pin` if you need to access the pinned value outside of the current scope | ||
| note: required by a bound in `Pin::<Ptr>::new` | ||
| --> $SRC_DIR/core/src/pin.rs:LL:COL | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0277`. |
16 changes: 16 additions & 0 deletions
16
...oercion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-89299.next.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| error[E0277]: `dyn Trait + Send` cannot be unpinned | ||
| --> $DIR/expectated-input-not-satisfying-fn-bounds-issue-89299.rs:20:27 | ||
| | | ||
| LL | let _x = Foo(Pin::new(&mut a)); | ||
| | -------- ^^^^^^ the trait `Unpin` is not implemented for `dyn Trait + Send` | ||
| | | | ||
| | required by a bound introduced by this call | ||
| | | ||
| = note: consider using the `pin!` macro | ||
| consider using `Box::pin` if you need to access the pinned value outside of the current scope | ||
| note: required by a bound in `Pin::<Ptr>::new` | ||
| --> $SRC_DIR/core/src/pin.rs:LL:COL | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0277`. |
22 changes: 22 additions & 0 deletions
22
tests/ui/coercion/fudge-inference/expectated-input-not-satisfying-fn-bounds-issue-89299.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //@ revisions: current next | ||
| //@ ignore-compare-mode-next-solver (explicit revisions) | ||
| //@[next] compile-flags: -Znext-solver | ||
|
|
||
| // FIXME(#149379): This should pass, but fails due to fudged expactation | ||
| // types which are potentially not well-formed or for whom the function | ||
| // where-bounds don't actually hold. And this results in weird bugs when | ||
| // later treating these expectations as if they were actually correct.. | ||
|
|
||
| use std::pin::Pin; | ||
|
|
||
| trait Trait {} | ||
|
|
||
| impl Trait for i32 {} | ||
|
|
||
| struct Foo<'a>(Pin<&'a mut (dyn Trait + Send)>); | ||
|
|
||
| fn main() { | ||
| let mut a = 1; | ||
| let _x = Foo(Pin::new(&mut a)); | ||
| //~^ ERROR: `dyn Trait + Send` cannot be unpinned | ||
| } |
32 changes: 0 additions & 32 deletions
32
...on/fudge-inference/fn-ret-trait-object-propagated-to-inputs-issue-149379-1.current.stderr
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...rcion/fudge-inference/fn-ret-trait-object-propagated-to-inputs-issue-149379-1.next.stderr
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why this?
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.
My intention was to check well-formedness of expected input tys and I thought this would do the thing as they are equated with formal input tys.
But it might be more correct to check them separately outside the fudge
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.
Kinda related to #150316 (comment), I think this former implementation would be simpler and correct 😅