Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 10 additions & 10 deletions compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Next, let's construct the error
let (error_span, full_call_span, ctor_of) = match &call_expr.kind {
hir::ExprKind::Call(
hir::Expr {
span,
kind:
hir::ExprKind::Path(hir::QPath::Resolved(
_,
hir::Path { res: Res::Def(DefKind::Ctor(of, _), _), .. },
)),
..
},
hir::Expr { hir_id, span, kind: hir::ExprKind::Path(qpath), .. },
_,
) => (call_span, *span, Some(of)),
) => {
if let Res::Def(DefKind::Ctor(of, _), _) =
self.typeck_results.borrow().qpath_res(qpath, *hir_id)
{
(call_span, *span, Some(of))
} else {
(call_span, *span, None)
}
}
hir::ExprKind::Call(hir::Expr { span, .. }, _) => (call_span, *span, None),
hir::ExprKind::MethodCall(path_segment, _, span) => {
let ident_span = path_segment.ident.span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | fn ts_variant() {
LL | Self::TSVariant(());
| --------------- ^^ expected type parameter `T`, found `()`
| |
| arguments to this function are incorrect
| arguments to this enum variant are incorrect
|
= note: expected type parameter `T`
found unit type `()`
Expand Down Expand Up @@ -55,7 +55,7 @@ LL | impl<T> Enum<T> {
LL | Self::<()>::TSVariant(());
| --------------------- ^^ expected type parameter `T`, found `()`
| |
| arguments to this function are incorrect
| arguments to this enum variant are incorrect
|
= note: expected type parameter `T`
found unit type `()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ impl E2 {
}

fn main() {
<E>::V(); //~ ERROR this function takes 1 argument but 0 arguments were supplied
<E>::V(); //~ ERROR this enum variant takes 1 argument but 0 arguments were supplied
let _: u8 = <E2>::V; //~ ERROR mismatched types
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0061]: this function takes 1 argument but 0 arguments were supplied
error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied
--> $DIR/enum-variant-priority-higher-than-other-inherent.rs:21:5
|
LL | <E>::V();
Expand Down