Skip to content

Rollup of 6 pull requests #68852

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
933349e
Account for HKTB when suggesting introduction of named lifetime
estebank Jan 27, 2020
91a3172
Use spans for input borrowed types unrelated to return type
estebank Jan 27, 2020
d861bd4
When suggesting lifetimes, propose adding the new lifetime to all arg…
estebank Jan 27, 2020
dd8f02c
Suggest `'r` instead of `'lifetime`
estebank Jan 27, 2020
5453c03
review comments
estebank Jan 27, 2020
9af8a38
Account for `'_` in suggestions
estebank Jan 27, 2020
4bbd5d0
Account for `fn()` types in lifetime suggestions
estebank Jan 28, 2020
8a9a5a3
review comments: wording
estebank Jan 28, 2020
33513e6
review comments
estebank Jan 28, 2020
bedda9d
Move code to `diagnostics.rs`
estebank Jan 28, 2020
4310b74
Account for `impl Trait`
estebank Jan 30, 2020
b0a9e94
Strip unnecessary subexpression
ForNeVeR Feb 2, 2020
0eb297d
Fix up `merge_from_succ`.
nnethercote Feb 3, 2020
d62b6f2
Pull out a special case in `merge_from_succ`.
nnethercote Feb 3, 2020
11eee61
Clean up E0264, E0267 and E0268 explanations
GuillaumeGomez Feb 4, 2020
c0b7b41
parse_ty_common: use `enum`s instead of `bool`s.
Centril Jan 29, 2020
b2c6eeb
parser: merge `fn` grammars wrt. bodies & headers
Centril Jan 29, 2020
67c29ed
lowering: add recursion_limit = 256
Centril Feb 5, 2020
01dd376
`#![recursion_limit = "X"]`: note current crate name.
Centril Feb 5, 2020
bdeefc6
Rollup merge of #68583 - estebank:hrlt, r=oli-obk
Centril Feb 5, 2020
2716fa2
Rollup merge of #68762 - ForNeVeR:patch-1, r=alexcrichton
Centril Feb 5, 2020
bb8834f
Rollup merge of #68788 - Centril:unified-fn-bodies, r=petrochenkov
Centril Feb 5, 2020
a9cc6dc
Rollup merge of #68790 - nnethercote:improve-merge_from_succ, r=nikom…
Centril Feb 5, 2020
3b1def8
Rollup merge of #68832 - GuillaumeGomez:clean-up-3-err-codes, r=estebank
Centril Feb 5, 2020
d6f2935
Rollup merge of #68840 - Centril:rec-lim-curr-crate, r=estebank
Centril Feb 5, 2020
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 src/librustc/traits/error_reporting/suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1646,8 +1646,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let current_limit = self.tcx.sess.recursion_limit.get();
let suggested_limit = current_limit * 2;
err.help(&format!(
"consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate",
suggested_limit
"consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate (`{}`)",
suggested_limit, self.tcx.crate_name,
));
}
}
Expand Down
48 changes: 22 additions & 26 deletions src/librustc_ast_lowering/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_target::spec::abi;
use syntax::ast::*;
use syntax::attr;
use syntax::node_id::NodeMap;
use syntax::visit::{self, Visitor};
use syntax::visit::{self, AssocCtxt, Visitor};

use log::debug;
use smallvec::{smallvec, SmallVec};
Expand Down Expand Up @@ -81,25 +81,23 @@ impl<'a> Visitor<'a> for ItemLowerer<'a, '_, '_> {
}
}

fn visit_trait_item(&mut self, item: &'a AssocItem) {
self.lctx.with_hir_id_owner(item.id, |lctx| {
let hir_item = lctx.lower_trait_item(item);
let id = hir::TraitItemId { hir_id: hir_item.hir_id };
lctx.trait_items.insert(id, hir_item);
lctx.modules.get_mut(&lctx.current_module).unwrap().trait_items.insert(id);
fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
self.lctx.with_hir_id_owner(item.id, |lctx| match ctxt {
AssocCtxt::Trait => {
let hir_item = lctx.lower_trait_item(item);
let id = hir::TraitItemId { hir_id: hir_item.hir_id };
lctx.trait_items.insert(id, hir_item);
lctx.modules.get_mut(&lctx.current_module).unwrap().trait_items.insert(id);
}
AssocCtxt::Impl => {
let hir_item = lctx.lower_impl_item(item);
let id = hir::ImplItemId { hir_id: hir_item.hir_id };
lctx.impl_items.insert(id, hir_item);
lctx.modules.get_mut(&lctx.current_module).unwrap().impl_items.insert(id);
}
});

visit::walk_trait_item(self, item);
}

fn visit_impl_item(&mut self, item: &'a AssocItem) {
self.lctx.with_hir_id_owner(item.id, |lctx| {
let hir_item = lctx.lower_impl_item(item);
let id = hir::ImplItemId { hir_id: hir_item.hir_id };
lctx.impl_items.insert(id, hir_item);
lctx.modules.get_mut(&lctx.current_module).unwrap().impl_items.insert(id);
});
visit::walk_impl_item(self, item);
visit::walk_assoc_item(self, item, ctxt);
}
}

Expand Down Expand Up @@ -299,20 +297,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
// `impl Future<Output = T>` here because lower_body
// only cares about the input argument patterns in the function
// declaration (decl), not the return types.
let asyncness = header.asyncness.node;
let body_id =
this.lower_maybe_async_body(span, &decl, header.asyncness.node, Some(body));
this.lower_maybe_async_body(span, &decl, asyncness, body.as_deref());

let (generics, decl) = this.add_in_band_defs(
generics,
fn_def_id,
AnonymousLifetimeMode::PassThrough,
|this, idty| {
this.lower_fn_decl(
&decl,
Some((fn_def_id, idty)),
true,
header.asyncness.node.opt_return_id(),
)
let ret_id = asyncness.opt_return_id();
this.lower_fn_decl(&decl, Some((fn_def_id, idty)), true, ret_id)
},
);
let sig = hir::FnSig { decl, header: this.lower_fn_header(header) };
Expand Down Expand Up @@ -658,7 +653,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
ident: i.ident,
attrs: self.lower_attrs(&i.attrs),
kind: match i.kind {
ForeignItemKind::Fn(ref fdec, ref generics) => {
ForeignItemKind::Fn(ref sig, ref generics, _) => {
let fdec = &sig.decl;
let (generics, (fn_dec, fn_args)) = self.add_in_band_defs(
generics,
def_id,
Expand Down
28 changes: 9 additions & 19 deletions src/librustc_ast_lowering/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#![feature(array_value_iter)]
#![feature(crate_visibility_modifier)]
#![recursion_limit = "256"]

use rustc::arena::Arena;
use rustc::dep_graph::DepGraph;
Expand Down Expand Up @@ -63,7 +64,7 @@ use syntax::attr;
use syntax::node_id::NodeMap;
use syntax::token::{self, Nonterminal, Token};
use syntax::tokenstream::{TokenStream, TokenTree};
use syntax::visit::{self, Visitor};
use syntax::visit::{self, AssocCtxt, Visitor};
use syntax::walk_list;

use log::{debug, trace};
Expand Down Expand Up @@ -485,25 +486,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
});
}

fn visit_trait_item(&mut self, item: &'tcx AssocItem) {
fn visit_assoc_item(&mut self, item: &'tcx AssocItem, ctxt: AssocCtxt) {
self.lctx.allocate_hir_id_counter(item.id);

match item.kind {
AssocItemKind::Fn(_, None) => {
// Ignore patterns in trait methods without bodies
self.with_hir_id_owner(None, |this| visit::walk_trait_item(this, item));
}
_ => self.with_hir_id_owner(Some(item.id), |this| {
visit::walk_trait_item(this, item);
}),
}
}

fn visit_impl_item(&mut self, item: &'tcx AssocItem) {
self.lctx.allocate_hir_id_counter(item.id);
self.with_hir_id_owner(Some(item.id), |this| {
visit::walk_impl_item(this, item);
});
let owner = match (&item.kind, ctxt) {
// Ignore patterns in trait methods without bodies.
(AssocItemKind::Fn(_, None), AssocCtxt::Trait) => None,
_ => Some(item.id),
};
self.with_hir_id_owner(owner, |this| visit::walk_assoc_item(this, item, ctxt));
}

fn visit_foreign_item(&mut self, i: &'tcx ForeignItem) {
Expand Down
Loading