-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Require TAITs to appear in the signature of items that register a hidden type #107809
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
Closed
oli-obk
wants to merge
7
commits into
rust-lang:master
from
oli-obk:reject_tait_defining_scopes_unless_in_sig
Closed
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
73cfef3
equire TAITs to appear in the signature of items that register a hidd…
oli-obk 0e5d7b8
Restrict TAITs to argument and return types only and add an additiona…
oli-obk 86a360d
Add a test for sibling items in trait impls
oli-obk 375dfa4
Make closures and anon consts report that their parent item is the on…
oli-obk bd86dcb
Remove a bogus file
oli-obk d715644
Fix a typo
oli-obk 733e444
Prevent defining opaque types in nested items
oli-obk 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() {} | ||
|
||
type Foo = impl std::fmt::Display; | ||
|
||
fn bar() { | ||
pub fn foo() -> Foo { | ||
"foo" | ||
//~^ ERROR: opaque type constrained in nested item | ||
} | ||
} | ||
|
||
fn baz() -> Foo { | ||
pub fn foo() -> Foo { | ||
"foo" | ||
//~^ ERROR: opaque type constrained in nested item | ||
} | ||
"baz" | ||
} | ||
|
||
struct Bak { | ||
x: [u8; { | ||
fn blob() -> Foo { | ||
"blob" | ||
//~^ ERROR: opaque type constrained in nested item | ||
} | ||
5 | ||
}], | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/ui/type-alias-impl-trait/defining-use-item-child.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,26 @@ | ||
error: opaque type constrained in nested item | ||
--> $DIR/defining-use-item-child.rs:9:9 | ||
| | ||
LL | pub fn foo() -> Foo { | ||
| ------------------- this item is not a sibling of the opaque type | ||
LL | "foo" | ||
| ^^^^^ | ||
|
||
error: opaque type constrained in nested item | ||
--> $DIR/defining-use-item-child.rs:16:9 | ||
| | ||
LL | pub fn foo() -> Foo { | ||
| ------------------- this item is not a sibling of the opaque type | ||
LL | "foo" | ||
| ^^^^^ | ||
|
||
error: opaque type constrained in nested item | ||
--> $DIR/defining-use-item-child.rs:25:13 | ||
| | ||
LL | fn blob() -> Foo { | ||
| ---------------- this item is not a sibling of the opaque type | ||
LL | "blob" | ||
| ^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.