mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
new_without_default should not warn about unsafe new
This commit is contained in:
@@ -116,6 +116,10 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
|
||||
// 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 @@ fn new() -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IgnoreUnsafeNew;
|
||||
|
||||
impl IgnoreUnsafeNew {
|
||||
pub unsafe fn new() -> Self { IgnoreUnsafeNew }
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
Reference in New Issue
Block a user