about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-04 03:12:39 +0000
committerbors <bors@rust-lang.org>2018-01-04 03:12:39 +0000
commit608aae904b14efd09b4f95d9f4c3f030e6a34f95 (patch)
tree7490f6120fa99e43619981da3ebf9d7b160ed1f4
parent0a3761e63e5961ddd6ae5b9923e7a3c0725541f8 (diff)
parentb86a65d39b6d06fe0986f0735d33b907b1025c60 (diff)
downloadrust-608aae904b14efd09b4f95d9f4c3f030e6a34f95.tar.gz
rust-608aae904b14efd09b4f95d9f4c3f030e6a34f95.zip
Auto merge of #47132 - cramertj:impl-trait-camel-case, r=nikomatsakis
Limit style lint to non-synthetic generic params

Fix https://github.com/rust-lang/rust/issues/46959

r? @nikomatsakis
-rw-r--r--src/librustc_lint/bad_style.rs4
-rw-r--r--src/test/run-pass/issue-46959.rs20
2 files changed, 23 insertions, 1 deletions
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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Item=u32>) -> impl Iterator<Item=u64> {
+        lol.map(|x|x as u64)
+}
+
+fn main() {}