Auto merge of #73259 - Dylan-DPC:rollup-m6nw1n0, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #73033 (Fix #[thread_local] statics as asm! sym operands) - #73036 (std: Enable atomic.fence emission on wasm32) - #73163 (Add long error explanation for E0724) - #73187 (Remove missed `cfg(bootstrap)`) - #73195 (Provide suggestion to convert numeric op LHS rather than unwrapping RHS) - #73247 (Add various Zulip notifications for prioritization) - #73254 (Add comment about LocalDefId -> DefId) Failed merges: r? @ghost
This commit is contained in:
commit
14027f3e78
|
@ -2623,15 +2623,7 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[cfg_attr(target_arch = "wasm32", allow(unused_variables))]
|
|
||||||
pub fn fence(order: Ordering) {
|
pub fn fence(order: Ordering) {
|
||||||
// On wasm32 it looks like fences aren't implemented in LLVM yet in that
|
|
||||||
// they will cause LLVM to abort. The wasm instruction set doesn't have
|
|
||||||
// fences right now. There's discussion online about the best way for tools
|
|
||||||
// to conventionally implement fences at
|
|
||||||
// https://github.com/WebAssembly/tool-conventions/issues/59. We should
|
|
||||||
// follow that discussion and implement a solution when one comes about!
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
// SAFETY: using an atomic fence is safe.
|
// SAFETY: using an atomic fence is safe.
|
||||||
unsafe {
|
unsafe {
|
||||||
match order {
|
match order {
|
||||||
|
|
|
@ -927,12 +927,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
span_bug!(span, "invalid type for asm sym (fn)");
|
span_bug!(span, "invalid type for asm sym (fn)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mir::InlineAsmOperand::SymStatic { ref value } => {
|
mir::InlineAsmOperand::SymStatic { def_id } => {
|
||||||
if let Some(def_id) = value.check_static_ptr(bx.tcx()) {
|
|
||||||
InlineAsmOperandRef::SymStatic { def_id }
|
InlineAsmOperandRef::SymStatic { def_id }
|
||||||
} else {
|
|
||||||
span_bug!(span, "invalid type for asm sym (static)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
@ -409,6 +409,7 @@ E0718: include_str!("./error_codes/E0718.md"),
|
||||||
E0719: include_str!("./error_codes/E0719.md"),
|
E0719: include_str!("./error_codes/E0719.md"),
|
||||||
E0720: include_str!("./error_codes/E0720.md"),
|
E0720: include_str!("./error_codes/E0720.md"),
|
||||||
E0723: include_str!("./error_codes/E0723.md"),
|
E0723: include_str!("./error_codes/E0723.md"),
|
||||||
|
E0724: include_str!("./error_codes/E0724.md"),
|
||||||
E0725: include_str!("./error_codes/E0725.md"),
|
E0725: include_str!("./error_codes/E0725.md"),
|
||||||
E0727: include_str!("./error_codes/E0727.md"),
|
E0727: include_str!("./error_codes/E0727.md"),
|
||||||
E0728: include_str!("./error_codes/E0728.md"),
|
E0728: include_str!("./error_codes/E0728.md"),
|
||||||
|
@ -617,7 +618,6 @@ E0762: include_str!("./error_codes/E0762.md"),
|
||||||
E0717, // rustc_promotable without stability attribute
|
E0717, // rustc_promotable without stability attribute
|
||||||
// E0721, // `await` keyword
|
// E0721, // `await` keyword
|
||||||
E0722, // Malformed `#[optimize]` attribute
|
E0722, // Malformed `#[optimize]` attribute
|
||||||
E0724, // `#[ffi_returns_twice]` is only allowed in foreign functions
|
|
||||||
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
|
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
|
||||||
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
|
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
|
||||||
E0755, // `#[ffi_pure]` is only allowed on foreign functions
|
E0755, // `#[ffi_pure]` is only allowed on foreign functions
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
`#[ffi_returns_twice]` was used on non-foreign function.
|
||||||
|
|
||||||
|
Erroneous code example:
|
||||||
|
|
||||||
|
```compile_fail,E0724
|
||||||
|
#![feature(ffi_returns_twice)]
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
#[ffi_returns_twice] // error!
|
||||||
|
pub fn foo() {}
|
||||||
|
```
|
||||||
|
|
||||||
|
`#[ffi_returns_twice]` can only be used on foreign function declarations.
|
||||||
|
For example, we might correct the previous example by declaring
|
||||||
|
the function inside of an `extern` block.
|
||||||
|
|
||||||
|
```
|
||||||
|
#![feature(ffi_returns_twice)]
|
||||||
|
|
||||||
|
extern {
|
||||||
|
#[ffi_returns_twice] // ok!
|
||||||
|
pub fn foo();
|
||||||
|
}
|
||||||
|
```
|
|
@ -1243,7 +1243,7 @@ pub enum InlineAsmOperand<'tcx> {
|
||||||
value: Box<Constant<'tcx>>,
|
value: Box<Constant<'tcx>>,
|
||||||
},
|
},
|
||||||
SymStatic {
|
SymStatic {
|
||||||
value: Box<Constant<'tcx>>,
|
def_id: DefId,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1639,9 +1639,11 @@ impl<'tcx> TerminatorKind<'tcx> {
|
||||||
InlineAsmOperand::Const { value } => {
|
InlineAsmOperand::Const { value } => {
|
||||||
write!(fmt, "const {:?}", value)?;
|
write!(fmt, "const {:?}", value)?;
|
||||||
}
|
}
|
||||||
InlineAsmOperand::SymFn { value }
|
InlineAsmOperand::SymFn { value } => {
|
||||||
| InlineAsmOperand::SymStatic { value } => {
|
write!(fmt, "sym_fn {:?}", value)?;
|
||||||
write!(fmt, "sym {:?}", value)?;
|
}
|
||||||
|
InlineAsmOperand::SymStatic { def_id } => {
|
||||||
|
write!(fmt, "sym_static {:?}", def_id)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,10 +564,10 @@ macro_rules! make_mir_visitor {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InlineAsmOperand::SymFn { value }
|
InlineAsmOperand::SymFn { value } => {
|
||||||
| InlineAsmOperand::SymStatic { value } => {
|
|
||||||
self.visit_constant(value, source_location);
|
self.visit_constant(value, source_location);
|
||||||
}
|
}
|
||||||
|
InlineAsmOperand::SymStatic { def_id: _ } => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InlineAsmOperand::SymFn { value: _ }
|
InlineAsmOperand::SymFn { value: _ }
|
||||||
| InlineAsmOperand::SymStatic { value: _ } => {}
|
| InlineAsmOperand::SymStatic { def_id: _ } => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -760,7 +760,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InlineAsmOperand::SymFn { value: _ }
|
InlineAsmOperand::SymFn { value: _ }
|
||||||
| InlineAsmOperand::SymStatic { value: _ } => {}
|
| InlineAsmOperand::SymStatic { def_id: _ } => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,7 +439,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InlineAsmOperand::SymFn { value: _ }
|
InlineAsmOperand::SymFn { value: _ }
|
||||||
| InlineAsmOperand::SymStatic { value: _ } => {}
|
| InlineAsmOperand::SymStatic { def_id: _ } => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,10 +634,20 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
mir::TerminatorKind::InlineAsm { ref operands, .. } => {
|
mir::TerminatorKind::InlineAsm { ref operands, .. } => {
|
||||||
for op in operands {
|
for op in operands {
|
||||||
if let mir::InlineAsmOperand::SymFn { value } = op {
|
match *op {
|
||||||
|
mir::InlineAsmOperand::SymFn { ref value } => {
|
||||||
let fn_ty = self.monomorphize(value.literal.ty);
|
let fn_ty = self.monomorphize(value.literal.ty);
|
||||||
visit_fn_use(self.tcx, fn_ty, false, &mut self.output);
|
visit_fn_use(self.tcx, fn_ty, false, &mut self.output);
|
||||||
}
|
}
|
||||||
|
mir::InlineAsmOperand::SymStatic { def_id } => {
|
||||||
|
let instance = Instance::mono(self.tcx, def_id);
|
||||||
|
if should_monomorphize_locally(self.tcx, &instance) {
|
||||||
|
trace!("collecting asm sym static {:?}", def_id);
|
||||||
|
self.output.push(MonoItem::Static(def_id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mir::TerminatorKind::Goto { .. }
|
mir::TerminatorKind::Goto { .. }
|
||||||
|
|
|
@ -358,8 +358,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
hair::InlineAsmOperand::SymFn { expr } => {
|
hair::InlineAsmOperand::SymFn { expr } => {
|
||||||
mir::InlineAsmOperand::SymFn { value: box this.as_constant(expr) }
|
mir::InlineAsmOperand::SymFn { value: box this.as_constant(expr) }
|
||||||
}
|
}
|
||||||
hair::InlineAsmOperand::SymStatic { expr } => {
|
hair::InlineAsmOperand::SymStatic { def_id } => {
|
||||||
mir::InlineAsmOperand::SymStatic { value: box this.as_constant(expr) }
|
mir::InlineAsmOperand::SymStatic { def_id }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
@ -467,25 +467,8 @@ fn make_mirror_unadjusted<'a, 'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Res::Def(DefKind::Static, id) => {
|
Res::Def(DefKind::Static, def_id) => {
|
||||||
ty = cx.tcx.static_ptr_ty(id);
|
InlineAsmOperand::SymStatic { def_id }
|
||||||
let ptr = cx.tcx.create_static_alloc(id);
|
|
||||||
InlineAsmOperand::SymStatic {
|
|
||||||
expr: Expr {
|
|
||||||
ty,
|
|
||||||
temp_lifetime,
|
|
||||||
span: expr.span,
|
|
||||||
kind: ExprKind::StaticRef {
|
|
||||||
literal: ty::Const::from_scalar(
|
|
||||||
cx.tcx,
|
|
||||||
Scalar::Ptr(ptr.into()),
|
|
||||||
ty,
|
|
||||||
),
|
|
||||||
def_id: id,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
.to_ref(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -377,7 +377,7 @@ crate enum InlineAsmOperand<'tcx> {
|
||||||
expr: ExprRef<'tcx>,
|
expr: ExprRef<'tcx>,
|
||||||
},
|
},
|
||||||
SymStatic {
|
SymStatic {
|
||||||
expr: ExprRef<'tcx>,
|
def_id: DefId,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,8 @@ impl rustc_serialize::UseSpecializedDecodable for DefIndex {}
|
||||||
|
|
||||||
/// A `DefId` identifies a particular *definition*, by combining a crate
|
/// A `DefId` identifies a particular *definition*, by combining a crate
|
||||||
/// index and a def index.
|
/// index and a def index.
|
||||||
|
///
|
||||||
|
/// You can create a `DefId` from a `LocalDefId` using `local_def_id.to_def_id()`.
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
|
||||||
pub struct DefId {
|
pub struct DefId {
|
||||||
pub krate: CrateNum,
|
pub krate: CrateNum,
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(expr) = expression {
|
if let Some(expr) = expression {
|
||||||
fcx.emit_coerce_suggestions(&mut err, expr, found, expected);
|
fcx.emit_coerce_suggestions(&mut err, expr, found, expected, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error possibly reported in `check_assign` so avoid emitting error again.
|
// Error possibly reported in `check_assign` so avoid emitting error again.
|
||||||
|
|
|
@ -24,10 +24,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
expr_ty: Ty<'tcx>,
|
expr_ty: Ty<'tcx>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
|
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
|
||||||
) {
|
) {
|
||||||
self.annotate_expected_due_to_let_ty(err, expr);
|
self.annotate_expected_due_to_let_ty(err, expr);
|
||||||
self.suggest_compatible_variants(err, expr, expected, expr_ty);
|
self.suggest_compatible_variants(err, expr, expected, expr_ty);
|
||||||
self.suggest_deref_ref_or_into(err, expr, expected, expr_ty);
|
self.suggest_deref_ref_or_into(err, expr, expected, expr_ty, expected_ty_expr);
|
||||||
if self.suggest_calling_boxed_future_when_appropriate(err, expr, expected, expr_ty) {
|
if self.suggest_calling_boxed_future_when_appropriate(err, expr, expected, expr_ty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -102,9 +103,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
checked_ty: Ty<'tcx>,
|
checked_ty: Ty<'tcx>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
|
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
|
||||||
allow_two_phase: AllowTwoPhase,
|
allow_two_phase: AllowTwoPhase,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let (ty, err) = self.demand_coerce_diag(expr, checked_ty, expected, allow_two_phase);
|
let (ty, err) =
|
||||||
|
self.demand_coerce_diag(expr, checked_ty, expected, expected_ty_expr, allow_two_phase);
|
||||||
if let Some(mut err) = err {
|
if let Some(mut err) = err {
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
|
@ -121,6 +124,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
checked_ty: Ty<'tcx>,
|
checked_ty: Ty<'tcx>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
|
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
|
||||||
allow_two_phase: AllowTwoPhase,
|
allow_two_phase: AllowTwoPhase,
|
||||||
) -> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx>>) {
|
) -> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx>>) {
|
||||||
let expected = self.resolve_vars_with_obligations(expected);
|
let expected = self.resolve_vars_with_obligations(expected);
|
||||||
|
@ -141,7 +145,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
return (expected, None);
|
return (expected, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.emit_coerce_suggestions(&mut err, expr, expr_ty, expected);
|
self.emit_coerce_suggestions(&mut err, expr, expr_ty, expected, expected_ty_expr);
|
||||||
|
|
||||||
(expected, Some(err))
|
(expected, Some(err))
|
||||||
}
|
}
|
||||||
|
@ -671,6 +675,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
checked_ty: Ty<'tcx>,
|
checked_ty: Ty<'tcx>,
|
||||||
expected_ty: Ty<'tcx>,
|
expected_ty: Ty<'tcx>,
|
||||||
|
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if self.tcx.sess.source_map().is_imported(expr.span) {
|
if self.tcx.sess.source_map().is_imported(expr.span) {
|
||||||
// Ignore if span is from within a macro.
|
// Ignore if span is from within a macro.
|
||||||
|
@ -747,7 +752,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let msg = format!("you can convert an `{}` to `{}`", checked_ty, expected_ty);
|
let msg = format!("you can convert an `{}` to `{}`", checked_ty, expected_ty);
|
||||||
let cast_msg = format!("you can cast an `{} to `{}`", checked_ty, expected_ty);
|
let cast_msg = format!("you can cast an `{} to `{}`", checked_ty, expected_ty);
|
||||||
let try_msg = format!("{} and panic if the converted value wouldn't fit", msg);
|
|
||||||
let lit_msg = format!(
|
let lit_msg = format!(
|
||||||
"change the type of the numeric literal from `{}` to `{}`",
|
"change the type of the numeric literal from `{}` to `{}`",
|
||||||
checked_ty, expected_ty,
|
checked_ty, expected_ty,
|
||||||
|
@ -761,7 +765,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let cast_suggestion = format!("{}{} as {}", prefix, with_opt_paren(&src), expected_ty);
|
let cast_suggestion = format!("{}{} as {}", prefix, with_opt_paren(&src), expected_ty);
|
||||||
let try_into_suggestion = format!("{}{}.try_into().unwrap()", prefix, with_opt_paren(&src));
|
|
||||||
let into_suggestion = format!("{}{}.into()", prefix, with_opt_paren(&src));
|
let into_suggestion = format!("{}{}.into()", prefix, with_opt_paren(&src));
|
||||||
let suffix_suggestion = with_opt_paren(&format_args!(
|
let suffix_suggestion = with_opt_paren(&format_args!(
|
||||||
"{}{}",
|
"{}{}",
|
||||||
|
@ -782,22 +785,55 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let in_const_context = self.tcx.hir().is_inside_const_context(expr.hir_id);
|
let in_const_context = self.tcx.hir().is_inside_const_context(expr.hir_id);
|
||||||
|
|
||||||
|
let suggest_fallible_into_or_lhs_from =
|
||||||
|
|err: &mut DiagnosticBuilder<'_>, exp_to_found_is_fallible: bool| {
|
||||||
|
// If we know the expression the expected type is derived from, we might be able
|
||||||
|
// to suggest a widening conversion rather than a narrowing one (which may
|
||||||
|
// panic). For example, given x: u8 and y: u32, if we know the span of "x",
|
||||||
|
// x > y
|
||||||
|
// can be given the suggestion "u32::from(x) > y" rather than
|
||||||
|
// "x > y.try_into().unwrap()".
|
||||||
|
let lhs_expr_and_src = expected_ty_expr.and_then(|expr| {
|
||||||
|
match self.tcx.sess.source_map().span_to_snippet(expr.span).ok() {
|
||||||
|
Some(src) => Some((expr, src)),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let (span, msg, suggestion) = if let (Some((lhs_expr, lhs_src)), false) =
|
||||||
|
(lhs_expr_and_src, exp_to_found_is_fallible)
|
||||||
|
{
|
||||||
|
let msg = format!(
|
||||||
|
"you can convert `{}` from `{}` to `{}`, matching the type of `{}`",
|
||||||
|
lhs_src, expected_ty, checked_ty, src
|
||||||
|
);
|
||||||
|
let suggestion = format!("{}::from({})", checked_ty, lhs_src,);
|
||||||
|
(lhs_expr.span, msg, suggestion)
|
||||||
|
} else {
|
||||||
|
let msg = format!("{} and panic if the converted value wouldn't fit", msg);
|
||||||
|
let suggestion =
|
||||||
|
format!("{}{}.try_into().unwrap()", prefix, with_opt_paren(&src));
|
||||||
|
(expr.span, msg, suggestion)
|
||||||
|
};
|
||||||
|
err.span_suggestion(span, &msg, suggestion, Applicability::MachineApplicable);
|
||||||
|
};
|
||||||
|
|
||||||
let suggest_to_change_suffix_or_into =
|
let suggest_to_change_suffix_or_into =
|
||||||
|err: &mut DiagnosticBuilder<'_>, is_fallible: bool| {
|
|err: &mut DiagnosticBuilder<'_>,
|
||||||
|
found_to_exp_is_fallible: bool,
|
||||||
|
exp_to_found_is_fallible: bool| {
|
||||||
let msg = if literal_is_ty_suffixed(expr) {
|
let msg = if literal_is_ty_suffixed(expr) {
|
||||||
&lit_msg
|
&lit_msg
|
||||||
} else if in_const_context {
|
} else if in_const_context {
|
||||||
// Do not recommend `into` or `try_into` in const contexts.
|
// Do not recommend `into` or `try_into` in const contexts.
|
||||||
return;
|
return;
|
||||||
} else if is_fallible {
|
} else if found_to_exp_is_fallible {
|
||||||
&try_msg
|
return suggest_fallible_into_or_lhs_from(err, exp_to_found_is_fallible);
|
||||||
} else {
|
} else {
|
||||||
&msg
|
&msg
|
||||||
};
|
};
|
||||||
let suggestion = if literal_is_ty_suffixed(expr) {
|
let suggestion = if literal_is_ty_suffixed(expr) {
|
||||||
suffix_suggestion.clone()
|
suffix_suggestion.clone()
|
||||||
} else if is_fallible {
|
|
||||||
try_into_suggestion
|
|
||||||
} else {
|
} else {
|
||||||
into_suggestion.clone()
|
into_suggestion.clone()
|
||||||
};
|
};
|
||||||
|
@ -806,41 +842,54 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
match (&expected_ty.kind, &checked_ty.kind) {
|
match (&expected_ty.kind, &checked_ty.kind) {
|
||||||
(&ty::Int(ref exp), &ty::Int(ref found)) => {
|
(&ty::Int(ref exp), &ty::Int(ref found)) => {
|
||||||
let is_fallible = match (exp.bit_width(), found.bit_width()) {
|
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
|
||||||
(Some(exp), Some(found)) if exp < found => true,
|
{
|
||||||
(None, Some(8 | 16)) => false,
|
(Some(exp), Some(found)) if exp < found => (true, false),
|
||||||
(None, _) | (_, None) => true,
|
(Some(exp), Some(found)) if exp > found => (false, true),
|
||||||
_ => false,
|
(None, Some(8 | 16)) => (false, true),
|
||||||
|
(Some(8 | 16), None) => (true, false),
|
||||||
|
(None, _) | (_, None) => (true, true),
|
||||||
|
_ => (false, false),
|
||||||
};
|
};
|
||||||
suggest_to_change_suffix_or_into(err, is_fallible);
|
suggest_to_change_suffix_or_into(err, f2e_is_fallible, e2f_is_fallible);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
(&ty::Uint(ref exp), &ty::Uint(ref found)) => {
|
(&ty::Uint(ref exp), &ty::Uint(ref found)) => {
|
||||||
let is_fallible = match (exp.bit_width(), found.bit_width()) {
|
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
|
||||||
(Some(exp), Some(found)) if exp < found => true,
|
{
|
||||||
(None, Some(8 | 16)) => false,
|
(Some(exp), Some(found)) if exp < found => (true, false),
|
||||||
(None, _) | (_, None) => true,
|
(Some(exp), Some(found)) if exp > found => (false, true),
|
||||||
_ => false,
|
(None, Some(8 | 16)) => (false, true),
|
||||||
|
(Some(8 | 16), None) => (true, false),
|
||||||
|
(None, _) | (_, None) => (true, true),
|
||||||
|
_ => (false, false),
|
||||||
};
|
};
|
||||||
suggest_to_change_suffix_or_into(err, is_fallible);
|
suggest_to_change_suffix_or_into(err, f2e_is_fallible, e2f_is_fallible);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
(&ty::Int(exp), &ty::Uint(found)) => {
|
(&ty::Int(exp), &ty::Uint(found)) => {
|
||||||
let is_fallible = match (exp.bit_width(), found.bit_width()) {
|
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
|
||||||
(Some(exp), Some(found)) if found < exp => false,
|
{
|
||||||
(None, Some(8)) => false,
|
(Some(exp), Some(found)) if found < exp => (false, true),
|
||||||
_ => true,
|
(None, Some(8)) => (false, true),
|
||||||
|
_ => (true, true),
|
||||||
};
|
};
|
||||||
suggest_to_change_suffix_or_into(err, is_fallible);
|
suggest_to_change_suffix_or_into(err, f2e_is_fallible, e2f_is_fallible);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
(&ty::Uint(_), &ty::Int(_)) => {
|
(&ty::Uint(exp), &ty::Int(found)) => {
|
||||||
suggest_to_change_suffix_or_into(err, true);
|
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
|
||||||
|
{
|
||||||
|
(Some(exp), Some(found)) if found > exp => (true, false),
|
||||||
|
(Some(8), None) => (true, false),
|
||||||
|
_ => (true, true),
|
||||||
|
};
|
||||||
|
suggest_to_change_suffix_or_into(err, f2e_is_fallible, e2f_is_fallible);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
(&ty::Float(ref exp), &ty::Float(ref found)) => {
|
(&ty::Float(ref exp), &ty::Float(ref found)) => {
|
||||||
if found.bit_width() < exp.bit_width() {
|
if found.bit_width() < exp.bit_width() {
|
||||||
suggest_to_change_suffix_or_into(err, false);
|
suggest_to_change_suffix_or_into(err, false, true);
|
||||||
} else if literal_is_ty_suffixed(expr) {
|
} else if literal_is_ty_suffixed(expr) {
|
||||||
err.span_suggestion(
|
err.span_suggestion(
|
||||||
expr.span,
|
expr.span,
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
if let Some(mut err) = self.demand_suptype_diag(expr.span, expected_ty, ty) {
|
if let Some(mut err) = self.demand_suptype_diag(expr.span, expected_ty, ty) {
|
||||||
let expr = expr.peel_drop_temps();
|
let expr = expr.peel_drop_temps();
|
||||||
self.suggest_deref_ref_or_into(&mut err, expr, expected_ty, ty);
|
self.suggest_deref_ref_or_into(&mut err, expr, expected_ty, ty, None);
|
||||||
extend_err(&mut err);
|
extend_err(&mut err);
|
||||||
// Error possibly reported in `check_assign` so avoid emitting error again.
|
// Error possibly reported in `check_assign` so avoid emitting error again.
|
||||||
err.emit_unless(self.is_assign_to_bool(expr, expected_ty));
|
err.emit_unless(self.is_assign_to_bool(expr, expected_ty));
|
||||||
|
@ -98,10 +98,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
&self,
|
&self,
|
||||||
expr: &'tcx hir::Expr<'tcx>,
|
expr: &'tcx hir::Expr<'tcx>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
|
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let ty = self.check_expr_with_hint(expr, expected);
|
let ty = self.check_expr_with_hint(expr, expected);
|
||||||
// checks don't need two phase
|
// checks don't need two phase
|
||||||
self.demand_coerce(expr, ty, expected, AllowTwoPhase::No)
|
self.demand_coerce(expr, ty, expected, expected_ty_expr, AllowTwoPhase::No)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn check_expr_with_hint(
|
pub(super) fn check_expr_with_hint(
|
||||||
|
@ -776,7 +777,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
span: &Span,
|
span: &Span,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let lhs_ty = self.check_expr_with_needs(&lhs, Needs::MutPlace);
|
let lhs_ty = self.check_expr_with_needs(&lhs, Needs::MutPlace);
|
||||||
let rhs_ty = self.check_expr_coercable_to_type(&rhs, lhs_ty);
|
let rhs_ty = self.check_expr_coercable_to_type(&rhs, lhs_ty, Some(lhs));
|
||||||
|
|
||||||
let expected_ty = expected.coercion_target_type(self, expr.span);
|
let expected_ty = expected.coercion_target_type(self, expr.span);
|
||||||
if expected_ty == self.tcx.types.bool {
|
if expected_ty == self.tcx.types.bool {
|
||||||
|
@ -1026,7 +1027,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let (element_ty, t) = match uty {
|
let (element_ty, t) = match uty {
|
||||||
Some(uty) => {
|
Some(uty) => {
|
||||||
self.check_expr_coercable_to_type(&element, uty);
|
self.check_expr_coercable_to_type(&element, uty, None);
|
||||||
(uty, uty)
|
(uty, uty)
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -1063,7 +1064,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let elt_ts_iter = elts.iter().enumerate().map(|(i, e)| match flds {
|
let elt_ts_iter = elts.iter().enumerate().map(|(i, e)| match flds {
|
||||||
Some(ref fs) if i < fs.len() => {
|
Some(ref fs) if i < fs.len() => {
|
||||||
let ety = fs[i].expect_ty();
|
let ety = fs[i].expect_ty();
|
||||||
self.check_expr_coercable_to_type(&e, ety);
|
self.check_expr_coercable_to_type(&e, ety, None);
|
||||||
ety
|
ety
|
||||||
}
|
}
|
||||||
_ => self.check_expr_with_expectation(&e, NoExpectation),
|
_ => self.check_expr_with_expectation(&e, NoExpectation),
|
||||||
|
@ -1237,7 +1238,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
// Make sure to give a type to the field even if there's
|
// Make sure to give a type to the field even if there's
|
||||||
// an error, so we can continue type-checking.
|
// an error, so we can continue type-checking.
|
||||||
self.check_expr_coercable_to_type(&field.expr, field_type);
|
self.check_expr_coercable_to_type(&field.expr, field_type, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the programmer specified correct number of fields.
|
// Make sure the programmer specified correct number of fields.
|
||||||
|
@ -1735,7 +1736,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
match self.lookup_indexing(expr, base, base_t, idx_t, needs) {
|
match self.lookup_indexing(expr, base, base_t, idx_t, needs) {
|
||||||
Some((index_ty, element_ty)) => {
|
Some((index_ty, element_ty)) => {
|
||||||
// two-phase not needed because index_ty is never mutable
|
// two-phase not needed because index_ty is never mutable
|
||||||
self.demand_coerce(idx, idx_t, index_ty, AllowTwoPhase::No);
|
self.demand_coerce(idx, idx_t, index_ty, None, AllowTwoPhase::No);
|
||||||
element_ty
|
element_ty
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -1788,7 +1789,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
match self.resume_yield_tys {
|
match self.resume_yield_tys {
|
||||||
Some((resume_ty, yield_ty)) => {
|
Some((resume_ty, yield_ty)) => {
|
||||||
self.check_expr_coercable_to_type(&value, yield_ty);
|
self.check_expr_coercable_to_type(&value, yield_ty, None);
|
||||||
|
|
||||||
resume_ty
|
resume_ty
|
||||||
}
|
}
|
||||||
|
@ -1797,7 +1798,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// information. Hence, we check the source of the yield expression here and check its
|
// information. Hence, we check the source of the yield expression here and check its
|
||||||
// value's type against `()` (this check should always hold).
|
// value's type against `()` (this check should always hold).
|
||||||
None if src.is_await() => {
|
None if src.is_await() => {
|
||||||
self.check_expr_coercable_to_type(&value, self.tcx.mk_unit());
|
self.check_expr_coercable_to_type(&value, self.tcx.mk_unit(), None);
|
||||||
self.tcx.mk_unit()
|
self.tcx.mk_unit()
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -1836,11 +1837,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
ty::FnDef(..) => {
|
ty::FnDef(..) => {
|
||||||
let fnptr_ty = self.tcx.mk_fn_ptr(ty.fn_sig(self.tcx));
|
let fnptr_ty = self.tcx.mk_fn_ptr(ty.fn_sig(self.tcx));
|
||||||
self.demand_coerce(expr, ty, fnptr_ty, AllowTwoPhase::No);
|
self.demand_coerce(expr, ty, fnptr_ty, None, AllowTwoPhase::No);
|
||||||
}
|
}
|
||||||
ty::Ref(_, base_ty, mutbl) => {
|
ty::Ref(_, base_ty, mutbl) => {
|
||||||
let ptr_ty = self.tcx.mk_ptr(ty::TypeAndMut { ty: base_ty, mutbl });
|
let ptr_ty = self.tcx.mk_ptr(ty::TypeAndMut { ty: base_ty, mutbl });
|
||||||
self.demand_coerce(expr, ty, ptr_ty, AllowTwoPhase::No);
|
self.demand_coerce(expr, ty, ptr_ty, None, AllowTwoPhase::No);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1046,7 +1046,7 @@ fn typeck_tables_of_with_fallback<'tcx>(
|
||||||
// Gather locals in statics (because of block expressions).
|
// Gather locals in statics (because of block expressions).
|
||||||
GatherLocalsVisitor { fcx: &fcx, parent_id: id }.visit_body(body);
|
GatherLocalsVisitor { fcx: &fcx, parent_id: id }.visit_body(body);
|
||||||
|
|
||||||
fcx.check_expr_coercable_to_type(&body.value, revealed_ty);
|
fcx.check_expr_coercable_to_type(&body.value, revealed_ty, None);
|
||||||
|
|
||||||
fcx.write_ty(id, revealed_ty);
|
fcx.write_ty(id, revealed_ty);
|
||||||
|
|
||||||
|
@ -4123,7 +4123,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let coerce_ty = expected.only_has_type(self).unwrap_or(formal_ty);
|
let coerce_ty = expected.only_has_type(self).unwrap_or(formal_ty);
|
||||||
// We're processing function arguments so we definitely want to use
|
// We're processing function arguments so we definitely want to use
|
||||||
// two-phase borrows.
|
// two-phase borrows.
|
||||||
self.demand_coerce(&arg, checked_ty, coerce_ty, AllowTwoPhase::Yes);
|
self.demand_coerce(&arg, checked_ty, coerce_ty, None, AllowTwoPhase::Yes);
|
||||||
final_arg_types.push((i, checked_ty, coerce_ty));
|
final_arg_types.push((i, checked_ty, coerce_ty));
|
||||||
|
|
||||||
// 3. Relate the expected type and the formal one,
|
// 3. Relate the expected type and the formal one,
|
||||||
|
@ -4541,7 +4541,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
self.demand_eqtype(init.span, local_ty, init_ty);
|
self.demand_eqtype(init.span, local_ty, init_ty);
|
||||||
init_ty
|
init_ty
|
||||||
} else {
|
} else {
|
||||||
self.check_expr_coercable_to_type(init, local_ty)
|
self.check_expr_coercable_to_type(init, local_ty, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5027,6 +5027,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
found: Ty<'tcx>,
|
found: Ty<'tcx>,
|
||||||
|
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
|
||||||
) {
|
) {
|
||||||
if let Some((sp, msg, suggestion, applicability)) = self.check_ref(expr, found, expected) {
|
if let Some((sp, msg, suggestion, applicability)) = self.check_ref(expr, found, expected) {
|
||||||
err.span_suggestion(sp, msg, suggestion, applicability);
|
err.span_suggestion(sp, msg, suggestion, applicability);
|
||||||
|
@ -5037,7 +5038,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let sp = self.sess().source_map().guess_head_span(sp);
|
let sp = self.sess().source_map().guess_head_span(sp);
|
||||||
err.span_label(sp, &format!("{} defined here", found));
|
err.span_label(sp, &format!("{} defined here", found));
|
||||||
}
|
}
|
||||||
} else if !self.check_for_cast(err, expr, found, expected) {
|
} else if !self.check_for_cast(err, expr, found, expected, expected_ty_expr) {
|
||||||
let is_struct_pat_shorthand_field =
|
let is_struct_pat_shorthand_field =
|
||||||
self.is_hir_id_from_struct_pattern_shorthand_field(expr.hir_id, expr.span);
|
self.is_hir_id_from_struct_pattern_shorthand_field(expr.hir_id, expr.span);
|
||||||
let methods = self.get_conversion_methods(expr.span, expected, found, expr.hir_id);
|
let methods = self.get_conversion_methods(expr.span, expected, found, expr.hir_id);
|
||||||
|
|
|
@ -57,9 +57,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
match BinOpCategory::from(op) {
|
match BinOpCategory::from(op) {
|
||||||
BinOpCategory::Shortcircuit => {
|
BinOpCategory::Shortcircuit => {
|
||||||
// && and || are a simple case.
|
// && and || are a simple case.
|
||||||
self.check_expr_coercable_to_type(lhs_expr, tcx.types.bool);
|
self.check_expr_coercable_to_type(lhs_expr, tcx.types.bool, None);
|
||||||
let lhs_diverges = self.diverges.get();
|
let lhs_diverges = self.diverges.get();
|
||||||
self.check_expr_coercable_to_type(rhs_expr, tcx.types.bool);
|
self.check_expr_coercable_to_type(rhs_expr, tcx.types.bool, None);
|
||||||
|
|
||||||
// Depending on the LHS' value, the RHS can never execute.
|
// Depending on the LHS' value, the RHS can never execute.
|
||||||
self.diverges.set(lhs_diverges);
|
self.diverges.set(lhs_diverges);
|
||||||
|
@ -170,7 +170,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
kind: TypeVariableOriginKind::MiscVariable,
|
kind: TypeVariableOriginKind::MiscVariable,
|
||||||
span: lhs_expr.span,
|
span: lhs_expr.span,
|
||||||
});
|
});
|
||||||
self.demand_coerce(lhs_expr, lhs_ty, fresh_var, AllowTwoPhase::No)
|
self.demand_coerce(lhs_expr, lhs_ty, fresh_var, Some(rhs_expr), AllowTwoPhase::No)
|
||||||
}
|
}
|
||||||
IsAssign::Yes => {
|
IsAssign::Yes => {
|
||||||
// rust-lang/rust#52126: We have to use strict
|
// rust-lang/rust#52126: We have to use strict
|
||||||
|
@ -196,7 +196,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let result = self.lookup_op_method(lhs_ty, &[rhs_ty_var], Op::Binary(op, is_assign));
|
let result = self.lookup_op_method(lhs_ty, &[rhs_ty_var], Op::Binary(op, is_assign));
|
||||||
|
|
||||||
// see `NB` above
|
// see `NB` above
|
||||||
let rhs_ty = self.check_expr_coercable_to_type(rhs_expr, rhs_ty_var);
|
let rhs_ty = self.check_expr_coercable_to_type(rhs_expr, rhs_ty_var, Some(lhs_expr));
|
||||||
let rhs_ty = self.resolve_vars_with_obligations(rhs_ty);
|
let rhs_ty = self.resolve_vars_with_obligations(rhs_ty);
|
||||||
|
|
||||||
let return_ty = match result {
|
let return_ty = match result {
|
||||||
|
|
|
@ -36,12 +36,6 @@ fn main() {
|
||||||
println!("cargo:rustc-link-lib=gcc_pic");
|
println!("cargo:rustc-link-lib=gcc_pic");
|
||||||
} else if target.contains("pc-windows-gnu") {
|
} else if target.contains("pc-windows-gnu") {
|
||||||
// This is handled in the target spec with late_link_args_[static|dynamic]
|
// This is handled in the target spec with late_link_args_[static|dynamic]
|
||||||
|
|
||||||
// cfg!(bootstrap) doesn't work in build scripts
|
|
||||||
if env::var("RUSTC_STAGE").ok() == Some("0".to_string()) {
|
|
||||||
println!("cargo:rustc-link-lib=static-nobundle=gcc_eh");
|
|
||||||
println!("cargo:rustc-link-lib=static-nobundle=pthread");
|
|
||||||
}
|
|
||||||
} else if target.contains("uwp-windows-gnu") {
|
} else if target.contains("uwp-windows-gnu") {
|
||||||
println!("cargo:rustc-link-lib=unwind");
|
println!("cargo:rustc-link-lib=unwind");
|
||||||
} else if target.contains("fuchsia") {
|
} else if target.contains("fuchsia") {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// no-system-llvm
|
// no-system-llvm
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
// only-linux
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
#![feature(asm, track_caller)]
|
#![feature(asm, track_caller, thread_local)]
|
||||||
|
|
||||||
extern "C" fn f1() -> i32 {
|
extern "C" fn f1() -> i32 {
|
||||||
111
|
111
|
||||||
|
@ -15,9 +16,9 @@ fn f2() -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! call {
|
macro_rules! call {
|
||||||
($func:path) => {{
|
($func:path) => {
|
||||||
let result: i32;
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let result: i32;
|
||||||
asm!("call {}", sym $func,
|
asm!("call {}", sym $func,
|
||||||
out("rax") result,
|
out("rax") result,
|
||||||
out("rcx") _, out("rdx") _, out("rdi") _, out("rsi") _,
|
out("rcx") _, out("rdx") _, out("rdi") _, out("rsi") _,
|
||||||
|
@ -27,12 +28,53 @@ macro_rules! call {
|
||||||
out("xmm8") _, out("xmm9") _, out("xmm10") _, out("xmm11") _,
|
out("xmm8") _, out("xmm9") _, out("xmm10") _, out("xmm11") _,
|
||||||
out("xmm12") _, out("xmm13") _, out("xmm14") _, out("xmm15") _,
|
out("xmm12") _, out("xmm13") _, out("xmm14") _, out("xmm15") _,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
result
|
result
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! static_addr {
|
||||||
|
($s:expr) => {
|
||||||
|
unsafe {
|
||||||
|
let result: *const u32;
|
||||||
|
// LEA performs a RIP-relative address calculation and returns the address
|
||||||
|
asm!("lea {}, [rip + {}]", out(reg) result, sym $s);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
macro_rules! static_tls_addr {
|
||||||
|
($s:expr) => {
|
||||||
|
unsafe {
|
||||||
|
let result: *const u32;
|
||||||
|
asm!(
|
||||||
|
"
|
||||||
|
# Load TLS base address
|
||||||
|
mov {out}, qword ptr fs:[0]
|
||||||
|
# Calculate the address of sym in the TLS block. The @tpoff
|
||||||
|
# relocation gives the offset of the symbol from the start
|
||||||
|
# of the TLS block.
|
||||||
|
lea {out}, [{out} + {sym}@tpoff]
|
||||||
|
",
|
||||||
|
out = out(reg) result,
|
||||||
|
sym = sym $s
|
||||||
|
);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static S1: u32 = 111;
|
||||||
|
#[thread_local]
|
||||||
|
static S2: u32 = 222;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert_eq!(call!(f1), 111);
|
assert_eq!(call!(f1), 111);
|
||||||
assert_eq!(call!(f2), 222);
|
assert_eq!(call!(f2), 222);
|
||||||
|
assert_eq!(static_addr!(S1), &S1 as *const u32);
|
||||||
|
assert_eq!(static_tls_addr!(S2), &S2 as *const u32);
|
||||||
|
std::thread::spawn(|| {
|
||||||
|
assert_eq!(static_addr!(S1), &S1 as *const u32);
|
||||||
|
assert_eq!(static_tls_addr!(S2), &S2 as *const u32);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,3 +6,4 @@ LL | #[ffi_returns_twice]
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0724`.
|
||||||
|
|
|
@ -0,0 +1,320 @@
|
||||||
|
// run-rustfix
|
||||||
|
|
||||||
|
// The `try_into` suggestion doesn't include this, but we do suggest it after applying it
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
#[allow(unused_must_use)]
|
||||||
|
fn main() {
|
||||||
|
let x_usize: usize = 1;
|
||||||
|
let x_u128: u128 = 2;
|
||||||
|
let x_u64: u64 = 3;
|
||||||
|
let x_u32: u32 = 4;
|
||||||
|
let x_u16: u16 = 5;
|
||||||
|
let x_u8: u8 = 6;
|
||||||
|
let x_isize: isize = 7;
|
||||||
|
let x_i64: i64 = 8;
|
||||||
|
let x_i32: i32 = 9;
|
||||||
|
let x_i16: i16 = 10;
|
||||||
|
let x_i8: i8 = 11;
|
||||||
|
let x_i128: i128 = 12;
|
||||||
|
|
||||||
|
/* u<->u */
|
||||||
|
{
|
||||||
|
u16::from(x_u8) > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u32::from(x_u8) > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u64::from(x_u8) > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u128::from(x_u8) > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
usize::from(x_u8) > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u16 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u32::from(x_u16) > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u64::from(x_u16) > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u128::from(x_u16) > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
usize::from(x_u16) > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u32 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u64::from(x_u32) > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u128::from(x_u32) > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u64 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_u32.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
u128::from(x_u64) > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u128 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_u32.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_u64.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_usize > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i<->i */
|
||||||
|
{
|
||||||
|
i16::from(x_i8) > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i32::from(x_i8) > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i64::from(x_i8) > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_i8) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
isize::from(x_i8) > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i16 > x_i8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i32::from(x_i16) > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i64::from(x_i16) > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_i16) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
isize::from(x_i16) > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i32 > x_i8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_i16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i64::from(x_i32) > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_i32) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i64 > x_i8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_i16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_i32.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_i64) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i128 > x_i8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_i16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_i32.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_i64.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_isize > x_i8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
/* u<->i */
|
||||||
|
{
|
||||||
|
x_u8 > x_i8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i16::from(x_u8) > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i32::from(x_u8) > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i64::from(x_u8) > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_u8) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
isize::from(x_u8) > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u16 > x_i8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_i16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i32::from(x_u16) > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i64::from(x_u16) > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_u16) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u32 > x_i8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_i16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_i32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i64::from(x_u32) > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_u32) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u64 > x_i8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
i128::from(x_u64) > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u128 > x_i8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_usize > x_i8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_isize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i<->u */
|
||||||
|
{
|
||||||
|
x_i8 > x_u8.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i16 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i32 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i64 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u32.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i128 > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u16.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u32.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u64.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_isize > x_u8.into();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u16.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u32.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u64.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u128.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_usize.try_into().unwrap();
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,320 @@
|
||||||
|
// run-rustfix
|
||||||
|
|
||||||
|
// The `try_into` suggestion doesn't include this, but we do suggest it after applying it
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
|
#[allow(unused_must_use)]
|
||||||
|
fn main() {
|
||||||
|
let x_usize: usize = 1;
|
||||||
|
let x_u128: u128 = 2;
|
||||||
|
let x_u64: u64 = 3;
|
||||||
|
let x_u32: u32 = 4;
|
||||||
|
let x_u16: u16 = 5;
|
||||||
|
let x_u8: u8 = 6;
|
||||||
|
let x_isize: isize = 7;
|
||||||
|
let x_i64: i64 = 8;
|
||||||
|
let x_i32: i32 = 9;
|
||||||
|
let x_i16: i16 = 10;
|
||||||
|
let x_i8: i8 = 11;
|
||||||
|
let x_i128: i128 = 12;
|
||||||
|
|
||||||
|
/* u<->u */
|
||||||
|
{
|
||||||
|
x_u8 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u16 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u32 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u64 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u128 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_usize > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i<->i */
|
||||||
|
{
|
||||||
|
x_i8 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i16 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i32 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i64 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i128 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_isize > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
/* u<->i */
|
||||||
|
{
|
||||||
|
x_u8 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u8 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u16 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u16 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u32 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u32 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u64 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u64 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_u128 > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_u128 > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_usize > x_i8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_i128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_usize > x_isize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i<->u */
|
||||||
|
{
|
||||||
|
x_i8 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i8 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i16 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i16 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i32 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i32 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i64 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i64 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_i128 > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_i128 > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
|
||||||
|
x_isize > x_u8;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u16;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u32;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u64;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_u128;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
x_isize > x_usize;
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -58,7 +58,9 @@ label = "O-ARM"
|
||||||
|
|
||||||
[prioritize]
|
[prioritize]
|
||||||
label = "I-prioritize"
|
label = "I-prioritize"
|
||||||
prioritize_on = [
|
|
||||||
|
[autolabel."I-prioritize"]
|
||||||
|
trigger_labels = [
|
||||||
"regression-from-stable-to-stable",
|
"regression-from-stable-to-stable",
|
||||||
"regression-from-stable-to-beta",
|
"regression-from-stable-to-beta",
|
||||||
"regression-from-stable-to-nightly",
|
"regression-from-stable-to-nightly",
|
||||||
|
@ -70,4 +72,46 @@ exclude_labels = [
|
||||||
"T-release",
|
"T-release",
|
||||||
"requires-nightly",
|
"requires-nightly",
|
||||||
]
|
]
|
||||||
zulip_stream = 227806
|
|
||||||
|
[notify-zulip."I-prioritize"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "I-prioritize #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** issue #{number} has been requested for prioritization."
|
||||||
|
message_on_remove = "Issue #{number}'s prioritization request has been removed."
|
||||||
|
|
||||||
|
[notify-zulip."I-nominated"]
|
||||||
|
required_labels = ["T-compiler"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "I-prioritize #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** #{number} has been nominated for discussion in `T-compiler` meeting."
|
||||||
|
message_on_remove = "#{number}'s nomination has been removed."
|
||||||
|
|
||||||
|
[notify-zulip."beta-nominated"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "Backport #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** PR #{number} has been requested for beta backport."
|
||||||
|
message_on_remove = "PR #{number}'s beta backport request has been removed."
|
||||||
|
|
||||||
|
[notify-zulip."stable-nominated"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "Backport #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** PR #{number} has been requested for stable backport."
|
||||||
|
message_on_remove = "PR #{number}'s stable backport request has been removed."
|
||||||
|
|
||||||
|
[notify-zulip."S-waiting-on-team"]
|
||||||
|
required_labels = ["T-compiler"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "S-waiting-on-team #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** PR #{number} is waiting on `T-compiler`."
|
||||||
|
message_on_remove = "PR #{number}'s is no longer waiting on `T-compiler`."
|
||||||
|
|
||||||
|
[notify-zulip."P-critical"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "P-critical #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** issue #{number} has been assigned `P-critical`."
|
||||||
|
|
||||||
|
[notify-zulip."P-high"]
|
||||||
|
required_labels = ["regression-from-stable-to-*"]
|
||||||
|
zulip_stream = 227806 # #t-compiler/wg-prioritization
|
||||||
|
topic = "P-high regression #{number} {title}"
|
||||||
|
message_on_add = "@**WG-prioritization** issue #{number} has been assigned `P-high` and is a regression."
|
||||||
|
|
Loading…
Reference in New Issue