Skip to content

Commit a0c5c27

Browse files
committed
Fix bug when using generic args for unknown functions
1 parent 92101eb commit a0c5c27

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/librustc_typeck/collect.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11941194
}
11951195
bug!("there was no generic parameter associated with the arg");
11961196
}
1197+
Def::Err => tcx.types.err,
11971198
x => bug!("unexpected const parent path def {:?}", x),
11981199
}
11991200
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(const_generics)]
12+
13+
fn main() {
14+
find_me_not::<18>(); //~ ERROR cannot find function
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0425]: cannot find function `find_me_not` in this scope
2+
--> $DIR/const-arg-in-unknown-fn.rs:14:5
3+
|
4+
LL | find_me_not::<18>(); //~ ERROR cannot find function
5+
| ^^^^^^^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)