review comments
This commit is contained in:
parent
c9d05aa9ce
commit
b21408527a
@ -2751,9 +2751,8 @@ pub enum Node<'hir> {
|
||||
Crate,
|
||||
}
|
||||
|
||||
impl<'hir> Node<'hir> {
|
||||
impl Node<'_> {
|
||||
pub fn ident(&self) -> Option<Ident> {
|
||||
|
||||
match self {
|
||||
Node::TraitItem(TraitItem { ident, .. }) |
|
||||
Node::ImplItem(ImplItem { ident, .. }) |
|
||||
|
@ -4736,25 +4736,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// First, store the "user substs" for later.
|
||||
self.write_user_type_annotation_from_substs(hir_id, def_id, substs, user_self_ty);
|
||||
|
||||
// Add all the obligations that are required, substituting and
|
||||
// normalized appropriately.
|
||||
let (bounds, spans) = self.instantiate_bounds(span, def_id, &substs);
|
||||
|
||||
for (i, mut obligation) in traits::predicates_for_generics(
|
||||
traits::ObligationCause::new(
|
||||
span,
|
||||
self.body_id,
|
||||
traits::ItemObligation(def_id),
|
||||
),
|
||||
self.param_env,
|
||||
&bounds,
|
||||
).into_iter().enumerate() {
|
||||
// This makes the error point at the bound, but we want to point at the argument
|
||||
if let Some(span) = spans.get(i) {
|
||||
obligation.cause.code = traits::BindingObligation(def_id, *span);
|
||||
}
|
||||
self.register_predicate(obligation);
|
||||
}
|
||||
self.add_required_obligations(span, def_id, &substs);
|
||||
|
||||
// Substitute the values for the type parameters into the type of
|
||||
// the referenced item.
|
||||
@ -4791,6 +4773,27 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
(ty_substituted, res)
|
||||
}
|
||||
|
||||
/// Add all the obligations that are required, substituting and normalized appropriately.
|
||||
fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) {
|
||||
let (bounds, spans) = self.instantiate_bounds(span, def_id, &substs);
|
||||
|
||||
for (i, mut obligation) in traits::predicates_for_generics(
|
||||
traits::ObligationCause::new(
|
||||
span,
|
||||
self.body_id,
|
||||
traits::ItemObligation(def_id),
|
||||
),
|
||||
self.param_env,
|
||||
&bounds,
|
||||
).into_iter().enumerate() {
|
||||
// This makes the error point at the bound, but we want to point at the argument
|
||||
if let Some(span) = spans.get(i) {
|
||||
obligation.cause.code = traits::BindingObligation(def_id, *span);
|
||||
}
|
||||
self.register_predicate(obligation);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_rustc_args_require_const(&self,
|
||||
def_id: DefId,
|
||||
hir_id: hir::HirId,
|
||||
|
@ -197,7 +197,7 @@ impl<'a> Parser<'a> {
|
||||
let (args, constraints) =
|
||||
self.parse_generic_args_with_leaning_angle_bracket_recovery(style, lo)?;
|
||||
self.expect_gt()?;
|
||||
let span = ident.span.to(self.prev_span);
|
||||
let span = lo.to(self.prev_span);
|
||||
AngleBracketedArgs { args, constraints, span }.into()
|
||||
} else {
|
||||
// `(T, U) -> R`
|
||||
|
@ -1,14 +1,14 @@
|
||||
error: field expressions may not have generic arguments
|
||||
--> $DIR/type-parameters-in-field-exprs.rs:13:7
|
||||
--> $DIR/type-parameters-in-field-exprs.rs:13:10
|
||||
|
|
||||
LL | f.x::<isize>;
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^
|
||||
|
||||
error: field expressions may not have generic arguments
|
||||
--> $DIR/type-parameters-in-field-exprs.rs:15:7
|
||||
--> $DIR/type-parameters-in-field-exprs.rs:15:10
|
||||
|
|
||||
LL | f.x::<>;
|
||||
| ^^^^^
|
||||
| ^^
|
||||
|
||||
error: field expressions may not have generic arguments
|
||||
--> $DIR/type-parameters-in-field-exprs.rs:17:7
|
||||
|
@ -1,14 +1,14 @@
|
||||
error: generic arguments in macro path
|
||||
--> $DIR/macro-ty-params.rs:10:5
|
||||
--> $DIR/macro-ty-params.rs:10:10
|
||||
|
|
||||
LL | foo::<T>!();
|
||||
| ^^^^^^^^
|
||||
| ^^^
|
||||
|
||||
error: generic arguments in macro path
|
||||
--> $DIR/macro-ty-params.rs:11:5
|
||||
--> $DIR/macro-ty-params.rs:11:10
|
||||
|
|
||||
LL | foo::<>!();
|
||||
| ^^^^^^^
|
||||
| ^^
|
||||
|
||||
error: unexpected generic arguments in path
|
||||
--> $DIR/macro-ty-params.rs:12:8
|
||||
@ -17,10 +17,10 @@ LL | m!(Default<>);
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: generic arguments in macro path
|
||||
--> $DIR/macro-ty-params.rs:12:8
|
||||
--> $DIR/macro-ty-params.rs:12:15
|
||||
|
|
||||
LL | m!(Default<>);
|
||||
| ^^^^^^^^^
|
||||
| ^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user