File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
compiler/rustc_builtin_macros/src Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -207,30 +207,30 @@ pub(crate) fn expand_test_or_bench(
207207 } ;
208208
209209 let test_fn = if is_bench {
210- // A simple ident for a lambda
211- let b = Ident :: from_str_and_span ( "b" , attr_sp ) ;
212-
210+ // avoid name collisions by using the function name within the identifier, see bug #148275
211+ let bencher_param =
212+ Ident :: from_str_and_span ( & format ! ( "__bench_{}" , fn_ . ident . name ) , attr_sp ) ;
213213 cx. expr_call (
214214 sp,
215215 cx. expr_path ( test_path ( "StaticBenchFn" ) ) ,
216216 thin_vec ! [
217217 // #[coverage(off)]
218- // |b | self::test::assert_test_result(
218+ // |__bench_fn_name | self::test::assert_test_result(
219219 coverage_off( cx. lambda1(
220220 sp,
221221 cx. expr_call(
222222 sp,
223223 cx. expr_path( test_path( "assert_test_result" ) ) ,
224224 thin_vec![
225- // super::$test_fn(b )
225+ // super::$test_fn(__bench_fn_name )
226226 cx. expr_call(
227227 ret_ty_sp,
228228 cx. expr_path( cx. path( sp, vec![ fn_. ident] ) ) ,
229- thin_vec![ cx. expr_ident( sp, b ) ] ,
229+ thin_vec![ cx. expr_ident( sp, bencher_param ) ] ,
230230 ) ,
231231 ] ,
232232 ) ,
233- b ,
233+ bencher_param ,
234234 ) ) , // )
235235 ] ,
236236 )
You can’t perform that action at this time.
0 commit comments