1
Fork 0

Auto merge of #8134 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none
This commit is contained in:
bors 2021-12-17 12:24:03 +00:00
commit 23d11428de
32 changed files with 144 additions and 161 deletions

View file

@ -65,6 +65,7 @@ declare_clippy_lint! {
/// ```rust,no_run /// ```rust,no_run
/// # #![feature(asm)] /// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr(); /// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
/// # } /// # }
/// ``` /// ```
@ -72,6 +73,7 @@ declare_clippy_lint! {
/// ```rust,no_run /// ```rust,no_run
/// # #![feature(asm)] /// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr(); /// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
/// # } /// # }
/// ``` /// ```
@ -102,6 +104,7 @@ declare_clippy_lint! {
/// ```rust,no_run /// ```rust,no_run
/// # #![feature(asm)] /// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr(); /// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
/// # } /// # }
/// ``` /// ```
@ -109,6 +112,7 @@ declare_clippy_lint! {
/// ```rust,no_run /// ```rust,no_run
/// # #![feature(asm)] /// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr(); /// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
/// # } /// # }
/// ``` /// ```

View file

@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
if_chain! { if_chain! {
if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind; if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind;
if count.ident.name == sym!(count); if count.ident.name == sym::count;
if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind; if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind;
if filter.ident.name == sym!(filter); if filter.ident.name == sym!(filter);
if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind; if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind;

View file

@ -68,8 +68,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
let mut is_future = false; let mut is_future = false;
for &(p, _span) in preds { for &(p, _span) in preds {
let p = p.subst(cx.tcx, subst); let p = p.subst(cx.tcx, subst);
if let Some(trait_ref) = p.to_opt_poly_trait_ref() { if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
if Some(trait_ref.value.def_id()) == cx.tcx.lang_items().future_trait() { if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
is_future = true; is_future = true;
break; break;
} }

View file

@ -3,7 +3,6 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(in_band_lifetimes)] #![feature(in_band_lifetimes)]
#![feature(iter_zip)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]

View file

@ -13,7 +13,6 @@ use clippy_utils::{
strip_pat_refs, strip_pat_refs,
}; };
use clippy_utils::{paths, search_same, SpanlessEq, SpanlessHash}; use clippy_utils::{paths, search_same, SpanlessEq, SpanlessHash};
use core::array;
use core::iter::{once, ExactSizeIterator}; use core::iter::{once, ExactSizeIterator};
use if_chain::if_chain; use if_chain::if_chain;
use rustc_ast::ast::{Attribute, LitKind}; use rustc_ast::ast::{Attribute, LitKind};
@ -1314,7 +1313,7 @@ fn check_match_like_matches<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>)
return find_matches_sugg( return find_matches_sugg(
cx, cx,
let_expr, let_expr,
array::IntoIter::new([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]), IntoIterator::into_iter([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]),
expr, expr,
true, true,
); );

View file

@ -204,7 +204,7 @@ fn parse_iter_usage(
match e.kind { match e.kind {
ExprKind::Call( ExprKind::Call(
Expr { Expr {
kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)), kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)),
.. ..
}, },
_, _,

View file

@ -155,8 +155,14 @@ fn assignment_suggestions<'tcx>(
} }
let suggestions = assignments let suggestions = assignments
.into_iter() .iter()
.map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?))) .map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
.chain(assignments.iter().map(|assignment| {
Some((
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
String::new(),
))
}))
.collect::<Option<Vec<(Span, String)>>>()?; .collect::<Option<Vec<(Span, String)>>>()?;
let applicability = if suggestions.len() > 1 { let applicability = if suggestions.len() > 1 {

View file

@ -105,7 +105,7 @@ fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
}; };
if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind; if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind;
if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind; if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind;
if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)) = &called.kind; if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)) = &called.kind;
if expr.span.ctxt() == inner_expr.span.ctxt(); if expr.span.ctxt() == inner_expr.span.ctxt();
let expr_ty = cx.typeck_results().expr_ty(expr); let expr_ty = cx.typeck_results().expr_ty(expr);
let inner_ty = cx.typeck_results().expr_ty(inner_expr); let inner_ty = cx.typeck_results().expr_ty(inner_expr);

View file

@ -15,7 +15,7 @@ use rustc_middle::mir::{
Mutability, Mutability,
}; };
use rustc_middle::ty::{self, fold::TypeVisitor, Ty, TyCtxt}; use rustc_middle::ty::{self, fold::TypeVisitor, Ty, TyCtxt};
use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor}; use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces, GenKill, GenKillAnalysis, ResultsCursor};
use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::{BytePos, Span}; use rustc_span::source_map::{BytePos, Span};
use rustc_span::sym; use rustc_span::sym;
@ -500,11 +500,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive {
fn call_return_effect( fn call_return_effect(
&self, &self,
_in_out: &mut impl GenKill<Self::Idx>, _trans: &mut impl GenKill<Self::Idx>,
_block: mir::BasicBlock, _block: mir::BasicBlock,
_func: &mir::Operand<'tcx>, _return_places: CallReturnPlaces<'_, 'tcx>,
_args: &[mir::Operand<'tcx>],
_return_place: mir::Place<'tcx>,
) { ) {
// Nothing to do when a call returns successfully // Nothing to do when a call returns successfully
} }

View file

@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
if method_names[0] == sym!(as_bytes); if method_names[0] == sym!(as_bytes);
// Check for slicer // Check for slicer
if let ExprKind::Struct(QPath::LangItem(LangItem::Range, _), _, _) = right.kind; if let ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), _, _) = right.kind;
then { then {
let mut applicability = Applicability::MachineApplicable; let mut applicability = Applicability::MachineApplicable;

View file

@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for TryErr {
if let ExprKind::Match(match_arg, _, MatchSource::TryDesugar) = expr.kind; if let ExprKind::Match(match_arg, _, MatchSource::TryDesugar) = expr.kind;
if let ExprKind::Call(match_fun, try_args) = match_arg.kind; if let ExprKind::Call(match_fun, try_args) = match_arg.kind;
if let ExprKind::Path(ref match_fun_path) = match_fun.kind; if let ExprKind::Path(ref match_fun_path) = match_fun.kind;
if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, _)); if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, ..));
if let Some(try_arg) = try_args.get(0); if let Some(try_arg) = try_args.get(0);
if let ExprKind::Call(err_fun, err_args) = try_arg.kind; if let ExprKind::Call(err_fun, err_args) = try_arg.kind;
if let Some(err_arg) = err_args.get(0); if let Some(err_arg) = err_args.get(0);

View file

@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedIoAmount {
if let hir::ExprKind::Call(func, [ref arg_0, ..]) = res.kind { if let hir::ExprKind::Call(func, [ref arg_0, ..]) = res.kind {
if matches!( if matches!(
func.kind, func.kind,
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, _)) hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..))
) { ) {
check_map_error(cx, arg_0, expr); check_map_error(cx, arg_0, expr);
} }

View file

@ -260,7 +260,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
} }
fn qpath(&self, qpath: &Binding<&QPath<'_>>) { fn qpath(&self, qpath: &Binding<&QPath<'_>>) {
if let QPath::LangItem(lang_item, _) = *qpath.value { if let QPath::LangItem(lang_item, ..) = *qpath.value {
out!("if matches!({qpath}, QPath::LangItem(LangItem::{lang_item:?}, _));"); out!("if matches!({qpath}, QPath::LangItem(LangItem::{lang_item:?}, _));");
} else { } else {
out!("if match_qpath({qpath}, &[{}]);", path_to_string(qpath.value)); out!("if match_qpath({qpath}, &[{}]);", path_to_string(qpath.value));

View file

@ -218,7 +218,7 @@ impl<'a> Range<'a> {
hir::ExprKind::Call(path, args) hir::ExprKind::Call(path, args)
if matches!( if matches!(
path.kind, path.kind,
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _)) hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, ..))
) => ) =>
{ {
Some(Range { Some(Range {
@ -228,27 +228,27 @@ impl<'a> Range<'a> {
}) })
}, },
hir::ExprKind::Struct(path, fields, None) => match &path { hir::ExprKind::Struct(path, fields, None) => match &path {
hir::QPath::LangItem(hir::LangItem::RangeFull, _) => Some(Range { hir::QPath::LangItem(hir::LangItem::RangeFull, ..) => Some(Range {
start: None, start: None,
end: None, end: None,
limits: ast::RangeLimits::HalfOpen, limits: ast::RangeLimits::HalfOpen,
}), }),
hir::QPath::LangItem(hir::LangItem::RangeFrom, _) => Some(Range { hir::QPath::LangItem(hir::LangItem::RangeFrom, ..) => Some(Range {
start: Some(get_field("start", fields)?), start: Some(get_field("start", fields)?),
end: None, end: None,
limits: ast::RangeLimits::HalfOpen, limits: ast::RangeLimits::HalfOpen,
}), }),
hir::QPath::LangItem(hir::LangItem::Range, _) => Some(Range { hir::QPath::LangItem(hir::LangItem::Range, ..) => Some(Range {
start: Some(get_field("start", fields)?), start: Some(get_field("start", fields)?),
end: Some(get_field("end", fields)?), end: Some(get_field("end", fields)?),
limits: ast::RangeLimits::HalfOpen, limits: ast::RangeLimits::HalfOpen,
}), }),
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _) => Some(Range { hir::QPath::LangItem(hir::LangItem::RangeToInclusive, ..) => Some(Range {
start: None, start: None,
end: Some(get_field("end", fields)?), end: Some(get_field("end", fields)?),
limits: ast::RangeLimits::Closed, limits: ast::RangeLimits::Closed,
}), }),
hir::QPath::LangItem(hir::LangItem::RangeTo, _) => Some(Range { hir::QPath::LangItem(hir::LangItem::RangeTo, ..) => Some(Range {
start: None, start: None,
end: Some(get_field("end", fields)?), end: Some(get_field("end", fields)?),
limits: ast::RangeLimits::HalfOpen, limits: ast::RangeLimits::HalfOpen,

View file

@ -348,7 +348,7 @@ impl HirEqInterExpr<'_, '_, '_> {
(&QPath::TypeRelative(lty, lseg), &QPath::TypeRelative(rty, rseg)) => { (&QPath::TypeRelative(lty, lseg), &QPath::TypeRelative(rty, rseg)) => {
self.eq_ty(lty, rty) && self.eq_path_segment(lseg, rseg) self.eq_ty(lty, rty) && self.eq_path_segment(lseg, rseg)
}, },
(&QPath::LangItem(llang_item, _), &QPath::LangItem(rlang_item, _)) => llang_item == rlang_item, (&QPath::LangItem(llang_item, ..), &QPath::LangItem(rlang_item, ..)) => llang_item == rlang_item,
_ => false, _ => false,
} }
} }

View file

@ -1,6 +1,5 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(in_band_lifetimes)] #![feature(in_band_lifetimes)]
#![feature(iter_zip)]
#![feature(let_else)] #![feature(let_else)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]

View file

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "nightly-2021-12-02" channel = "nightly-2021-12-17"
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"] components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]

View file

@ -1,11 +1,10 @@
// only-x86_64 // only-x86_64
// ignore-aarch64 // ignore-aarch64
#![feature(asm)]
#[warn(clippy::inline_asm_x86_intel_syntax)] #[warn(clippy::inline_asm_x86_intel_syntax)]
mod warn_intel { mod warn_intel {
pub(super) unsafe fn use_asm() { pub(super) unsafe fn use_asm() {
use std::arch::asm;
asm!(""); asm!("");
asm!("", options()); asm!("", options());
asm!("", options(nostack)); asm!("", options(nostack));
@ -17,6 +16,7 @@ mod warn_intel {
#[warn(clippy::inline_asm_x86_att_syntax)] #[warn(clippy::inline_asm_x86_att_syntax)]
mod warn_att { mod warn_att {
pub(super) unsafe fn use_asm() { pub(super) unsafe fn use_asm() {
use std::arch::asm;
asm!(""); asm!("");
asm!("", options()); asm!("", options());
asm!("", options(nostack)); asm!("", options(nostack));

View file

@ -1,5 +1,5 @@
error: Intel x86 assembly syntax used error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:9:9 --> $DIR/asm_syntax.rs:8:9
| |
LL | asm!(""); LL | asm!("");
| ^^^^^^^^ | ^^^^^^^^
@ -8,7 +8,7 @@ LL | asm!("");
= help: use AT&T x86 assembly syntax = help: use AT&T x86 assembly syntax
error: Intel x86 assembly syntax used error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:10:9 --> $DIR/asm_syntax.rs:9:9
| |
LL | asm!("", options()); LL | asm!("", options());
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
@ -16,7 +16,7 @@ LL | asm!("", options());
= help: use AT&T x86 assembly syntax = help: use AT&T x86 assembly syntax
error: Intel x86 assembly syntax used error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:11:9 --> $DIR/asm_syntax.rs:10:9
| |
LL | asm!("", options(nostack)); LL | asm!("", options(nostack));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,14 +1,3 @@
error[E0658]: destructuring assignments are unstable
--> $DIR/ice-6250.rs:12:25
|
LL | Some(reference) = cache.data.get(key) {
| --------------- ^
| |
| cannot assign to this expression
|
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
error[E0601]: `main` function not found in crate `ice_6250` error[E0601]: `main` function not found in crate `ice_6250`
--> $DIR/ice-6250.rs:4:1 --> $DIR/ice-6250.rs:4:1
| |
@ -41,7 +30,7 @@ error[E0308]: mismatched types
LL | Some(reference) = cache.data.get(key) { LL | Some(reference) = cache.data.get(key) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
error: aborting due to 4 previous errors error: aborting due to 3 previous errors
Some errors have detailed explanations: E0308, E0601, E0658. Some errors have detailed explanations: E0308, E0601.
For more information about an error, try `rustc --explain E0308`. For more information about an error, try `rustc --explain E0308`.

View file

@ -2,8 +2,8 @@
#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)] #![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
#![warn(clippy::map_entry)] #![warn(clippy::map_entry)]
#![feature(asm)]
use std::arch::asm;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;

View file

@ -2,8 +2,8 @@
#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)] #![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
#![warn(clippy::map_entry)] #![warn(clippy::map_entry)]
#![feature(asm)]
use std::arch::asm;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;

View file

@ -6,22 +6,22 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| |
= note: `-D clippy::future-not-send` implied by `-D warnings` = note: `-D clippy::future-not-send` implied by `-D warnings`
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:8:5 --> $DIR/future_not_send.rs:8:19
| |
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| -- has type `std::rc::Rc<[u8]>` which is not `Send` | -- has type `std::rc::Rc<[u8]>` which is not `Send`
LL | async { true }.await LL | async { true }.await
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later | ^^^^^^ await occurs here, with `rc` maybe used later
LL | } LL | }
| - `rc` is later dropped here | - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:8:5 --> $DIR/future_not_send.rs:8:19
| |
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ---- has type `&std::cell::Cell<usize>` which is not `Send` | ---- has type `&std::cell::Cell<usize>` which is not `Send`
LL | async { true }.await LL | async { true }.await
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `cell` maybe used later | ^^^^^^ await occurs here, with `cell` maybe used later
LL | } LL | }
| - `cell` is later dropped here | - `cell` is later dropped here
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync` = note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
@ -33,12 +33,12 @@ LL | pub async fn public_future(rc: Rc<[u8]>) {
| ^ future returned by `public_future` is not `Send` | ^ future returned by `public_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:12:5 --> $DIR/future_not_send.rs:12:19
| |
LL | pub async fn public_future(rc: Rc<[u8]>) { LL | pub async fn public_future(rc: Rc<[u8]>) {
| -- has type `std::rc::Rc<[u8]>` which is not `Send` | -- has type `std::rc::Rc<[u8]>` which is not `Send`
LL | async { true }.await; LL | async { true }.await;
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later | ^^^^^^ await occurs here, with `rc` maybe used later
LL | } LL | }
| - `rc` is later dropped here | - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
@ -82,12 +82,12 @@ LL | async fn private_future(&self) -> usize {
| ^^^^^ future returned by `private_future` is not `Send` | ^^^^^ future returned by `private_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:35:9 --> $DIR/future_not_send.rs:35:23
| |
LL | async fn private_future(&self) -> usize { LL | async fn private_future(&self) -> usize {
| ----- has type `&Dummy` which is not `Send` | ----- has type `&Dummy` which is not `Send`
LL | async { true }.await; LL | async { true }.await;
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later | ^^^^^^ await occurs here, with `&self` maybe used later
LL | self.rc.len() LL | self.rc.len()
LL | } LL | }
| - `&self` is later dropped here | - `&self` is later dropped here
@ -100,12 +100,12 @@ LL | pub async fn public_future(&self) {
| ^ future returned by `public_future` is not `Send` | ^ future returned by `public_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:40:9 --> $DIR/future_not_send.rs:40:30
| |
LL | pub async fn public_future(&self) { LL | pub async fn public_future(&self) {
| ----- has type `&Dummy` which is not `Send` | ----- has type `&Dummy` which is not `Send`
LL | self.private_future().await; LL | self.private_future().await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later | ^^^^^^ await occurs here, with `&self` maybe used later
LL | } LL | }
| - `&self` is later dropped here | - `&self` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
@ -117,12 +117,12 @@ LL | async fn generic_future<T>(t: T) -> T
| ^ future returned by `generic_future` is not `Send` | ^ future returned by `generic_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:54:5 --> $DIR/future_not_send.rs:54:19
| |
LL | let rt = &t; LL | let rt = &t;
| -- has type `&T` which is not `Send` | -- has type `&T` which is not `Send`
LL | async { true }.await; LL | async { true }.await;
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rt` maybe used later | ^^^^^^ await occurs here, with `rt` maybe used later
LL | t LL | t
LL | } LL | }
| - `rt` is later dropped here | - `rt` is later dropped here

View file

@ -2,10 +2,11 @@
// When denying at the crate level, be sure to not get random warnings from the // When denying at the crate level, be sure to not get random warnings from the
// injected intrinsics by the compiler. // injected intrinsics by the compiler.
#![allow(dead_code)] #![allow(dead_code)]
#![feature(global_asm)]
//! Some garbage docs for the crate here //! Some garbage docs for the crate here
#![doc = "More garbage"] #![doc = "More garbage"]
use std::arch::global_asm;
type Typedef = String; type Typedef = String;
pub type PubTypedef = String; pub type PubTypedef = String;

View file

@ -1,5 +1,5 @@
error: missing documentation for a type alias error: missing documentation for a type alias
--> $DIR/missing-doc.rs:9:1 --> $DIR/missing-doc.rs:10:1
| |
LL | type Typedef = String; LL | type Typedef = String;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
@ -7,37 +7,37 @@ LL | type Typedef = String;
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings` = note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
error: missing documentation for a type alias error: missing documentation for a type alias
--> $DIR/missing-doc.rs:10:1 --> $DIR/missing-doc.rs:11:1
| |
LL | pub type PubTypedef = String; LL | pub type PubTypedef = String;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a module error: missing documentation for a module
--> $DIR/missing-doc.rs:12:1 --> $DIR/missing-doc.rs:13:1
| |
LL | mod module_no_dox {} LL | mod module_no_dox {}
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a module error: missing documentation for a module
--> $DIR/missing-doc.rs:13:1 --> $DIR/missing-doc.rs:14:1
| |
LL | pub mod pub_module_no_dox {} LL | pub mod pub_module_no_dox {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:17:1 --> $DIR/missing-doc.rs:18:1
| |
LL | pub fn foo2() {} LL | pub fn foo2() {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:18:1 --> $DIR/missing-doc.rs:19:1
| |
LL | fn foo3() {} LL | fn foo3() {}
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: missing documentation for an enum error: missing documentation for an enum
--> $DIR/missing-doc.rs:32:1 --> $DIR/missing-doc.rs:33:1
| |
LL | / enum Baz { LL | / enum Baz {
LL | | BazA { a: isize, b: isize }, LL | | BazA { a: isize, b: isize },
@ -46,31 +46,31 @@ LL | | }
| |_^ | |_^
error: missing documentation for a variant error: missing documentation for a variant
--> $DIR/missing-doc.rs:33:5 --> $DIR/missing-doc.rs:34:5
| |
LL | BazA { a: isize, b: isize }, LL | BazA { a: isize, b: isize },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a struct field error: missing documentation for a struct field
--> $DIR/missing-doc.rs:33:12 --> $DIR/missing-doc.rs:34:12
| |
LL | BazA { a: isize, b: isize }, LL | BazA { a: isize, b: isize },
| ^^^^^^^^ | ^^^^^^^^
error: missing documentation for a struct field error: missing documentation for a struct field
--> $DIR/missing-doc.rs:33:22 --> $DIR/missing-doc.rs:34:22
| |
LL | BazA { a: isize, b: isize }, LL | BazA { a: isize, b: isize },
| ^^^^^^^^ | ^^^^^^^^
error: missing documentation for a variant error: missing documentation for a variant
--> $DIR/missing-doc.rs:34:5 --> $DIR/missing-doc.rs:35:5
| |
LL | BarB, LL | BarB,
| ^^^^ | ^^^^
error: missing documentation for an enum error: missing documentation for an enum
--> $DIR/missing-doc.rs:37:1 --> $DIR/missing-doc.rs:38:1
| |
LL | / pub enum PubBaz { LL | / pub enum PubBaz {
LL | | PubBazA { a: isize }, LL | | PubBazA { a: isize },
@ -78,43 +78,43 @@ LL | | }
| |_^ | |_^
error: missing documentation for a variant error: missing documentation for a variant
--> $DIR/missing-doc.rs:38:5 --> $DIR/missing-doc.rs:39:5
| |
LL | PubBazA { a: isize }, LL | PubBazA { a: isize },
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a struct field error: missing documentation for a struct field
--> $DIR/missing-doc.rs:38:15 --> $DIR/missing-doc.rs:39:15
| |
LL | PubBazA { a: isize }, LL | PubBazA { a: isize },
| ^^^^^^^^ | ^^^^^^^^
error: missing documentation for a constant error: missing documentation for a constant
--> $DIR/missing-doc.rs:58:1 --> $DIR/missing-doc.rs:59:1
| |
LL | const FOO: u32 = 0; LL | const FOO: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: missing documentation for a constant error: missing documentation for a constant
--> $DIR/missing-doc.rs:65:1 --> $DIR/missing-doc.rs:66:1
| |
LL | pub const FOO4: u32 = 0; LL | pub const FOO4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a static error: missing documentation for a static
--> $DIR/missing-doc.rs:67:1 --> $DIR/missing-doc.rs:68:1
| |
LL | static BAR: u32 = 0; LL | static BAR: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a static error: missing documentation for a static
--> $DIR/missing-doc.rs:74:1 --> $DIR/missing-doc.rs:75:1
| |
LL | pub static BAR4: u32 = 0; LL | pub static BAR4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a module error: missing documentation for a module
--> $DIR/missing-doc.rs:76:1 --> $DIR/missing-doc.rs:77:1
| |
LL | / mod internal_impl { LL | / mod internal_impl {
LL | | /// dox LL | | /// dox
@ -126,31 +126,31 @@ LL | | }
| |_^ | |_^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:79:5 --> $DIR/missing-doc.rs:80:5
| |
LL | pub fn undocumented1() {} LL | pub fn undocumented1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:80:5 --> $DIR/missing-doc.rs:81:5
| |
LL | pub fn undocumented2() {} LL | pub fn undocumented2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:81:5 --> $DIR/missing-doc.rs:82:5
| |
LL | fn undocumented3() {} LL | fn undocumented3() {}
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:86:9 --> $DIR/missing-doc.rs:87:9
| |
LL | pub fn also_undocumented1() {} LL | pub fn also_undocumented1() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function error: missing documentation for a function
--> $DIR/missing-doc.rs:87:9 --> $DIR/missing-doc.rs:88:9
| |
LL | fn also_undocumented2() {} LL | fn also_undocumented2() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -39,6 +39,19 @@ fn main() {
e = format!("{}", c); e = format!("{}", c);
} }
let f;
match 1 {
1 => f = "three",
_ => return,
}; // has semi
let g: usize;
if true {
g = 5;
} else {
panic!();
}
println!("{}", a); println!("{}", a);
} }

View file

@ -105,7 +105,43 @@ LL | };
| + | +
error: unneeded late initalization error: unneeded late initalization
--> $DIR/needless_late_init.rs:50:5 --> $DIR/needless_late_init.rs:42:5
|
LL | let f;
| ^^^^^^
|
help: declare `f` here
|
LL | let f = match 1 {
| +++++++
help: remove the assignments from the `match` arms
|
LL - 1 => f = "three",
LL + 1 => "three",
|
error: unneeded late initalization
--> $DIR/needless_late_init.rs:48:5
|
LL | let g: usize;
| ^^^^^^^^^^^^^
|
help: declare `g` here
|
LL | let g: usize = if true {
| ++++++++++++++
help: remove the assignments from the branches
|
LL - g = 5;
LL + 5
|
help: add a semicolon after the `if` expression
|
LL | };
| +
error: unneeded late initalization
--> $DIR/needless_late_init.rs:63:5
| |
LL | let a; LL | let a;
| ^^^^^^ | ^^^^^^
@ -126,7 +162,7 @@ LL | };
| + | +
error: unneeded late initalization error: unneeded late initalization
--> $DIR/needless_late_init.rs:67:5 --> $DIR/needless_late_init.rs:80:5
| |
LL | let a; LL | let a;
| ^^^^^^ | ^^^^^^
@ -146,5 +182,5 @@ help: add a semicolon after the `match` expression
LL | }; LL | };
| + | +
error: aborting due to 7 previous errors error: aborting due to 9 previous errors

View file

@ -19,19 +19,6 @@ fn main() {
e = 2; e = 2;
let f = match 1 {
1 => "three",
_ => return,
}; // has semi
let g: usize = if true {
5
} else {
panic!();
};
let h = format!("{}", e); let h = format!("{}", e);
println!("{}", a); println!("{}", a);

View file

@ -18,19 +18,6 @@ fn main() {
e = 1; e = 1;
e = 2; e = 2;
let f;
match 1 {
1 => f = "three",
_ => return,
}; // has semi
let g: usize;
if true {
g = 5;
} else {
panic!();
}
let h; let h;
h = format!("{}", e); h = format!("{}", e);

View file

@ -57,40 +57,6 @@ LL | let mut e = 1;
error: unneeded late initalization error: unneeded late initalization
--> $DIR/needless_late_init_fixable.rs:21:5 --> $DIR/needless_late_init_fixable.rs:21:5
| |
LL | let f;
| ^^^^^^
|
help: declare `f` here
|
LL | let f = match 1 {
| +++++++
help: remove the assignments from the `match` arms
|
LL | 1 => "three",
| ~~~~~~~
error: unneeded late initalization
--> $DIR/needless_late_init_fixable.rs:27:5
|
LL | let g: usize;
| ^^^^^^^^^^^^^
|
help: declare `g` here
|
LL | let g: usize = if true {
| ++++++++++++++
help: remove the assignments from the branches
|
LL | 5
|
help: add a semicolon after the `if` expression
|
LL | };
| +
error: unneeded late initalization
--> $DIR/needless_late_init_fixable.rs:34:5
|
LL | let h; LL | let h;
| ^^^^^^ | ^^^^^^
| |
@ -99,5 +65,5 @@ help: declare `h` here
LL | let h = format!("{}", e); LL | let h = format!("{}", e);
| ~~~~~ | ~~~~~
error: aborting due to 8 previous errors error: aborting due to 6 previous errors

View file

@ -1,5 +1,4 @@
#![warn(clippy::trailing_empty_array)] #![warn(clippy::trailing_empty_array)]
#![feature(const_generics_defaults)]
// Do lint: // Do lint:

View file

@ -1,5 +1,5 @@
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:6:1 --> $DIR/trailing_empty_array.rs:5:1
| |
LL | / struct RarelyUseful { LL | / struct RarelyUseful {
LL | | field: i32, LL | | field: i32,
@ -11,7 +11,7 @@ LL | | }
= help: consider annotating `RarelyUseful` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `RarelyUseful` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:11:1 --> $DIR/trailing_empty_array.rs:10:1
| |
LL | / struct OnlyField { LL | / struct OnlyField {
LL | | first_and_last: [usize; 0], LL | | first_and_last: [usize; 0],
@ -21,7 +21,7 @@ LL | | }
= help: consider annotating `OnlyField` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `OnlyField` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:15:1 --> $DIR/trailing_empty_array.rs:14:1
| |
LL | / struct GenericArrayType<T> { LL | / struct GenericArrayType<T> {
LL | | field: i32, LL | | field: i32,
@ -32,7 +32,7 @@ LL | | }
= help: consider annotating `GenericArrayType` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `GenericArrayType` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:21:1 --> $DIR/trailing_empty_array.rs:20:1
| |
LL | / struct OnlyAnotherAttribute { LL | / struct OnlyAnotherAttribute {
LL | | field: i32, LL | | field: i32,
@ -43,7 +43,7 @@ LL | | }
= help: consider annotating `OnlyAnotherAttribute` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `OnlyAnotherAttribute` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:27:1 --> $DIR/trailing_empty_array.rs:26:1
| |
LL | / struct OnlyADeriveAttribute { LL | / struct OnlyADeriveAttribute {
LL | | field: i32, LL | | field: i32,
@ -54,7 +54,7 @@ LL | | }
= help: consider annotating `OnlyADeriveAttribute` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `OnlyADeriveAttribute` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:33:1 --> $DIR/trailing_empty_array.rs:32:1
| |
LL | / struct ZeroSizedWithConst { LL | / struct ZeroSizedWithConst {
LL | | field: i32, LL | | field: i32,
@ -65,7 +65,7 @@ LL | | }
= help: consider annotating `ZeroSizedWithConst` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `ZeroSizedWithConst` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:42:1 --> $DIR/trailing_empty_array.rs:41:1
| |
LL | / struct ZeroSizedWithConstFunction { LL | / struct ZeroSizedWithConstFunction {
LL | | field: i32, LL | | field: i32,
@ -76,7 +76,7 @@ LL | | }
= help: consider annotating `ZeroSizedWithConstFunction` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `ZeroSizedWithConstFunction` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:50:1 --> $DIR/trailing_empty_array.rs:49:1
| |
LL | / struct ZeroSizedWithConstFunction2 { LL | / struct ZeroSizedWithConstFunction2 {
LL | | field: i32, LL | | field: i32,
@ -87,7 +87,7 @@ LL | | }
= help: consider annotating `ZeroSizedWithConstFunction2` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `ZeroSizedWithConstFunction2` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:55:1 --> $DIR/trailing_empty_array.rs:54:1
| |
LL | struct ZeroSizedArrayWrapper([usize; 0]); LL | struct ZeroSizedArrayWrapper([usize; 0]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -95,7 +95,7 @@ LL | struct ZeroSizedArrayWrapper([usize; 0]);
= help: consider annotating `ZeroSizedArrayWrapper` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `ZeroSizedArrayWrapper` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:57:1 --> $DIR/trailing_empty_array.rs:56:1
| |
LL | struct TupleStruct(i32, [usize; 0]); LL | struct TupleStruct(i32, [usize; 0]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -103,7 +103,7 @@ LL | struct TupleStruct(i32, [usize; 0]);
= help: consider annotating `TupleStruct` with `#[repr(C)]` or another `repr` attribute = help: consider annotating `TupleStruct` with `#[repr(C)]` or another `repr` attribute
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_empty_array.rs:59:1 --> $DIR/trailing_empty_array.rs:58:1
| |
LL | / struct LotsOfFields { LL | / struct LotsOfFields {
LL | | f1: u32, LL | | f1: u32,