mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +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
|
||||
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 {
|
||||
hir::GenericParamKind::Type { .. } => true,
|
||||
_ => false
|
||||
|
@ -101,4 +101,10 @@ pub trait TraitWithNew: Sized {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IgnoreUnsafeNew;
|
||||
|
||||
impl IgnoreUnsafeNew {
|
||||
pub unsafe fn new() -> Self { IgnoreUnsafeNew }
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user