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

Rollup of 8 pull requests #127898

Merged
merged 20 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
538b31e
Make language around `ToOwned` for `BorrowedFd` more precise
tbu- Jun 28, 2024
2162f3f
Mention how you can go from `BorrowedFd` to `OwnedFd` and back
tbu- Jun 28, 2024
a651050
lift_to_tcx -> lift_to_interner
compiler-errors Jul 16, 2024
8d90f44
tcx -> cx in rustc_type_ir
compiler-errors Jul 16, 2024
0b5ce54
Fix relations
compiler-errors Jul 16, 2024
b84e2b7
Put the dots back
compiler-errors Jul 15, 2024
a9e1466
Add `llvm_components_contain` to `run-make-support`
Rejyr Jul 15, 2024
a8b6e3f
Migrate `atomic-lock-free` to `rmake`
Rejyr Jul 15, 2024
e38032f
Fix associated item removal suggestion
estebank Jul 9, 2024
8eb5185
Accurate `use` rename suggestion span
estebank Jul 10, 2024
be9d961
More accurate span for type parameter suggestion
estebank Jul 10, 2024
f6c4679
More accurate span for anonymous argument suggestion
estebank Jul 10, 2024
3aafbd2
Rollup merge of #127077 - tbu-:pr_doc_fd_to_owned, r=workingjubilee
matthiaskrgr Jul 18, 2024
97d5edf
Rollup merge of #127783 - compiler-errors:rtn-pretty, r=fee1-dead
matthiaskrgr Jul 18, 2024
2013bf9
Rollup merge of #127787 - Rejyr:migrate-atomic-lock-free-rmake, r=jie…
matthiaskrgr Jul 18, 2024
b2b14de
Rollup merge of #127810 - compiler-errors:less-tcx, r=lcnr
matthiaskrgr Jul 18, 2024
a13d7db
Rollup merge of #127878 - estebank:assoc-item-removal, r=fmease
matthiaskrgr Jul 18, 2024
b52883d
Rollup merge of #127886 - estebank:as-rename-suggestion, r=compiler-e…
matthiaskrgr Jul 18, 2024
d78be31
Rollup merge of #127888 - estebank:type-param-sugg, r=compiler-errors
matthiaskrgr Jul 18, 2024
77e5bbf
Rollup merge of #127889 - estebank:anon-arg-sugg, r=compiler-errors
matthiaskrgr Jul 18, 2024
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
Prev Previous commit
Next Next commit
Put the dots back
  • Loading branch information
compiler-errors committed Jul 17, 2024
commit b84e2b7c98c687b07e28458db1e8ca68157b0d15
7 changes: 5 additions & 2 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,11 +1214,14 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
&& let ty::Alias(_, alias_ty) =
self.tcx().fn_sig(fn_def_id).skip_binder().output().skip_binder().kind()
&& alias_ty.def_id == def_id
&& let generics = self.tcx().generics_of(fn_def_id)
// FIXME(return_type_notation): We only support lifetime params for now.
&& generics.own_params.iter().all(|param| matches!(param.kind, ty::GenericParamDefKind::Lifetime))
{
let num_args = self.tcx().generics_of(fn_def_id).count();
let num_args = generics.count();
write!(self, " {{ ")?;
self.print_def_path(fn_def_id, &args[..num_args])?;
write!(self, "() }}")?;
write!(self, "(..) }}")?;
}

Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ error: future cannot be sent between threads safely
LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is required by `impl Future<Output = Result<(), ()>>: Send`
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is required by `impl Future<Output = Result<(), ()>>: Send`
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:13:5
|
LL | T::method().await?;
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is not `Send`
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is not `Send`
note: required by a bound in `is_send`
--> $DIR/basic.rs:17:20
|
Expand Down
25 changes: 25 additions & 0 deletions tests/ui/associated-type-bounds/return-type-notation/display.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete

trait Trait {}
fn needs_trait(_: impl Trait) {}

trait Assoc {
fn method() -> impl Sized;
fn method_with_lt() -> impl Sized;
fn method_with_ty<T>() -> impl Sized;
fn method_with_ct<const N: usize>() -> impl Sized;
}

fn foo<T: Assoc>(t: T) {
needs_trait(T::method());
//~^ ERROR the trait bound
needs_trait(T::method_with_lt());
//~^ ERROR the trait bound
needs_trait(T::method_with_ty());
//~^ ERROR the trait bound
needs_trait(T::method_with_ct());
//~^ ERROR the trait bound
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/display.rs:1:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0277]: the trait bound `impl Sized { <T as Assoc>::method(..) }: Trait` is not satisfied
--> $DIR/display.rs:15:17
|
LL | needs_trait(T::method());
| ----------- ^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method(..) }`
| |
| required by a bound introduced by this call
|
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`

error[E0277]: the trait bound `impl Sized { <T as Assoc>::method_with_lt(..) }: Trait` is not satisfied
--> $DIR/display.rs:17:17
|
LL | needs_trait(T::method_with_lt());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method_with_lt(..) }`
| |
| required by a bound introduced by this call
|
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`

error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
--> $DIR/display.rs:19:17
|
LL | needs_trait(T::method_with_ty());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/display.rs:4:1
|
LL | trait Trait {}
| ^^^^^^^^^^^
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`

error[E0277]: the trait bound `impl Sized: Trait` is not satisfied
--> $DIR/display.rs:21:17
|
LL | needs_trait(T::method_with_ct());
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/display.rs:4:1
|
LL | trait Trait {}
| ^^^^^^^^^^^
note: required by a bound in `needs_trait`
--> $DIR/display.rs:5:24
|
LL | fn needs_trait(_: impl Trait) {}
| ^^^^^ required by this bound in `needs_trait`

error: aborting due to 4 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ LL | | }
LL | | });
| |______^ implementation of `Send` is not general enough
|
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>() }`, for any two lifetimes `'0` and `'1`...
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>() }`, for some specific lifetime `'2`
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>(..) }`, for any two lifetimes `'0` and `'1`...
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`

error: implementation of `Send` is not general enough
--> $DIR/issue-110963-early.rs:14:5
Expand All @@ -32,8 +32,8 @@ LL | | }
LL | | });
| |______^ implementation of `Send` is not general enough
|
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>() }`, for any two lifetimes `'0` and `'1`...
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>() }`, for some specific lifetime `'2`
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>(..) }`, for any two lifetimes `'0` and `'1`...
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 2 previous errors; 1 warning emitted
Expand Down
Loading