mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
Fix ICE in needless_pass_by_value
with unsized dyn Fn
This commit is contained in:
parent
8b1ad17e5c
commit
1141c553d8
2 changed files with 7 additions and 1 deletions
|
@ -18,7 +18,7 @@ use rustc_middle::mir::FakeReadCause;
|
|||
use rustc_middle::ty::{self, TypeVisitable};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_span::{sym, Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::traits;
|
||||
use rustc_trait_selection::traits::misc::can_type_implement_copy;
|
||||
|
@ -186,6 +186,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
|
|||
if !is_self(arg);
|
||||
if !ty.is_mutable_ptr();
|
||||
if !is_copy(cx, ty);
|
||||
if ty.is_sized(cx.tcx.at(DUMMY_SP), cx.param_env);
|
||||
if !allowed_traits.iter().any(|&t| implements_trait(cx, ty, t, &[]));
|
||||
if !implements_borrow_trait;
|
||||
if !all_borrowable_trait;
|
||||
|
|
5
tests/ui/crashes/ice-9459.rs
Normal file
5
tests/ui/crashes/ice-9459.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#![feature(unsized_fn_params)]
|
||||
|
||||
pub fn f0(_f: dyn FnOnce()) {}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in a new issue