Skip to content

Rollup of 13 pull requests #73604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c88e6a7
add Windows system error codes that map to io::ErrorKind::TimedOut
May 1, 2020
8667996
use or pattern to match error codes that map to ErrorKind::TimedOut
carstenandrich May 2, 2020
c69d6c8
fix formatting issues that fail tidy test
carstenandrich May 2, 2020
b97487b
Add check for doc alias attribute format
GuillaumeGomez May 30, 2020
2d6267a
Add test for doc alias attribute validation
GuillaumeGomez May 30, 2020
e27a8b5
add link list of error codes on docs.microsoft.com
Jun 13, 2020
1d08b1b
Clean up E0689 explanation
GuillaumeGomez Jun 18, 2020
9245ba8
Remove the const_raw_ptr_comparison feature gate.
oli-obk Jun 12, 2020
e09b620
Add fuzzy pointer comparison intrinsics
oli-obk Jun 16, 2020
84f1d73
Tidy got confused on `rustc_const_unstable` `issue`s
oli-obk Jun 18, 2020
a10e07c
Provide suggestions for some moved value errors
estebank Jun 20, 2020
9e88b48
Refer just to the issue in the raw ptr cmp diagnostic instead of expl…
oli-obk Jun 20, 2020
53686b9
Satisfy tidy
oli-obk Jun 20, 2020
98e97a4
Address review comments
oli-obk Jun 20, 2020
5faf657
Change heuristic and add tests
estebank Jun 20, 2020
fc60282
impl PartialEq<Vec<B>> for &[A], &mut [A]
sollyucko Apr 29, 2020
4896a06
Update stability attribute of new Vec PartialEq impls
dtolnay Jun 20, 2020
6374054
Fix typos in doc comments
JOE1994 Jun 21, 2020
e3d735d
Fix typo in error_codes doc
dario23 Jun 21, 2020
e465b22
`icmp` can handle raw pointers just fine, there's no need to cast to …
oli-obk Jun 21, 2020
467415d
deprecate wrapping_offset_from
RalfJung Jun 21, 2020
a657be4
Create E0765 error for unterminated double quote strings
GuillaumeGomez Jun 21, 2020
726b6f4
Miri: replace many bug! by span_bug!
RalfJung Jun 21, 2020
c14d85f
Update UI tests
GuillaumeGomez Jun 21, 2020
893077c
Update src/librustc_mir/monomorphize/collector.rs
JOE1994 Jun 21, 2020
fea5ab1
Prefer accessible paths in 'use' suggestions
da-x Jun 13, 2020
ae71e96
Do not send a notification for P-high stable regressions
LeSeulArtichaut Jun 21, 2020
71e7bd2
Rollup merge of #71660 - sollyucko:master, r=dtolnay
Manishearth Jun 22, 2020
311f99f
Rollup merge of #71756 - carstenandrich:master, r=dtolnay
Manishearth Jun 22, 2020
33a96c8
Rollup merge of #72623 - da-x:use-suggest-public-path, r=petrochenkov
Manishearth Jun 22, 2020
9a4fe04
Rollup merge of #72780 - GuillaumeGomez:enforce-doc-alias-check, r=ol…
Manishearth Jun 22, 2020
4958a5b
Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung…
Manishearth Jun 22, 2020
a8b1dcd
Rollup merge of #73472 - GuillaumeGomez:cleanup-e0689, r=Dylan-DPC
Manishearth Jun 22, 2020
2f752b0
Rollup merge of #73502 - GuillaumeGomez:add-e0764, r=estebank
Manishearth Jun 22, 2020
5e5d63d
Rollup merge of #73534 - estebank:borrowck-suggestions, r=matthewjasper
Manishearth Jun 22, 2020
a770852
Rollup merge of #73572 - JOE1994:patch-4, r=jonas-schievink
Manishearth Jun 22, 2020
dedc6cd
Rollup merge of #73575 - dario23:typo-errorcodes-doc, r=matthewjasper
Manishearth Jun 22, 2020
84560a4
Rollup merge of #73580 - RalfJung:deprecate-wrapping-offset-from, r=A…
Manishearth Jun 22, 2020
96cd10b
Rollup merge of #73582 - RalfJung:miri-span-bug, r=oli-obk
Manishearth Jun 22, 2020
8a53dd4
Rollup merge of #73585 - LeSeulArtichaut:patch-3, r=Mark-Simulacrum
Manishearth Jun 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions src/librustc_mir/interpret/cast.rs
Original file line number Diff line number Diff line change
@@ -52,7 +52,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}

if self.tcx.has_attr(def_id, sym::rustc_args_required_const) {
bug!("reifying a fn ptr that requires const arguments");
span_bug!(
self.cur_span(),
"reifying a fn ptr that requires const arguments"
);
}

let instance = ty::Instance::resolve_for_fn_ptr(
@@ -66,7 +69,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance));
self.write_scalar(fn_ptr, dest)?;
}
_ => bug!("reify fn pointer on {:?}", src.layout.ty),
_ => span_bug!(self.cur_span(), "reify fn pointer on {:?}", src.layout.ty),
}
}

@@ -77,7 +80,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// No change to value
self.write_immediate(*src, dest)?;
}
_ => bug!("fn to unsafe fn cast on {:?}", cast_ty),
_ => span_bug!(self.cur_span(), "fn to unsafe fn cast on {:?}", cast_ty),
}
}

@@ -99,7 +102,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance));
self.write_scalar(fn_ptr, dest)?;
}
_ => bug!("closure fn pointer on {:?}", src.layout.ty),
_ => span_bug!(self.cur_span(), "closure fn pointer on {:?}", src.layout.ty),
}
}
}
@@ -162,7 +165,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
assert!(src.layout.ty.is_unsafe_ptr());
return match *src {
Immediate::ScalarPair(data, _) => Ok(data.into()),
Immediate::Scalar(..) => bug!(
Immediate::Scalar(..) => span_bug!(
self.cur_span(),
"{:?} input to a fat-to-thin cast ({:?} -> {:?})",
*src,
src.layout.ty,
@@ -216,7 +220,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}

// Casts to bool are not permitted by rustc, no need to handle them here.
_ => bug!("invalid int to {:?} cast", cast_ty),
_ => span_bug!(self.cur_span(), "invalid int to {:?} cast", cast_ty),
}
}

@@ -248,7 +252,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// float -> f64
Float(FloatTy::F64) => Scalar::from_f64(f.convert(&mut false).value),
// That's it.
_ => bug!("invalid float to {:?} cast", dest_ty),
_ => span_bug!(self.cur_span(), "invalid float to {:?} cast", dest_ty),
}
}

@@ -287,7 +291,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.write_immediate(val, dest)
}

_ => bug!("invalid unsizing {:?} -> {:?}", src.layout.ty, cast_ty),
_ => {
span_bug!(self.cur_span(), "invalid unsizing {:?} -> {:?}", src.layout.ty, cast_ty)
}
}
}

@@ -307,7 +313,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
assert_eq!(def_a, def_b);
if def_a.is_box() || def_b.is_box() {
if !def_a.is_box() || !def_b.is_box() {
bug!("invalid unsizing between {:?} -> {:?}", src.layout.ty, cast_ty.ty);
span_bug!(
self.cur_span(),
"invalid unsizing between {:?} -> {:?}",
src.layout.ty,
cast_ty.ty
);
}
return self.unsize_into_ptr(
src,
@@ -335,7 +346,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
Ok(())
}
_ => bug!("unsize_into: invalid conversion: {:?} -> {:?}", src.layout, dest.layout),
_ => span_bug!(
self.cur_span(),
"unsize_into: invalid conversion: {:?} -> {:?}",
src.layout,
dest.layout
),
}
}
}
7 changes: 5 additions & 2 deletions src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
@@ -536,7 +536,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if sized_size == Size::ZERO {
return Ok(None);
} else {
bug!("Fields cannot be extern types, unless they are at offset 0")
span_bug!(
self.cur_span(),
"Fields cannot be extern types, unless they are at offset 0"
)
}
}
};
@@ -584,7 +587,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {

ty::Foreign(_) => Ok(None),

_ => bug!("size_and_align_of::<{:?}> not supported", layout.ty),
_ => span_bug!(self.cur_span(), "size_and_align_of::<{:?}> not supported", layout.ty),
}
}
#[inline]
7 changes: 6 additions & 1 deletion src/librustc_mir/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -135,7 +135,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let bits = self.force_bits(val, layout_of.size)?;
let kind = match layout_of.abi {
Abi::Scalar(ref scalar) => scalar.value,
_ => bug!("{} called on invalid type {:?}", intrinsic_name, ty),
_ => span_bug!(
self.cur_span(),
"{} called on invalid type {:?}",
intrinsic_name,
ty
),
};
let (nonzero, intrinsic_name) = match intrinsic_name {
sym::cttz_nonzero => (true, sym::cttz),
15 changes: 9 additions & 6 deletions src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
@@ -311,7 +311,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if let Ok(imm) = self.try_read_immediate(op)? {
Ok(imm)
} else {
bug!("primitive read failed for type: {:?}", op.layout.ty);
span_bug!(self.cur_span(), "primitive read failed for type: {:?}", op.layout.ty);
}
}

@@ -360,9 +360,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let val = if offset.bytes() == 0 { a } else { b };
Immediate::from(val)
}
Immediate::Scalar(val) => {
bug!("field access on non aggregate {:#?}, {:#?}", val, op.layout)
}
Immediate::Scalar(val) => span_bug!(
self.cur_span(),
"field access on non aggregate {:#?}, {:#?}",
val,
op.layout
),
};
Ok(OpTy { op: Operand::Immediate(immediate), layout: field_layout })
}
@@ -545,7 +548,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
ty::ConstKind::Infer(..)
| ty::ConstKind::Bound(..)
| ty::ConstKind::Placeholder(..) => {
bug!("eval_const_to_op: Unexpected ConstKind {:?}", val)
span_bug!(self.cur_span(), "eval_const_to_op: Unexpected ConstKind {:?}", val)
}
ty::ConstKind::Value(val_val) => val_val,
};
@@ -656,7 +659,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
.discriminants(def_id, *self.tcx)
.find(|(_, var)| var.val == discr_bits)
}
_ => bug!("tagged layout for non-adt non-generator"),
_ => span_bug!(self.cur_span(), "tagged layout for non-adt non-generator"),
}
.ok_or_else(|| err_ub!(InvalidTag(tag_val.erase_tag())))?;
// Return the cast value, and the index.
22 changes: 14 additions & 8 deletions src/librustc_mir/interpret/operator.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Le => l <= r,
Gt => l > r,
Ge => l >= r,
_ => bug!("Invalid operation on char: {:?}", bin_op),
_ => span_bug!(self.cur_span(), "Invalid operation on char: {:?}", bin_op),
};
(Scalar::from_bool(res), false, self.tcx.types.bool)
}
@@ -84,7 +84,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
BitAnd => l & r,
BitOr => l | r,
BitXor => l ^ r,
_ => bug!("Invalid operation on bool: {:?}", bin_op),
_ => span_bug!(self.cur_span(), "Invalid operation on bool: {:?}", bin_op),
};
(Scalar::from_bool(res), false, self.tcx.types.bool)
}
@@ -110,7 +110,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Mul => ((l * r).value.into(), ty),
Div => ((l / r).value.into(), ty),
Rem => ((l % r).value.into(), ty),
_ => bug!("invalid float op: `{:?}`", bin_op),
_ => span_bug!(self.cur_span(), "invalid float op: `{:?}`", bin_op),
};
(val, false, ty)
}
@@ -154,7 +154,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {

// For the remaining ops, the types must be the same on both sides
if left_layout.ty != right_layout.ty {
bug!(
span_bug!(
self.cur_span(),
"invalid asymmetric binary op {:?}: {:?} ({:?}), {:?} ({:?})",
bin_op,
l,
@@ -251,7 +252,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
));
}

_ => bug!(
_ => span_bug!(
self.cur_span(),
"invalid binary op {:?}: {:?}, {:?} (both {:?})",
bin_op,
l,
@@ -333,7 +335,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {

M::binary_ptr_op(self, bin_op, left, right)
}
_ => bug!("Invalid MIR: bad LHS type for binop: {:?}", left.layout.ty),
_ => span_bug!(
self.cur_span(),
"Invalid MIR: bad LHS type for binop: {:?}",
left.layout.ty
),
}
}

@@ -367,15 +373,15 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let val = val.to_bool()?;
let res = match un_op {
Not => !val,
_ => bug!("Invalid bool op {:?}", un_op),
_ => span_bug!(self.cur_span(), "Invalid bool op {:?}", un_op),
};
Ok((Scalar::from_bool(res), false, self.tcx.types.bool))
}
ty::Float(fty) => {
let res = match (un_op, fty) {
(Neg, FloatTy::F32) => Scalar::from_f32(-val.to_f32()?),
(Neg, FloatTy::F64) => Scalar::from_f64(-val.to_f64()?),
_ => bug!("Invalid float op {:?}", un_op),
_ => span_bug!(self.cur_span(), "Invalid float op {:?}", un_op),
};
Ok((res, false, layout.ty))
}
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/terminator.rs
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
ty::FnDef(..) => instance_ty.fn_sig(*self.tcx).abi(),
ty::Closure(..) => Abi::RustCall,
ty::Generator(..) => Abi::Rust,
_ => bug!("unexpected callee ty: {:?}", instance_ty),
_ => span_bug!(self.cur_span(), "unexpected callee ty: {:?}", instance_ty),
}
};
let normalize_abi = |abi| match abi {