-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
fn foo() -> impl Iterator<Item = u8> + ?Send {
"".to_string().into_bytes().into_iter()
}
fn main() {
let x = foo();
}
// This warning is correct
warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
--> src/main.rs:1:13
|
1 | fn foo() -> impl Iterator<Item = u8> + ?Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// These errors aren't
error[E0277]: the size for values of type `impl Iterator+?Sized` cannot be known at compilation time
--> src/main.rs:1:13
|
1 | fn foo() -> impl Iterator<Item = u8> + ?Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `impl Iterator+?Sized`
= note: the return type of a function must have a statically known size
error[E0277]: the size for values of type `impl Iterator+?Sized` cannot be known at compilation time
--> src/main.rs:6:9
|
6 | let x = foo();
| ^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `impl Iterator+?Sized`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
error[E0277]: the size for values of type `impl Iterator+?Sized` cannot be known at compilation time
--> src/main.rs:6:13
|
6 | let x = foo();
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `impl Iterator+?Sized`
= note: the return type of a function must have a statically known size
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground`
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.