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 6 pull requests #101575

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0126f7f
Allow lint passes to be bound by `TyCtxt`
Jarcho Sep 6, 2022
bdc865d
remove unnecessary `PartialOrd` and `Ord`
TaKO8Ki Sep 7, 2022
12ac36c
RPITIT placeholder items
compiler-errors Aug 31, 2022
f8a0f3a
Lower RPITIT to ImplTraitPlaceholder item
compiler-errors Aug 31, 2022
62ed2fe
Implement projection for ImplTraitPlaceholder
compiler-errors Aug 31, 2022
582efcc
Rustdoc support
compiler-errors Aug 31, 2022
15b8de8
Check that impl types actually satisfy RPITIT bounds
compiler-errors Aug 31, 2022
dffcca0
Add tests
compiler-errors Aug 31, 2022
57a56bd
Make clippy happy
compiler-errors Aug 31, 2022
d5a83c4
Make async fn in traits work
compiler-errors Sep 2, 2022
63360b0
Address rebase issues, make async fn in trait work
compiler-errors Sep 2, 2022
e41b430
Address nits
compiler-errors Sep 2, 2022
e032216
Bless tests, fix ICE with ImplTraitPlaceholder
compiler-errors Sep 2, 2022
0e53c86
Deeply check that method signatures match, and allow for nested RPITITs
compiler-errors Sep 2, 2022
2a4a0ec
Handle generic parameters.
cjgillot Sep 6, 2022
8bf0bab
Tweak feature error, add test
compiler-errors Sep 6, 2022
815f5b2
Appease clippy again
compiler-errors Sep 6, 2022
1c05205
Rebase fallout
compiler-errors Sep 8, 2022
09430b7
Adjust pretty printing of RPITITs
compiler-errors Sep 8, 2022
60b4958
translations(rustc_session): migrates session.rs and config.rs
beowolx Aug 26, 2022
0f06320
translations(rustc_session): migrate TargetDataLayout::parse
beowolx Sep 2, 2022
24de943
translations(rustc_session): remove lint allow rule to the methods ma…
beowolx Sep 5, 2022
ddb225f
fixes #101477: Recover from typo where == is used in place of =
chenyukang Sep 7, 2022
5c9d28d
Opaque types' generic params do not imply anything about their hidden…
oli-obk Jul 5, 2022
5cd3cc1
Uncomment unsound code example
oli-obk Aug 25, 2022
64d11fc
Clarify some diagnostic messages
oli-obk Aug 25, 2022
0e497a7
translations(rustc_session): migrates two diagnostics in session.rs
beowolx Sep 8, 2022
ac2d840
Rollup merge of #98933 - oli-obk:opaque_type_late_bound_lifetimes, r=…
Dylan-DPC Sep 8, 2022
8928eb4
Rollup merge of #101041 - LuisCardosoOliveira:translation-rename-attr…
Dylan-DPC Sep 8, 2022
5762de5
Rollup merge of #101224 - compiler-errors:rpitit, r=oli-obk
Dylan-DPC Sep 8, 2022
319a845
Rollup merge of #101501 - Jarcho:tcx_lint_passes, r=davidtwco
Dylan-DPC Sep 8, 2022
2fabb76
Rollup merge of #101515 - chenyukang:fix-101477, r=fee1-dead
Dylan-DPC Sep 8, 2022
2a49ae6
Rollup merge of #101545 - TaKO8Ki:remove-unnecessary-partialord-ord, …
Dylan-DPC Sep 8, 2022
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
4 changes: 2 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2367,9 +2367,9 @@ impl Async {
}

/// In this case this is an `async` return, the `NodeId` for the generated `impl Trait` item.
pub fn opt_return_id(self) -> Option<NodeId> {
pub fn opt_return_id(self) -> Option<(NodeId, Span)> {
match self {
Async::Yes { return_impl_trait_id, .. } => Some(return_impl_trait_id),
Async::Yes { return_impl_trait_id, span, .. } => Some((return_impl_trait_id, span)),
Async::No => None,
}
}
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_ast_lowering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,14 @@ pub struct InclusiveRangeWithNoEnd {
#[primary_span]
pub span: Span,
}

#[derive(SessionDiagnostic, Clone, Copy)]
#[diag(ast_lowering::trait_fn_async, code = "E0706")]
#[note]
#[note(ast_lowering::note2)]
pub struct TraitFnAsync {
#[primary_span]
pub fn_span: Span,
#[label]
pub span: Span,
}
5 changes: 3 additions & 2 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = self.lower_fn_decl(decl, None, FnDeclKind::Closure, None);
let fn_decl = self.lower_fn_decl(decl, None, fn_decl_span, FnDeclKind::Closure, None);

let c = self.arena.alloc(hir::Closure {
binder: binder_clause,
Expand Down Expand Up @@ -955,7 +955,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl = self.lower_fn_decl(&outer_decl, None, FnDeclKind::Closure, None);
let fn_decl =
self.lower_fn_decl(&outer_decl, None, fn_decl_span, FnDeclKind::Closure, None);

let c = self.arena.alloc(hir::Closure {
binder: binder_clause,
Expand Down
24 changes: 18 additions & 6 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let mut itctx = ImplTraitContext::Universal;
let (generics, decl) = this.lower_generics(generics, id, &mut itctx, |this| {
let ret_id = asyncness.opt_return_id();
this.lower_fn_decl(&decl, Some(id), FnDeclKind::Fn, ret_id)
this.lower_fn_decl(&decl, Some(id), fn_sig_span, FnDeclKind::Fn, ret_id)
});
let sig = hir::FnSig {
decl,
Expand Down Expand Up @@ -659,7 +659,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.lower_generics(generics, i.id, &mut itctx, |this| {
(
// Disallow `impl Trait` in foreign items.
this.lower_fn_decl(fdec, None, FnDeclKind::ExternFn, None),
this.lower_fn_decl(
fdec,
None,
sig.span,
FnDeclKind::ExternFn,
None,
),
this.lower_fn_params_to_names(fdec),
)
});
Expand Down Expand Up @@ -769,9 +775,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
(hir::Generics::empty(), hir::TraitItemKind::Const(ty, body), body.is_some())
}
AssocItemKind::Fn(box Fn { ref sig, ref generics, body: None, .. }) => {
let asyncness = sig.header.asyncness;
let names = self.lower_fn_params_to_names(&sig.decl);
let (generics, sig) =
self.lower_method_sig(generics, sig, i.id, FnDeclKind::Trait, None);
let (generics, sig) = self.lower_method_sig(
generics,
sig,
i.id,
FnDeclKind::Trait,
asyncness.opt_return_id(),
);
(generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(names)), false)
}
AssocItemKind::Fn(box Fn { ref sig, ref generics, body: Some(ref body), .. }) => {
Expand Down Expand Up @@ -1238,12 +1250,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
sig: &FnSig,
id: NodeId,
kind: FnDeclKind,
is_async: Option<NodeId>,
is_async: Option<(NodeId, Span)>,
) -> (&'hir hir::Generics<'hir>, hir::FnSig<'hir>) {
let header = self.lower_fn_header(sig.header);
let mut itctx = ImplTraitContext::Universal;
let (generics, decl) = self.lower_generics(generics, id, &mut itctx, |this| {
this.lower_fn_decl(&sig.decl, Some(id), kind, is_async)
this.lower_fn_decl(&sig.decl, Some(id), sig.span, kind, is_async)
});
(generics, hir::FnSig { header, decl, span: self.lower_span(sig.span) })
}
Expand Down
Loading