mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 11:04:03 +00:00
Merge pull request #3280 from d-dorazio/fix-new_without_default-should-not-fire-unsafe-new
new_without_default should not warn about unsafe new
This commit is contained in:
commit
63ceabf0cf
@ -116,6 +116,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
|||||||
// can't be implemented by default
|
// can't be implemented by default
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if sig.header.unsafety == hir::Unsafety::Unsafe {
|
||||||
|
// can't be implemented for unsafe new
|
||||||
|
return;
|
||||||
|
}
|
||||||
if impl_item.generics.params.iter().any(|gen| match gen.kind {
|
if impl_item.generics.params.iter().any(|gen| match gen.kind {
|
||||||
hir::GenericParamKind::Type { .. } => true,
|
hir::GenericParamKind::Type { .. } => true,
|
||||||
_ => false
|
_ => false
|
||||||
|
@ -101,4 +101,10 @@ pub trait TraitWithNew: Sized {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct IgnoreUnsafeNew;
|
||||||
|
|
||||||
|
impl IgnoreUnsafeNew {
|
||||||
|
pub unsafe fn new() -> Self { IgnoreUnsafeNew }
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user