Skip to content
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

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

Open
lcnr opened this issue Jan 21, 2025 · 1 comment
Open

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

lcnr opened this issue Jan 21, 2025 · 1 comment
Labels
needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Jan 21, 2025

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.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 21, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Jan 21, 2025

this warning exists since pre 1.0 🤔

@fmease fmease added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants