Skip to content

relaxing a non-Sized bounds is a hard-warning #135809

Closed
@lcnr

Description

@lcnr

let mut seen_sized_unbound = false;
for unbound in unbounds {
if let Some(sized_def_id) = sized_def_id
&& unbound.trait_ref.path.res == Res::Def(DefKind::Trait, sized_def_id)
{
seen_sized_unbound = true;
continue;
}
// There was a `?Trait` bound, but it was not `?Sized`; warn.
self.dcx().span_warn(
unbound.span,
"relaxing a default bound only does something for `?Sized`; \
all other traits are not bound by default",
);
}

fn foo() -> impl ?Send {}
warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
 --> src/lib.rs:1:18
  |
1 | fn foo() -> impl ?Send {}
  |                  ^^^^^

This should either be a (future-compat) lint or a hard-error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions