Skip to content

Syntactically invalid suggestion for "help: consider further restricting this bound" #93828

Closed
@dunglas

Description

@dunglas

Hi there!

Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a4dec9e7f93eb65805bcd2d986ba009e

extern crate async_trait;
extern crate reqwest;

use async_trait::async_trait;
use reqwest::{Client, IntoUrl};

#[async_trait]
pub trait ClientExt {
    async fn publish<T: IntoUrl>(&self, url: T) -> String;
}

#[async_trait]
impl ClientExt for Client {
    async fn publish<T: IntoUrl>(&self, url: T) -> String {
        "Foo".to_string()
    }
}

The current output is:

help: consider further restricting this bound
   |
14 |     async fn publish<T + std::marker::Send: IntoUrl>(&self, url: T) -> String {
   |                        +++++++++++++++++++

Ideally the output should look like:

help: consider further restricting this bound
   |
14 |     async fn publish<T: IntoUrl + std::marker::Send>(&self, url: T) -> String {
   |                                                    +++++++++++++++++++

The generated code is invalid, the restricting must be placed after the trait name.

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Feb 9, 2022
added a commit that references this issue on Mar 7, 2022
e34bdee
added a commit that references this issue on Mar 7, 2022
e488f79
compiler-errors

compiler-errors commented on Jun 20, 2022

@compiler-errors
Member

This was fixed in #93803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @dunglas@compiler-errors

      Issue actions

        Syntactically invalid suggestion for "help: consider further restricting this bound" · Issue #93828 · rust-lang/rust