Skip to content

Commit 8f77356

Browse files
committed
give full path of constraint in suggest_constraining_type_param
revert file bless with nll mode
1 parent 74874a6 commit 8f77356

File tree

90 files changed

+249
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+249
-247
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use std::fmt;
2828

2929
use super::InferCtxtPrivExt;
3030
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
31+
use rustc_middle::ty::print::with_no_trimmed_paths;
3132

3233
#[derive(Debug)]
3334
pub enum GeneratorInteriorOrUpvar {
@@ -440,7 +441,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
440441
{
441442
// Missing generic type parameter bound.
442443
let param_name = self_ty.to_string();
443-
let constraint = trait_ref.print_only_trait_path().to_string();
444+
let constraint =
445+
with_no_trimmed_paths(|| trait_ref.print_only_trait_path().to_string());
444446
if suggest_constraining_type_param(
445447
self.tcx,
446448
generics,

src/test/ui/associated-types/defaults-suitability.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ LL | type Bar: Clone = Vec<T>;
3131
= note: required because of the requirements on the impl of `Clone` for `Vec<T>`
3232
help: consider restricting type parameter `T`
3333
|
34-
LL | trait Foo<T: Clone> {
35-
| ^^^^^^^
34+
LL | trait Foo<T: std::clone::Clone> {
35+
| ^^^^^^^^^^^^^^^^^^^
3636

3737
error[E0277]: the trait bound `(): Foo<Self>` is not satisfied
3838
--> $DIR/defaults-suitability.rs:34:5
@@ -99,8 +99,8 @@ LL | type Baz = T;
9999
|
100100
help: consider further restricting type parameter `T`
101101
|
102-
LL | Self::Baz: Clone, T: Clone
103-
| ^^^^^^^^^^
102+
LL | Self::Baz: Clone, T: std::clone::Clone
103+
| ^^^^^^^^^^^^^^^^^^^^^^
104104

105105
error: aborting due to 8 previous errors
106106

src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | copy::<dyn Setup<From=T>>(t)
99
|
1010
help: consider restricting type parameter `T`
1111
|
12-
LL | pub fn copy_any<T: Copy>(t: &T) -> T {
13-
| ^^^^^^
12+
LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T {
13+
| ^^^^^^^^^^^^^^^^^^^
1414

1515
error: aborting due to previous error
1616

src/test/ui/associated-types/issue-43784-associated-type.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | type Assoc = T;
99
|
1010
help: consider restricting type parameter `T`
1111
|
12-
LL | impl<T: Copy> Complete for T {
13-
| ^^^^^^
12+
LL | impl<T: std::marker::Copy> Complete for T {
13+
| ^^^^^^^^^^^^^^^^^^^
1414

1515
error: aborting due to previous error
1616

src/test/ui/async-await/issue-70818.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ LL | async { (ty, ty1) }
1111
| ^^^ has type `U` which is not `Send`
1212
help: consider restricting type parameter `U`
1313
|
14-
LL | fn foo<T: Send, U: Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
15-
| ^^^^^^
14+
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
15+
| ^^^^^^^^^^^^^^^^^^^
1616

1717
error: aborting due to previous error
1818

src/test/ui/bad/bad-method-typaram-kind.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | 1.bar::<T>();
66
|
77
help: consider further restricting this bound
88
|
9-
LL | fn foo<T:'static + Send>() {
10-
| ^^^^^^
9+
LL | fn foo<T:'static + std::marker::Send>() {
10+
| ^^^^^^^^^^^^^^^^^^^
1111

1212
error: aborting due to previous error
1313

src/test/ui/bound-suggestions.fixed

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ use std::fmt::Debug;
55
// Rustfix should add this, or use `std::fmt::Debug` instead.
66

77
#[allow(dead_code)]
8-
fn test_impl(t: impl Sized + Debug) {
8+
fn test_impl(t: impl Sized + std::fmt::Debug) {
99
println!("{:?}", t);
1010
//~^ ERROR doesn't implement
1111
}
1212

1313
#[allow(dead_code)]
14-
fn test_no_bounds<T: Debug>(t: T) {
14+
fn test_no_bounds<T: std::fmt::Debug>(t: T) {
1515
println!("{:?}", t);
1616
//~^ ERROR doesn't implement
1717
}
1818

1919
#[allow(dead_code)]
20-
fn test_one_bound<T: Sized + Debug>(t: T) {
20+
fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
2121
println!("{:?}", t);
2222
//~^ ERROR doesn't implement
2323
}
2424

2525
#[allow(dead_code)]
26-
fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: Debug {
26+
fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
2727
println!("{:?} {:?}", x, y);
2828
//~^ ERROR doesn't implement
2929
}
3030

3131
#[allow(dead_code)]
32-
fn test_one_bound_where<X>(x: X) where X: Sized + Debug {
32+
fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
3333
println!("{:?}", x);
3434
//~^ ERROR doesn't implement
3535
}
3636

3737
#[allow(dead_code)]
38-
fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: Debug {
38+
fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
3939
println!("{:?}", x);
4040
//~^ ERROR doesn't implement
4141
}

src/test/ui/bound-suggestions.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ LL | println!("{:?}", t);
88
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
99
help: consider further restricting this bound
1010
|
11-
LL | fn test_impl(t: impl Sized + Debug) {
12-
| ^^^^^^^
11+
LL | fn test_impl(t: impl Sized + std::fmt::Debug) {
12+
| ^^^^^^^^^^^^^^^^^
1313

1414
error[E0277]: `T` doesn't implement `Debug`
1515
--> $DIR/bound-suggestions.rs:15:22
@@ -21,8 +21,8 @@ LL | println!("{:?}", t);
2121
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2222
help: consider restricting type parameter `T`
2323
|
24-
LL | fn test_no_bounds<T: Debug>(t: T) {
25-
| ^^^^^^^
24+
LL | fn test_no_bounds<T: std::fmt::Debug>(t: T) {
25+
| ^^^^^^^^^^^^^^^^^
2626

2727
error[E0277]: `T` doesn't implement `Debug`
2828
--> $DIR/bound-suggestions.rs:21:22
@@ -34,8 +34,8 @@ LL | println!("{:?}", t);
3434
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3535
help: consider further restricting this bound
3636
|
37-
LL | fn test_one_bound<T: Sized + Debug>(t: T) {
38-
| ^^^^^^^
37+
LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
38+
| ^^^^^^^^^^^^^^^^^
3939

4040
error[E0277]: `Y` doesn't implement `Debug`
4141
--> $DIR/bound-suggestions.rs:27:30
@@ -47,8 +47,8 @@ LL | println!("{:?} {:?}", x, y);
4747
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4848
help: consider further restricting type parameter `Y`
4949
|
50-
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: Debug {
51-
| ^^^^^^^^^^
50+
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
51+
| ^^^^^^^^^^^^^^^^^^^^
5252

5353
error[E0277]: `X` doesn't implement `Debug`
5454
--> $DIR/bound-suggestions.rs:33:22
@@ -60,8 +60,8 @@ LL | println!("{:?}", x);
6060
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
6161
help: consider further restricting this bound
6262
|
63-
LL | fn test_one_bound_where<X>(x: X) where X: Sized + Debug {
64-
| ^^^^^^^
63+
LL | fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
64+
| ^^^^^^^^^^^^^^^^^
6565

6666
error[E0277]: `X` doesn't implement `Debug`
6767
--> $DIR/bound-suggestions.rs:39:22
@@ -73,8 +73,8 @@ LL | println!("{:?}", x);
7373
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
7474
help: consider further restricting type parameter `X`
7575
|
76-
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: Debug {
77-
| ^^^^^^^^^^
76+
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
77+
| ^^^^^^^^^^^^^^^^^^^^
7878

7979
error[E0277]: the size for values of type `Self` cannot be known at compilation time
8080
--> $DIR/bound-suggestions.rs:44:46

src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ LL | impl <T: Sync+'static> Foo for (T,) { }
1010
= note: required because it appears within the type `(T,)`
1111
help: consider further restricting this bound
1212
|
13-
LL | impl <T: Sync+'static + Send> Foo for (T,) { }
14-
| ^^^^^^
13+
LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { }
14+
| ^^^^^^^^^^^^^^^^^^^
1515

1616
error[E0277]: `T` cannot be shared between threads safely
1717
--> $DIR/builtin-superkinds-double-superkind.rs:9:16
@@ -25,8 +25,8 @@ LL | impl <T: Send> Foo for (T,T) { }
2525
= note: required because it appears within the type `(T, T)`
2626
help: consider further restricting this bound
2727
|
28-
LL | impl <T: Send + Sync> Foo for (T,T) { }
29-
| ^^^^^^
28+
LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { }
29+
| ^^^^^^^^^^^^^^^^^^^
3030

3131
error: aborting due to 2 previous errors
3232

src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
1212
= note: required because it appears within the type `X<T>`
1313
help: consider further restricting this bound
1414
|
15-
LL | impl <T:Sync+'static + Send> RequiresRequiresShareAndSend for X<T> { }
16-
| ^^^^^^
15+
LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { }
16+
| ^^^^^^^^^^^^^^^^^^^
1717

1818
error: aborting due to previous error
1919

0 commit comments

Comments
 (0)