Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions compiler/rustc_trait_selection/src/traits/specialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,17 +472,11 @@ pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Opti
let mut types_without_default_bounds = FxIndexSet::default();
let sized_trait = tcx.lang_items().sized_trait();

if !args.is_empty() {
let arg_names = args.iter().map(|k| k.to_string()).filter(|k| k != "'_").collect::<Vec<_>>();
if !arg_names.is_empty() {
types_without_default_bounds.extend(args.types());
w.push('<');
w.push_str(
&args
.iter()
.map(|k| k.to_string())
.filter(|k| k != "'_")
.collect::<Vec<_>>()
.join(", "),
);
w.push_str(&arg_names.join(", "));
w.push('>');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/inference/issue-72616.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LL | if String::from("a") == "a".try_into().unwrap() {}
| ^^^^^^^^
|
= note: multiple `impl`s satisfying `_: TryFrom<&str>` found in the following crates: `core`, `std`:
- impl<> TryFrom<&str> for std::sys_common::net::LookupHost;
- impl TryFrom<&str> for std::sys_common::net::LookupHost;
- impl<T, U> TryFrom<U> for T
where U: Into<T>;
= note: required for `&str` to implement `TryInto<_>`
Expand Down
28 changes: 14 additions & 14 deletions tests/ui/inference/issue-72690.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:7:22
Expand Down Expand Up @@ -74,8 +74,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:21:22
Expand All @@ -100,8 +100,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:28:22
Expand All @@ -126,8 +126,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:37:22
Expand All @@ -152,8 +152,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:46:22
Expand All @@ -178,8 +178,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:53:22
Expand All @@ -204,8 +204,8 @@ LL | String::from("x".as_ref());
| ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- impl<> From<&String> for String;
- impl<> From<&str> for String;
- impl From<&String> for String;
- impl From<&str> for String;

error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:62:22
Expand Down