Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chrono compile-fail due to empty param_env #2786

merged 1 commit into from
May 21, 2018
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions clippy_lints/src/
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
let sugg = |db: &mut DiagnosticBuilder| {
if let ty::TypeVariants::TyAdt(def, ..) = ty.sty {
if let Some(span) = cx.tcx.hir.span_if_local(def.did) {
let param_env = ty::ParamEnv::empty();
if param_env.can_type_implement_copy(cx.tcx, ty).is_ok() {
if cx.param_env.can_type_implement_copy(cx.tcx, ty).is_ok() {
db.span_help(span, "consider marking this type as Copy");
Expand Down
19 changes: 19 additions & 0 deletions tests/run-pass/
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![allow(unused_variables, blacklisted_name, needless_pass_by_value, dead_code)]

// This should not compile-fail with:
// error[E0277]: the trait bound `T: Foo` is not satisfied
// See

trait Foo {
type Bar;

struct Baz<T: Foo> {
bar: T::Bar,

fn take<T: Foo>(baz: Baz<T>) {}

fn main() {}