From b86a65d39b6d06fe0986f0735d33b907b1025c60 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Tue, 2 Jan 2018 09:08:49 -0800 Subject: [PATCH] Limit style lint to non-synthetic generic params --- src/librustc_lint/bad_style.rs | 4 +++- src/test/run-pass/issue-46959.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/test/run-pass/issue-46959.rs diff --git a/src/librustc_lint/bad_style.rs b/src/librustc_lint/bad_style.rs index 0303b503691..494bbfa297e 100644 --- a/src/librustc_lint/bad_style.rs +++ b/src/librustc_lint/bad_style.rs @@ -128,7 +128,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes { fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) { if let hir::GenericParam::Type(ref gen) = *param { - self.check_case(cx, "type parameter", gen.name, gen.span); + if gen.synthetic.is_none() { + self.check_case(cx, "type parameter", gen.name, gen.span); + } } } } diff --git a/src/test/run-pass/issue-46959.rs b/src/test/run-pass/issue-46959.rs new file mode 100644 index 00000000000..0826f5e4923 --- /dev/null +++ b/src/test/run-pass/issue-46959.rs @@ -0,0 +1,20 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(universal_impl_trait)] +#![feature(conservative_impl_trait)] +#![deny(non_camel_case_types)] + +#[allow(dead_code)] +fn qqq(lol: impl Iterator) -> impl Iterator { + lol.map(|x|x as u64) +} + +fn main() {}