Skip to content

Commit e6f9a2b

Browse files
committed
Auto merge of rust-lang#2991 - rust-lang:rustup-2023-07-26, r=RalfJung
Automatic sync from rustc
2 parents 037696f + 21d1512 commit e6f9a2b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

clippy_lints/src/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
328328
{
329329
// Don't lint. Byte strings produce `&[u8; N]` whereas `as_bytes()` produces
330330
// `&[u8]`. This change would prevent matching with different sized slices.
331-
} else {
331+
} else if !callsite.starts_with("env!") {
332332
span_lint_and_sugg(
333333
cx,
334334
STRING_LIT_AS_BYTES,

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_middle::mir::{
1414
Body, CastKind, NonDivergingIntrinsic, NullOp, Operand, Place, ProjectionElem, Rvalue, Statement, StatementKind,
1515
Terminator, TerminatorKind,
1616
};
17-
use rustc_middle::traits::{ImplSource, ObligationCause};
17+
use rustc_middle::traits::{ImplSource, ObligationCause, BuiltinImplSource};
1818
use rustc_middle::ty::adjustment::PointerCoercion;
1919
use rustc_middle::ty::{self, BoundConstness, GenericArgKind, TraitRef, Ty, TyCtxt};
2020
use rustc_semver::RustcVersion;
@@ -411,7 +411,7 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
411411

412412
if !matches!(
413413
impl_src,
414-
ImplSource::Builtin(_) | ImplSource::Param(_, ty::BoundConstness::ConstIfConst)
414+
ImplSource::Builtin(BuiltinImplSource::Misc, _) | ImplSource::Param(ty::BoundConstness::ConstIfConst, _)
415415
) {
416416
return false;
417417
}

tests/ui/self_assignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn positives(mut a: usize, b: &mut u32, mut s: S) {
1414
*b = *b;
1515
s = s;
1616
s.a = s.a;
17-
s.b[10] = s.b[5 + 5];
17+
s.b[9] = s.b[5 + 4];
1818
s.c[0][1] = s.c[0][1];
1919
s.b[a] = s.b[a];
2020
*s.e = *s.e;

tests/ui/self_assignment.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ error: self-assignment of `s.a` to `s.a`
2424
LL | s.a = s.a;
2525
| ^^^^^^^^^
2626

27-
error: self-assignment of `s.b[5 + 5]` to `s.b[10]`
27+
error: self-assignment of `s.b[5 + 4]` to `s.b[9]`
2828
--> $DIR/self_assignment.rs:17:5
2929
|
30-
LL | s.b[10] = s.b[5 + 5];
31-
| ^^^^^^^^^^^^^^^^^^^^
30+
LL | s.b[9] = s.b[5 + 4];
31+
| ^^^^^^^^^^^^^^^^^^^
3232

3333
error: self-assignment of `s.c[0][1]` to `s.c[0][1]`
3434
--> $DIR/self_assignment.rs:18:5

0 commit comments

Comments
 (0)