Auto merge of #90299 - matthiaskrgr:rollup-n77ntld, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #90181 (fix(rustc_typeck): report function argument errors on matching type) - #90241 (Make thiscall abi on unsupported platforms a hard error) - #90294 (Update books) - #90295 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
1b61b1b445
44 changed files with 290 additions and 192 deletions
|
@ -276,7 +276,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo"
|
name = "cargo"
|
||||||
version = "0.58.0"
|
version = "0.59.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"atty",
|
"atty",
|
||||||
|
|
|
@ -1522,6 +1522,7 @@ impl Target {
|
||||||
AmdGpuKernel => self.arch == "amdgcn",
|
AmdGpuKernel => self.arch == "amdgcn",
|
||||||
AvrInterrupt | AvrNonBlockingInterrupt => self.arch == "avr",
|
AvrInterrupt | AvrNonBlockingInterrupt => self.arch == "avr",
|
||||||
Wasm => ["wasm32", "wasm64"].contains(&&self.arch[..]),
|
Wasm => ["wasm32", "wasm64"].contains(&&self.arch[..]),
|
||||||
|
Thiscall { .. } => self.arch == "x86",
|
||||||
// On windows these fall-back to platform native calling convention (C) when the
|
// On windows these fall-back to platform native calling convention (C) when the
|
||||||
// architecture is not supported.
|
// architecture is not supported.
|
||||||
//
|
//
|
||||||
|
@ -1552,15 +1553,13 @@ impl Target {
|
||||||
// > convention is used.
|
// > convention is used.
|
||||||
//
|
//
|
||||||
// -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
|
// -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
|
||||||
Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall if self.is_like_windows => {
|
Stdcall { .. } | Fastcall | Vectorcall if self.is_like_windows => true,
|
||||||
true
|
|
||||||
}
|
|
||||||
// Outside of Windows we want to only support these calling conventions for the
|
// Outside of Windows we want to only support these calling conventions for the
|
||||||
// architectures for which these calling conventions are actually well defined.
|
// architectures for which these calling conventions are actually well defined.
|
||||||
Stdcall { .. } | Fastcall | Thiscall { .. } if self.arch == "x86" => true,
|
Stdcall { .. } | Fastcall if self.arch == "x86" => true,
|
||||||
Vectorcall if ["x86", "x86_64"].contains(&&self.arch[..]) => true,
|
Vectorcall if ["x86", "x86_64"].contains(&&self.arch[..]) => true,
|
||||||
// Return a `None` for other cases so that we know to emit a future compat lint.
|
// Return a `None` for other cases so that we know to emit a future compat lint.
|
||||||
Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall => return None,
|
Stdcall { .. } | Fastcall | Vectorcall => return None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1492,6 +1492,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => {
|
||||||
|
self.get_parent_trait_ref(&parent_code)
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1422,6 +1422,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
while let Some(code) = next_code {
|
while let Some(code) = next_code {
|
||||||
debug!("maybe_note_obligation_cause_for_async_await: code={:?}", code);
|
debug!("maybe_note_obligation_cause_for_async_await: code={:?}", code);
|
||||||
match code {
|
match code {
|
||||||
|
ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => {
|
||||||
|
next_code = Some(parent_code.as_ref());
|
||||||
|
}
|
||||||
ObligationCauseCode::DerivedObligation(derived_obligation)
|
ObligationCauseCode::DerivedObligation(derived_obligation)
|
||||||
| ObligationCauseCode::BuiltinDerivedObligation(derived_obligation)
|
| ObligationCauseCode::BuiltinDerivedObligation(derived_obligation)
|
||||||
| ObligationCauseCode::ImplDerivedObligation(derived_obligation) => {
|
| ObligationCauseCode::ImplDerivedObligation(derived_obligation) => {
|
||||||
|
|
|
@ -370,6 +370,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// `ExpectHasType(expected_ty)`, or the `formal_ty` otherwise.
|
// `ExpectHasType(expected_ty)`, or the `formal_ty` otherwise.
|
||||||
let coerce_ty = expected.only_has_type(self).unwrap_or(formal_ty);
|
let coerce_ty = expected.only_has_type(self).unwrap_or(formal_ty);
|
||||||
|
|
||||||
|
final_arg_types.push((i, checked_ty, coerce_ty));
|
||||||
|
|
||||||
// Cause selection errors caused by resolving a single argument to point at the
|
// Cause selection errors caused by resolving a single argument to point at the
|
||||||
// argument and not the call. This is otherwise redundant with the `demand_coerce`
|
// argument and not the call. This is otherwise redundant with the `demand_coerce`
|
||||||
// call immediately after, but it lets us customize the span pointed to in the
|
// call immediately after, but it lets us customize the span pointed to in the
|
||||||
|
@ -377,38 +379,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let _ = self.resolve_vars_with_obligations_and_mutate_fulfillment(
|
let _ = self.resolve_vars_with_obligations_and_mutate_fulfillment(
|
||||||
coerce_ty,
|
coerce_ty,
|
||||||
|errors| {
|
|errors| {
|
||||||
// This is not coming from a macro or a `derive`.
|
self.point_at_type_arg_instead_of_call_if_possible(errors, expr);
|
||||||
if sp.desugaring_kind().is_none()
|
self.point_at_arg_instead_of_call_if_possible(
|
||||||
&& !arg.span.from_expansion()
|
errors,
|
||||||
// Do not change the spans of `async fn`s.
|
&final_arg_types,
|
||||||
&& !matches!(
|
expr,
|
||||||
expr.kind,
|
sp,
|
||||||
hir::ExprKind::Call(
|
args,
|
||||||
hir::Expr {
|
);
|
||||||
kind: hir::ExprKind::Path(hir::QPath::LangItem(_, _)),
|
|
||||||
..
|
|
||||||
},
|
|
||||||
_
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
for error in errors {
|
|
||||||
error.obligation.cause.make_mut().span = arg.span;
|
|
||||||
let code = error.obligation.cause.code.clone();
|
|
||||||
error.obligation.cause.make_mut().code =
|
|
||||||
ObligationCauseCode::FunctionArgumentObligation {
|
|
||||||
arg_hir_id: arg.hir_id,
|
|
||||||
call_hir_id: expr.hir_id,
|
|
||||||
parent_code: Lrc::new(code),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// 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, None, AllowTwoPhase::Yes);
|
self.demand_coerce(&arg, checked_ty, coerce_ty, None, AllowTwoPhase::Yes);
|
||||||
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,
|
||||||
// if the expected type was used for the coercion.
|
// if the expected type was used for the coercion.
|
||||||
|
@ -973,45 +957,79 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ty::PredicateKind::Trait(predicate) =
|
// Peel derived obligation, because it's the type that originally
|
||||||
error.obligation.predicate.kind().skip_binder()
|
// started this inference chain that matters, not the one we wound
|
||||||
{
|
// up with at the end.
|
||||||
// Collect the argument position for all arguments that could have caused this
|
fn unpeel_to_top(
|
||||||
// `FulfillmentError`.
|
mut code: Lrc<ObligationCauseCode<'_>>,
|
||||||
let mut referenced_in = final_arg_types
|
) -> Lrc<ObligationCauseCode<'_>> {
|
||||||
.iter()
|
let mut result_code = code.clone();
|
||||||
.map(|&(i, checked_ty, _)| (i, checked_ty))
|
loop {
|
||||||
.chain(final_arg_types.iter().map(|&(i, _, coerced_ty)| (i, coerced_ty)))
|
let parent = match &*code {
|
||||||
.flat_map(|(i, ty)| {
|
ObligationCauseCode::BuiltinDerivedObligation(c)
|
||||||
let ty = self.resolve_vars_if_possible(ty);
|
| ObligationCauseCode::ImplDerivedObligation(c)
|
||||||
// We walk the argument type because the argument's type could have
|
| ObligationCauseCode::DerivedObligation(c) => c.parent_code.clone(),
|
||||||
// been `Option<T>`, but the `FulfillmentError` references `T`.
|
_ => break,
|
||||||
if ty.walk(self.tcx).any(|arg| arg == predicate.self_ty().into()) {
|
};
|
||||||
Some(i)
|
result_code = std::mem::replace(&mut code, parent);
|
||||||
} else {
|
}
|
||||||
None
|
result_code
|
||||||
}
|
}
|
||||||
})
|
let self_: ty::subst::GenericArg<'_> = match &*unpeel_to_top(Lrc::new(error.obligation.cause.code.clone())) {
|
||||||
.collect::<Vec<usize>>();
|
ObligationCauseCode::BuiltinDerivedObligation(code) |
|
||||||
|
ObligationCauseCode::ImplDerivedObligation(code) |
|
||||||
|
ObligationCauseCode::DerivedObligation(code) => {
|
||||||
|
code.parent_trait_ref.self_ty().skip_binder().into()
|
||||||
|
}
|
||||||
|
_ if let ty::PredicateKind::Trait(predicate) =
|
||||||
|
error.obligation.predicate.kind().skip_binder() => {
|
||||||
|
predicate.self_ty().into()
|
||||||
|
}
|
||||||
|
_ => continue,
|
||||||
|
};
|
||||||
|
let self_ = self.resolve_vars_if_possible(self_);
|
||||||
|
|
||||||
// Both checked and coerced types could have matched, thus we need to remove
|
// Collect the argument position for all arguments that could have caused this
|
||||||
// duplicates.
|
// `FulfillmentError`.
|
||||||
|
let mut referenced_in = final_arg_types
|
||||||
|
.iter()
|
||||||
|
.map(|&(i, checked_ty, _)| (i, checked_ty))
|
||||||
|
.chain(final_arg_types.iter().map(|&(i, _, coerced_ty)| (i, coerced_ty)))
|
||||||
|
.flat_map(|(i, ty)| {
|
||||||
|
let ty = self.resolve_vars_if_possible(ty);
|
||||||
|
// We walk the argument type because the argument's type could have
|
||||||
|
// been `Option<T>`, but the `FulfillmentError` references `T`.
|
||||||
|
if ty.walk(self.tcx).any(|arg| arg == self_) { Some(i) } else { None }
|
||||||
|
})
|
||||||
|
.collect::<Vec<usize>>();
|
||||||
|
|
||||||
// We sort primitive type usize here and can use unstable sort
|
// Both checked and coerced types could have matched, thus we need to remove
|
||||||
referenced_in.sort_unstable();
|
// duplicates.
|
||||||
referenced_in.dedup();
|
|
||||||
|
|
||||||
if let (Some(ref_in), None) = (referenced_in.pop(), referenced_in.pop()) {
|
// We sort primitive type usize here and can use unstable sort
|
||||||
// We make sure that only *one* argument matches the obligation failure
|
referenced_in.sort_unstable();
|
||||||
// and we assign the obligation's span to its expression's.
|
referenced_in.dedup();
|
||||||
error.obligation.cause.make_mut().span = args[ref_in].span;
|
|
||||||
let code = error.obligation.cause.code.clone();
|
if let (Some(ref_in), None) = (referenced_in.pop(), referenced_in.pop()) {
|
||||||
error.obligation.cause.make_mut().code =
|
// Do not point at the inside of a macro.
|
||||||
ObligationCauseCode::FunctionArgumentObligation {
|
// That would often result in poor error messages.
|
||||||
arg_hir_id: args[ref_in].hir_id,
|
if args[ref_in].span.from_expansion() {
|
||||||
call_hir_id: expr.hir_id,
|
return;
|
||||||
parent_code: Lrc::new(code),
|
}
|
||||||
};
|
// We make sure that only *one* argument matches the obligation failure
|
||||||
|
// and we assign the obligation's span to its expression's.
|
||||||
|
error.obligation.cause.make_mut().span = args[ref_in].span;
|
||||||
|
let code = error.obligation.cause.code.clone();
|
||||||
|
error.obligation.cause.make_mut().code =
|
||||||
|
ObligationCauseCode::FunctionArgumentObligation {
|
||||||
|
arg_hir_id: args[ref_in].hir_id,
|
||||||
|
call_hir_id: expr.hir_id,
|
||||||
|
parent_code: Lrc::new(code),
|
||||||
|
};
|
||||||
|
} else if error.obligation.cause.make_mut().span == call_sp {
|
||||||
|
// Make function calls point at the callee, not the whole thing.
|
||||||
|
if let hir::ExprKind::Call(callee, _) = expr.kind {
|
||||||
|
error.obligation.cause.make_mut().span = callee.span;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit eb1282ec444db94055fa9531b6f3f803e86bb382
|
Subproject commit fd9299792852c9a368cb236748781852f75cdac6
|
|
@ -1 +1 @@
|
||||||
Subproject commit 270fccd339e5972d9c900e788f197e81a0bcd956
|
Subproject commit 51739471276b1776dea27cf562b974ef07e24685
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2d66852a27c5d0ec50ae021820d1de22caa2b1bd
|
Subproject commit 358e6a61d5f4f0496d0a81e70cdcd25d05307342
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9a60624fcad0140826c44389571dc622917cd632
|
Subproject commit 27f1ff5e440ef78828b68ab882b98e1b10d9af32
|
|
@ -40,9 +40,15 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
|
||||||
LL | extern "x86-interrupt" fn x86() {}
|
LL | extern "x86-interrupt" fn x86() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: use of calling convention not supported on this target
|
error[E0570]: `"thiscall"` is not a supported ABI for the current target
|
||||||
--> $DIR/unsupported.rs:43:1
|
--> $DIR/unsupported.rs:43:1
|
||||||
|
|
|
|
||||||
|
LL | extern "thiscall" fn thiscall() {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: use of calling convention not supported on this target
|
||||||
|
--> $DIR/unsupported.rs:47:1
|
||||||
|
|
|
||||||
LL | extern "stdcall" fn stdcall() {}
|
LL | extern "stdcall" fn stdcall() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
@ -50,15 +56,6 @@ LL | extern "stdcall" fn stdcall() {}
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
||||||
|
|
||||||
warning: use of calling convention not supported on this target
|
error: aborting due to 8 previous errors; 1 warning emitted
|
||||||
--> $DIR/unsupported.rs:50:1
|
|
||||||
|
|
|
||||||
LL | extern "thiscall" fn thiscall() {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
|
||||||
|
|
||||||
error: aborting due to 7 previous errors; 2 warnings emitted
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0570`.
|
For more information about this error, try `rustc --explain E0570`.
|
||||||
|
|
|
@ -34,9 +34,15 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
|
||||||
LL | extern "x86-interrupt" fn x86() {}
|
LL | extern "x86-interrupt" fn x86() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: use of calling convention not supported on this target
|
error[E0570]: `"thiscall"` is not a supported ABI for the current target
|
||||||
--> $DIR/unsupported.rs:43:1
|
--> $DIR/unsupported.rs:43:1
|
||||||
|
|
|
|
||||||
|
LL | extern "thiscall" fn thiscall() {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: use of calling convention not supported on this target
|
||||||
|
--> $DIR/unsupported.rs:47:1
|
||||||
|
|
|
||||||
LL | extern "stdcall" fn stdcall() {}
|
LL | extern "stdcall" fn stdcall() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
@ -44,15 +50,6 @@ LL | extern "stdcall" fn stdcall() {}
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
||||||
|
|
||||||
warning: use of calling convention not supported on this target
|
error: aborting due to 7 previous errors; 1 warning emitted
|
||||||
--> $DIR/unsupported.rs:50:1
|
|
||||||
|
|
|
||||||
LL | extern "thiscall" fn thiscall() {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
|
||||||
|
|
||||||
error: aborting due to 6 previous errors; 2 warnings emitted
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0570`.
|
For more information about this error, try `rustc --explain E0570`.
|
||||||
|
|
|
@ -40,6 +40,10 @@ extern "avr-interrupt" fn avr() {}
|
||||||
extern "x86-interrupt" fn x86() {}
|
extern "x86-interrupt" fn x86() {}
|
||||||
//[aarch64]~^ ERROR is not a supported ABI
|
//[aarch64]~^ ERROR is not a supported ABI
|
||||||
//[arm]~^^ ERROR is not a supported ABI
|
//[arm]~^^ ERROR is not a supported ABI
|
||||||
|
extern "thiscall" fn thiscall() {}
|
||||||
|
//[x64]~^ ERROR is not a supported ABI
|
||||||
|
//[aarch64]~^^ ERROR is not a supported ABI
|
||||||
|
//[arm]~^^^ ERROR is not a supported ABI
|
||||||
extern "stdcall" fn stdcall() {}
|
extern "stdcall" fn stdcall() {}
|
||||||
//[x64]~^ WARN use of calling convention not supported
|
//[x64]~^ WARN use of calling convention not supported
|
||||||
//[x64]~^^ WARN this was previously accepted
|
//[x64]~^^ WARN this was previously accepted
|
||||||
|
@ -47,10 +51,3 @@ extern "stdcall" fn stdcall() {}
|
||||||
//[aarch64]~^^^^ WARN this was previously accepted
|
//[aarch64]~^^^^ WARN this was previously accepted
|
||||||
//[arm]~^^^^^ WARN use of calling convention not supported
|
//[arm]~^^^^^ WARN use of calling convention not supported
|
||||||
//[arm]~^^^^^^ WARN this was previously accepted
|
//[arm]~^^^^^^ WARN this was previously accepted
|
||||||
extern "thiscall" fn thiscall() {}
|
|
||||||
//[x64]~^ WARN use of calling convention not supported
|
|
||||||
//[x64]~^^ WARN this was previously accepted
|
|
||||||
//[aarch64]~^^^ WARN use of calling convention not supported
|
|
||||||
//[aarch64]~^^^^ WARN this was previously accepted
|
|
||||||
//[arm]~^^^^^ WARN use of calling convention not supported
|
|
||||||
//[arm]~^^^^^^ WARN this was previously accepted
|
|
||||||
|
|
|
@ -34,9 +34,15 @@ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
|
||||||
LL | extern "avr-interrupt" fn avr() {}
|
LL | extern "avr-interrupt" fn avr() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: use of calling convention not supported on this target
|
error[E0570]: `"thiscall"` is not a supported ABI for the current target
|
||||||
--> $DIR/unsupported.rs:43:1
|
--> $DIR/unsupported.rs:43:1
|
||||||
|
|
|
|
||||||
|
LL | extern "thiscall" fn thiscall() {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: use of calling convention not supported on this target
|
||||||
|
--> $DIR/unsupported.rs:47:1
|
||||||
|
|
|
||||||
LL | extern "stdcall" fn stdcall() {}
|
LL | extern "stdcall" fn stdcall() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
@ -44,15 +50,6 @@ LL | extern "stdcall" fn stdcall() {}
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
||||||
|
|
||||||
warning: use of calling convention not supported on this target
|
error: aborting due to 7 previous errors; 1 warning emitted
|
||||||
--> $DIR/unsupported.rs:50:1
|
|
||||||
|
|
|
||||||
LL | extern "thiscall" fn thiscall() {}
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
|
|
||||||
|
|
||||||
error: aborting due to 6 previous errors; 2 warnings emitted
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0570`.
|
For more information about this error, try `rustc --explain E0570`.
|
||||||
|
|
|
@ -28,11 +28,13 @@ pub fn f1_int_uint() {
|
||||||
pub fn f1_uint_uint() {
|
pub fn f1_uint_uint() {
|
||||||
f1(2u32, 4u32);
|
f1(2u32, 4u32);
|
||||||
//~^ ERROR `u32: Foo` is not satisfied
|
//~^ ERROR `u32: Foo` is not satisfied
|
||||||
|
//~| ERROR `u32: Foo` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f1_uint_int() {
|
pub fn f1_uint_int() {
|
||||||
f1(2u32, 4i32);
|
f1(2u32, 4i32);
|
||||||
//~^ ERROR `u32: Foo` is not satisfied
|
//~^ ERROR `u32: Foo` is not satisfied
|
||||||
|
//~| ERROR `u32: Foo` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn f2_int() {
|
pub fn f2_int() {
|
||||||
|
|
|
@ -9,11 +9,29 @@ help: change the type of the numeric literal from `i32` to `u32`
|
||||||
LL | f1(2i32, 4u32);
|
LL | f1(2i32, 4u32);
|
||||||
| ~~~
|
| ~~~
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||||
|
--> $DIR/associated-types-path-2.rs:29:5
|
||||||
|
|
|
||||||
|
LL | f1(2u32, 4u32);
|
||||||
|
| ^^ the trait `Foo` is not implemented for `u32`
|
||||||
|
|
|
||||||
|
note: required by a bound in `f1`
|
||||||
|
--> $DIR/associated-types-path-2.rs:13:14
|
||||||
|
|
|
||||||
|
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||||
|
| ^^^ required by this bound in `f1`
|
||||||
|
|
||||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||||
--> $DIR/associated-types-path-2.rs:29:14
|
--> $DIR/associated-types-path-2.rs:29:14
|
||||||
|
|
|
|
||||||
LL | f1(2u32, 4u32);
|
LL | f1(2u32, 4u32);
|
||||||
| -- ^^^^ the trait `Foo` is not implemented for `u32`
|
| ^^^^ the trait `Foo` is not implemented for `u32`
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||||
|
--> $DIR/associated-types-path-2.rs:35:8
|
||||||
|
|
|
||||||
|
LL | f1(2u32, 4i32);
|
||||||
|
| -- ^^^^ the trait `Foo` is not implemented for `u32`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
|
@ -24,21 +42,13 @@ LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||||
| ^^^ required by this bound in `f1`
|
| ^^^ required by this bound in `f1`
|
||||||
|
|
||||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||||
--> $DIR/associated-types-path-2.rs:34:14
|
--> $DIR/associated-types-path-2.rs:35:14
|
||||||
|
|
|
|
||||||
LL | f1(2u32, 4i32);
|
LL | f1(2u32, 4i32);
|
||||||
| -- ^^^^ the trait `Foo` is not implemented for `u32`
|
| ^^^^ the trait `Foo` is not implemented for `u32`
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `f1`
|
|
||||||
--> $DIR/associated-types-path-2.rs:13:14
|
|
||||||
|
|
|
||||||
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
|
||||||
| ^^^ required by this bound in `f1`
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/associated-types-path-2.rs:39:18
|
--> $DIR/associated-types-path-2.rs:41:18
|
||||||
|
|
|
|
||||||
LL | let _: i32 = f2(2i32);
|
LL | let _: i32 = f2(2i32);
|
||||||
| --- ^^^^^^^^ expected `i32`, found `u32`
|
| --- ^^^^^^^^ expected `i32`, found `u32`
|
||||||
|
@ -50,7 +60,7 @@ help: you can convert a `u32` to an `i32` and panic if the converted value doesn
|
||||||
LL | let _: i32 = f2(2i32).try_into().unwrap();
|
LL | let _: i32 = f2(2i32).try_into().unwrap();
|
||||||
| ++++++++++++++++++++
|
| ++++++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0308.
|
Some errors have detailed explanations: E0277, E0308.
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: future cannot be sent between threads safely
|
error: future cannot be sent between threads safely
|
||||||
--> $DIR/async-fn-nonsend.rs:49:5
|
--> $DIR/async-fn-nonsend.rs:49:17
|
||||||
|
|
|
|
||||||
LL | assert_send(local_dropped_before_await());
|
LL | assert_send(local_dropped_before_await());
|
||||||
| ^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`
|
= help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`
|
||||||
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
|
||||||
|
@ -22,10 +22,10 @@ LL | fn assert_send(_: impl Send) {}
|
||||||
| ^^^^ required by this bound in `assert_send`
|
| ^^^^ required by this bound in `assert_send`
|
||||||
|
|
||||||
error: future cannot be sent between threads safely
|
error: future cannot be sent between threads safely
|
||||||
--> $DIR/async-fn-nonsend.rs:51:5
|
--> $DIR/async-fn-nonsend.rs:51:17
|
||||||
|
|
|
|
||||||
LL | assert_send(non_send_temporary_in_match());
|
LL | assert_send(non_send_temporary_in_match());
|
||||||
| ^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`
|
= help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`
|
||||||
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
|
||||||
|
@ -45,10 +45,10 @@ LL | fn assert_send(_: impl Send) {}
|
||||||
| ^^^^ required by this bound in `assert_send`
|
| ^^^^ required by this bound in `assert_send`
|
||||||
|
|
||||||
error: future cannot be sent between threads safely
|
error: future cannot be sent between threads safely
|
||||||
--> $DIR/async-fn-nonsend.rs:53:5
|
--> $DIR/async-fn-nonsend.rs:53:17
|
||||||
|
|
|
|
||||||
LL | assert_send(non_sync_with_method_call());
|
LL | assert_send(non_sync_with_method_call());
|
||||||
| ^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
||||||
|
|
|
|
||||||
= help: the trait `Send` is not implemented for `dyn std::fmt::Write`
|
= help: the trait `Send` is not implemented for `dyn std::fmt::Write`
|
||||||
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
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: future cannot be shared between threads safely
|
error: future cannot be shared between threads safely
|
||||||
--> $DIR/issue-64130-1-sync.rs:21:5
|
--> $DIR/issue-64130-1-sync.rs:21:13
|
||||||
|
|
|
|
||||||
LL | is_sync(bar());
|
LL | is_sync(bar());
|
||||||
| ^^^^^^^ future returned by `bar` is not `Sync`
|
| ^^^^^ future returned by `bar` is not `Sync`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Sync` is not implemented for `Foo`
|
= help: within `impl Future`, the trait `Sync` is not implemented for `Foo`
|
||||||
note: future is not `Sync` as this value is used across an await
|
note: future is not `Sync` as this value is used across an await
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: future cannot be sent between threads safely
|
error: future cannot be sent between threads safely
|
||||||
--> $DIR/issue-64130-2-send.rs:21:5
|
--> $DIR/issue-64130-2-send.rs:21:13
|
||||||
|
|
|
|
||||||
LL | is_send(bar());
|
LL | is_send(bar());
|
||||||
| ^^^^^^^ future returned by `bar` is not `Send`
|
| ^^^^^ future returned by `bar` is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Send` is not implemented for `Foo`
|
= help: within `impl Future`, the trait `Send` is not implemented for `Foo`
|
||||||
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
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future`
|
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future`
|
||||||
--> $DIR/issue-64130-3-other.rs:24:5
|
--> $DIR/issue-64130-3-other.rs:24:12
|
||||||
|
|
|
|
||||||
LL | async fn bar() {
|
LL | async fn bar() {
|
||||||
| - within this `impl Future`
|
| - within this `impl Future`
|
||||||
...
|
...
|
||||||
LL | is_qux(bar());
|
LL | is_qux(bar());
|
||||||
| ^^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo`
|
| ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo`
|
||||||
|
|
|
|
||||||
note: future does not implement `Qux` as this value is used across an await
|
note: future does not implement `Qux` as this value is used across an await
|
||||||
--> $DIR/issue-64130-3-other.rs:18:5
|
--> $DIR/issue-64130-3-other.rs:18:5
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: future cannot be sent between threads safely
|
error: future cannot be sent between threads safely
|
||||||
--> $DIR/issue-64130-non-send-future-diags.rs:21:5
|
--> $DIR/issue-64130-non-send-future-diags.rs:21:13
|
||||||
|
|
|
|
||||||
LL | is_send(foo());
|
LL | is_send(foo());
|
||||||
| ^^^^^^^ future returned by `foo` is not `Send`
|
| ^^^^^ future returned by `foo` is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
|
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
|
||||||
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
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: future cannot be sent between threads safely
|
error: future cannot be sent between threads safely
|
||||||
--> $DIR/issue-71137.rs:20:3
|
--> $DIR/issue-71137.rs:20:14
|
||||||
|
|
|
|
||||||
LL | fake_spawn(wrong_mutex());
|
LL | fake_spawn(wrong_mutex());
|
||||||
| ^^^^^^^^^^ future returned by `wrong_mutex` is not `Send`
|
| ^^^^^^^^^^^^^ future returned by `wrong_mutex` is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
|
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
|
||||||
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
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error: generator cannot be sent between threads safely
|
error: generator cannot be sent between threads safely
|
||||||
--> $DIR/issue-67893.rs:9:5
|
--> $DIR/issue-67893.rs:9:7
|
||||||
|
|
|
|
||||||
LL | g(issue_67893::run())
|
LL | g(issue_67893::run())
|
||||||
| ^ generator is not `Send`
|
| ^^^^^^^^^^^^^^^^^^ generator is not `Send`
|
||||||
|
|
|
|
||||||
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
|
= help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
|
||||||
note: required by a bound in `g`
|
note: required by a bound in `g`
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: `PhantomPinned` cannot be unpinned
|
error[E0277]: `PhantomPinned` cannot be unpinned
|
||||||
--> $DIR/pin-needed-to-poll-2.rs:43:9
|
--> $DIR/pin-needed-to-poll-2.rs:43:18
|
||||||
|
|
|
|
||||||
LL | Pin::new(&mut self.sleep).poll(cx)
|
LL | Pin::new(&mut self.sleep).poll(cx)
|
||||||
| ^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned`
|
| -------- ^^^^^^^^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: consider using `Box::pin`
|
= note: consider using `Box::pin`
|
||||||
note: required because it appears within the type `Sleep`
|
note: required because it appears within the type `Sleep`
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied
|
error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied
|
||||||
--> $DIR/issue-85848.rs:24:5
|
--> $DIR/issue-85848.rs:24:29
|
||||||
|
|
|
|
||||||
LL | writes_to_specific_path(&cap);
|
LL | writes_to_specific_path(&cap);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `_Contains<&C>` is not implemented for `()`
|
| ----------------------- ^^^^ the trait `_Contains<&C>` is not implemented for `()`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
|
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
|
||||||
--> $DIR/issue-85848.rs:21:12
|
--> $DIR/issue-85848.rs:21:12
|
||||||
|
@ -21,10 +23,12 @@ LL | fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {}
|
||||||
| ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path`
|
| ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path`
|
||||||
|
|
||||||
error: unconstrained generic constant
|
error: unconstrained generic constant
|
||||||
--> $DIR/issue-85848.rs:24:5
|
--> $DIR/issue-85848.rs:24:29
|
||||||
|
|
|
|
||||||
LL | writes_to_specific_path(&cap);
|
LL | writes_to_specific_path(&cap);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ----------------------- ^^^^
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: try adding a `where` bound using this expression: `where [(); { contains::<T, U>() }]:`
|
= help: try adding a `where` bound using this expression: `where [(); { contains::<T, U>() }]:`
|
||||||
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
|
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
|
||||||
|
|
|
@ -37,8 +37,8 @@ trait Ty<'a> {
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = Unit2.m(
|
let v = Unit2.m(
|
||||||
//~^ ERROR type mismatch
|
//~^ ERROR type mismatch
|
||||||
//~| ERROR type mismatch
|
|
||||||
L {
|
L {
|
||||||
|
//~^ ERROR type mismatch
|
||||||
f : |x| { drop(x); Unit4 }
|
f : |x| { drop(x); Unit4 }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,16 @@ LL | let v = Unit2.m(
|
||||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as FnOnce<((&'r u8,),)>>::Output == Unit3`
|
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as FnOnce<((&'r u8,),)>>::Output == Unit3`
|
||||||
--> $DIR/issue-62203-hrtb-ice.rs:38:19
|
--> $DIR/issue-62203-hrtb-ice.rs:40:9
|
||||||
|
|
|
|
||||||
LL | let v = Unit2.m(
|
LL | let v = Unit2.m(
|
||||||
| ^ expected struct `Unit4`, found struct `Unit3`
|
| - required by a bound introduced by this call
|
||||||
|
LL |
|
||||||
|
LL | / L {
|
||||||
|
LL | |
|
||||||
|
LL | | f : |x| { drop(x); Unit4 }
|
||||||
|
LL | | });
|
||||||
|
| |_________^ expected struct `Unit4`, found struct `Unit3`
|
||||||
|
|
|
|
||||||
note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>`
|
note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>`
|
||||||
--> $DIR/issue-62203-hrtb-ice.rs:17:16
|
--> $DIR/issue-62203-hrtb-ice.rs:17:16
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
|
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
|
||||||
--> $DIR/auto-trait-leak2.rs:13:5
|
--> $DIR/auto-trait-leak2.rs:13:10
|
||||||
|
|
|
|
||||||
LL | fn before() -> impl Fn(i32) {
|
LL | fn before() -> impl Fn(i32) {
|
||||||
| ------------ within this `impl Fn<(i32,)>`
|
| ------------ within this `impl Fn<(i32,)>`
|
||||||
...
|
...
|
||||||
LL | send(before());
|
LL | send(before());
|
||||||
| ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
| ---- ^^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
|
= help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
|
||||||
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]`
|
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]`
|
||||||
|
@ -17,10 +19,12 @@ LL | fn send<T: Send>(_: T) {}
|
||||||
| ^^^^ required by this bound in `send`
|
| ^^^^ required by this bound in `send`
|
||||||
|
|
||||||
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
|
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
|
||||||
--> $DIR/auto-trait-leak2.rs:16:5
|
--> $DIR/auto-trait-leak2.rs:16:10
|
||||||
|
|
|
|
||||||
LL | send(after());
|
LL | send(after());
|
||||||
| ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
| ---- ^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
...
|
...
|
||||||
LL | fn after() -> impl Fn(i32) {
|
LL | fn after() -> impl Fn(i32) {
|
||||||
| ------------ within this `impl Fn<(i32,)>`
|
| ------------ within this `impl Fn<(i32,)>`
|
||||||
|
|
|
@ -7,6 +7,7 @@ const fn not_fn_items() {
|
||||||
//~^ ERROR expected a `FnOnce<()>` closure
|
//~^ ERROR expected a `FnOnce<()>` closure
|
||||||
const_eval_select((), 42, 0xDEADBEEF);
|
const_eval_select((), 42, 0xDEADBEEF);
|
||||||
//~^ ERROR expected a `FnOnce<()>` closure
|
//~^ ERROR expected a `FnOnce<()>` closure
|
||||||
|
//~| ERROR expected a `FnOnce<()>` closure
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn foo(n: i32) -> i32 {
|
const fn foo(n: i32) -> i32 {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error[E0277]: expected a `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`
|
error[E0277]: expected a `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`
|
||||||
--> $DIR/const-eval-select-bad.rs:6:34
|
--> $DIR/const-eval-select-bad.rs:6:27
|
||||||
|
|
|
|
||||||
LL | const_eval_select((), || {}, || {});
|
LL | const_eval_select((), || {}, || {});
|
||||||
| ----------------- ^^^^^ expected an `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`
|
| ----------------- ^^^^^ expected an `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
|
@ -14,6 +14,22 @@ note: required by a bound in `const_eval_select`
|
||||||
LL | F: ~const FnOnce<ARG, Output = RET>,
|
LL | F: ~const FnOnce<ARG, Output = RET>,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
||||||
|
|
||||||
|
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
|
||||||
|
--> $DIR/const-eval-select-bad.rs:8:27
|
||||||
|
|
|
||||||
|
LL | const_eval_select((), 42, 0xDEADBEEF);
|
||||||
|
| ----------------- ^^ expected an `FnOnce<()>` closure, found `{integer}`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the trait `FnOnce<()>` is not implemented for `{integer}`
|
||||||
|
= note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
|
note: required by a bound in `const_eval_select`
|
||||||
|
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | F: ~const FnOnce<ARG, Output = RET>,
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
||||||
|
|
||||||
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
|
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
|
||||||
--> $DIR/const-eval-select-bad.rs:8:31
|
--> $DIR/const-eval-select-bad.rs:8:31
|
||||||
|
|
|
|
||||||
|
@ -27,11 +43,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
|
||||||
note: required by a bound in `const_eval_select`
|
note: required by a bound in `const_eval_select`
|
||||||
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
|
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | F: ~const FnOnce<ARG, Output = RET>,
|
LL | G: FnOnce<ARG, Output = RET> + ~const Drop,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<fn(i32) -> bool {bar} as FnOnce<(i32,)>>::Output == i32`
|
error[E0271]: type mismatch resolving `<fn(i32) -> bool {bar} as FnOnce<(i32,)>>::Output == i32`
|
||||||
--> $DIR/const-eval-select-bad.rs:27:5
|
--> $DIR/const-eval-select-bad.rs:28:5
|
||||||
|
|
|
|
||||||
LL | const_eval_select((1,), foo, bar);
|
LL | const_eval_select((1,), foo, bar);
|
||||||
| ^^^^^^^^^^^^^^^^^ expected `i32`, found `bool`
|
| ^^^^^^^^^^^^^^^^^ expected `i32`, found `bool`
|
||||||
|
@ -43,13 +59,13 @@ LL | G: FnOnce<ARG, Output = RET> + ~const Drop,
|
||||||
| ^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
| ^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
||||||
|
|
||||||
error[E0631]: type mismatch in function arguments
|
error[E0631]: type mismatch in function arguments
|
||||||
--> $DIR/const-eval-select-bad.rs:32:37
|
--> $DIR/const-eval-select-bad.rs:33:32
|
||||||
|
|
|
|
||||||
LL | const fn foo(n: i32) -> i32 {
|
LL | const fn foo(n: i32) -> i32 {
|
||||||
| --------------------------- found signature of `fn(i32) -> _`
|
| --------------------------- found signature of `fn(i32) -> _`
|
||||||
...
|
...
|
||||||
LL | const_eval_select((true,), foo, baz);
|
LL | const_eval_select((true,), foo, baz);
|
||||||
| ----------------- ^^^ expected signature of `fn(bool) -> _`
|
| ----------------- ^^^ expected signature of `fn(bool) -> _`
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
|
@ -59,7 +75,7 @@ note: required by a bound in `const_eval_select`
|
||||||
LL | F: ~const FnOnce<ARG, Output = RET>,
|
LL | F: ~const FnOnce<ARG, Output = RET>,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277, E0631.
|
Some errors have detailed explanations: E0271, E0277, E0631.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
For more information about an error, try `rustc --explain E0271`.
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: `Rc<Foo>` cannot be shared between threads safely
|
error[E0277]: `Rc<Foo>` cannot be shared between threads safely
|
||||||
--> $DIR/issue-40827.rs:14:5
|
--> $DIR/issue-40827.rs:14:7
|
||||||
|
|
|
|
||||||
LL | f(Foo(Arc::new(Bar::B(None))));
|
LL | f(Foo(Arc::new(Bar::B(None))));
|
||||||
| ^ `Rc<Foo>` cannot be shared between threads safely
|
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be shared between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>`
|
= help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>`
|
||||||
note: required because it appears within the type `Bar`
|
note: required because it appears within the type `Bar`
|
||||||
|
@ -23,10 +25,12 @@ LL | fn f<T: Send>(_: T) {}
|
||||||
| ^^^^ required by this bound in `f`
|
| ^^^^ required by this bound in `f`
|
||||||
|
|
||||||
error[E0277]: `Rc<Foo>` cannot be sent between threads safely
|
error[E0277]: `Rc<Foo>` cannot be sent between threads safely
|
||||||
--> $DIR/issue-40827.rs:14:5
|
--> $DIR/issue-40827.rs:14:7
|
||||||
|
|
|
|
||||||
LL | f(Foo(Arc::new(Bar::B(None))));
|
LL | f(Foo(Arc::new(Bar::B(None))));
|
||||||
| ^ `Rc<Foo>` cannot be sent between threads safely
|
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be sent between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>`
|
= help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>`
|
||||||
note: required because it appears within the type `Bar`
|
note: required because it appears within the type `Bar`
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: `NoSync` cannot be shared between threads safely
|
error[E0277]: `NoSync` cannot be shared between threads safely
|
||||||
--> $DIR/mutable-enum-indirect.rs:17:5
|
--> $DIR/mutable-enum-indirect.rs:17:9
|
||||||
|
|
|
|
||||||
LL | bar(&x);
|
LL | bar(&x);
|
||||||
| ^^^ `NoSync` cannot be shared between threads safely
|
| --- ^^ `NoSync` cannot be shared between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `&Foo`, the trait `Sync` is not implemented for `NoSync`
|
= help: within `&Foo`, the trait `Sync` is not implemented for `NoSync`
|
||||||
note: required because it appears within the type `Foo`
|
note: required because it appears within the type `Foo`
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: `NoSend` cannot be sent between threads safely
|
error[E0277]: `NoSend` cannot be sent between threads safely
|
||||||
--> $DIR/no_send-enum.rs:16:5
|
--> $DIR/no_send-enum.rs:16:9
|
||||||
|
|
|
|
||||||
LL | bar(x);
|
LL | bar(x);
|
||||||
| ^^^ `NoSend` cannot be sent between threads safely
|
| --- ^ `NoSend` cannot be sent between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `Foo`, the trait `Send` is not implemented for `NoSend`
|
= help: within `Foo`, the trait `Send` is not implemented for `NoSend`
|
||||||
note: required because it appears within the type `Foo`
|
note: required because it appears within the type `Foo`
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: `NoSync` cannot be shared between threads safely
|
error[E0277]: `NoSync` cannot be shared between threads safely
|
||||||
--> $DIR/no_share-enum.rs:14:5
|
--> $DIR/no_share-enum.rs:14:9
|
||||||
|
|
|
|
||||||
LL | bar(x);
|
LL | bar(x);
|
||||||
| ^^^ `NoSync` cannot be shared between threads safely
|
| --- ^ `NoSync` cannot be shared between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `Foo`, the trait `Sync` is not implemented for `NoSync`
|
= help: within `Foo`, the trait `Sync` is not implemented for `NoSync`
|
||||||
note: required because it appears within the type `Foo`
|
note: required because it appears within the type `Foo`
|
||||||
|
|
|
@ -51,9 +51,6 @@ LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||||
error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
|
error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
|
||||||
--> $DIR/const-drop-fail.rs:49:5
|
--> $DIR/const-drop-fail.rs:49:5
|
||||||
|
|
|
|
||||||
LL | const _: () = check($exp);
|
|
||||||
| ----- required by a bound introduced by this call
|
|
||||||
...
|
|
||||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
|
||||||
|
|
|
|
||||||
|
|
|
@ -51,9 +51,6 @@ LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||||
error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
|
error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
|
||||||
--> $DIR/const-drop-fail.rs:49:5
|
--> $DIR/const-drop-fail.rs:49:5
|
||||||
|
|
|
|
||||||
LL | const _: () = check($exp);
|
|
||||||
| ----- required by a bound introduced by this call
|
|
||||||
...
|
|
||||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
|
||||||
|
|
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
error[E0277]: the trait bound `&str: From<String>` is not satisfied
|
error[E0277]: the trait bound `&str: From<String>` is not satisfied
|
||||||
--> $DIR/into-str.rs:4:5
|
--> $DIR/into-str.rs:4:9
|
||||||
|
|
|
|
||||||
LL | foo(String::new());
|
LL | foo(String::new());
|
||||||
| ^^^ the trait `From<String>` is not implemented for `&str`
|
| --- ^^^^^^^^^^^^^ the trait `From<String>` is not implemented for `&str`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: to coerce a `String` into a `&str`, use `&*` as a prefix
|
= note: to coerce a `String` into a `&str`, use `&*` as a prefix
|
||||||
= note: required because of the requirements on the impl of `Into<&str>` for `String`
|
= note: required because of the requirements on the impl of `Into<&str>` for `String`
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | #[derive(Clone)]
|
||||||
| ----- in this derive macro expansion
|
| ----- in this derive macro expansion
|
||||||
LL | struct FooHolster {
|
LL | struct FooHolster {
|
||||||
LL | the_foos: Vec<Foo>,
|
LL | the_foos: Vec<Foo>,
|
||||||
| ^^^^^^^^^^^^^^^^^^ expected an implementor of trait `Clone`
|
| ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo`
|
||||||
|
|
|
|
||||||
= note: required because of the requirements on the impl of `Clone` for `Vec<Foo>`
|
= note: required because of the requirements on the impl of `Clone` for `Vec<Foo>`
|
||||||
note: required by `clone`
|
note: required by `clone`
|
||||||
|
|
|
@ -49,7 +49,7 @@ LL | is_send((8, TestType));
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the trait `Send` is not implemented for `dummy1c::TestType`
|
= help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType`
|
||||||
= note: required because it appears within the type `({integer}, dummy1c::TestType)`
|
= note: required because it appears within the type `({integer}, dummy1c::TestType)`
|
||||||
note: required by a bound in `is_send`
|
note: required by a bound in `is_send`
|
||||||
--> $DIR/negated-auto-traits-error.rs:16:15
|
--> $DIR/negated-auto-traits-error.rs:16:15
|
||||||
|
@ -86,7 +86,7 @@ LL | is_send(Box::new(Outer2(TestType)));
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the trait `Send` is not implemented for `dummy3::TestType`
|
= help: within `Outer2<dummy3::TestType>`, the trait `Send` is not implemented for `dummy3::TestType`
|
||||||
note: required because it appears within the type `Outer2<dummy3::TestType>`
|
note: required because it appears within the type `Outer2<dummy3::TestType>`
|
||||||
--> $DIR/negated-auto-traits-error.rs:12:8
|
--> $DIR/negated-auto-traits-error.rs:12:8
|
||||||
|
|
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
error[E0277]: `Rc<u32>` cannot be sent between threads safely
|
error[E0277]: `Rc<u32>` cannot be sent between threads safely
|
||||||
--> $DIR/auto-trait-leakage2.rs:17:5
|
--> $DIR/auto-trait-leakage2.rs:17:13
|
||||||
|
|
|
|
||||||
LL | type Foo = impl std::fmt::Debug;
|
LL | type Foo = impl std::fmt::Debug;
|
||||||
| -------------------- within this `impl Debug`
|
| -------------------- within this `impl Debug`
|
||||||
...
|
...
|
||||||
LL | is_send(m::foo());
|
LL | is_send(m::foo());
|
||||||
| ^^^^^^^ `Rc<u32>` cannot be sent between threads safely
|
| ------- ^^^^^^^^ `Rc<u32>` cannot be sent between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `impl Debug`, the trait `Send` is not implemented for `Rc<u32>`
|
= help: within `impl Debug`, the trait `Send` is not implemented for `Rc<u32>`
|
||||||
= note: required because it appears within the type `impl Debug`
|
= note: required because it appears within the type `impl Debug`
|
||||||
|
|
8
src/test/ui/typeck/issue-90101.rs
Normal file
8
src/test/ui/typeck/issue-90101.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
fn func(path: impl Into<PathBuf>, code: impl Into<String>) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
func(Path::new("hello").to_path_buf().to_string_lossy(), "world")
|
||||||
|
//~^ ERROR [E0277]
|
||||||
|
}
|
24
src/test/ui/typeck/issue-90101.stderr
Normal file
24
src/test/ui/typeck/issue-90101.stderr
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
error[E0277]: the trait bound `PathBuf: From<Cow<'_, str>>` is not satisfied
|
||||||
|
--> $DIR/issue-90101.rs:6:10
|
||||||
|
|
|
||||||
|
LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world")
|
||||||
|
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<Cow<'_, str>>` is not implemented for `PathBuf`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the following implementations were found:
|
||||||
|
<PathBuf as From<&T>>
|
||||||
|
<PathBuf as From<Box<Path>>>
|
||||||
|
<PathBuf as From<Cow<'a, Path>>>
|
||||||
|
<PathBuf as From<OsString>>
|
||||||
|
<PathBuf as From<String>>
|
||||||
|
= note: required because of the requirements on the impl of `Into<PathBuf>` for `Cow<'_, str>`
|
||||||
|
note: required by a bound in `func`
|
||||||
|
--> $DIR/issue-90101.rs:3:20
|
||||||
|
|
|
||||||
|
LL | fn func(path: impl Into<PathBuf>, code: impl Into<String>) {}
|
||||||
|
| ^^^^^^^^^^^^^ required by this bound in `func`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
|
@ -29,10 +29,12 @@ LL | fn test<T: Sync>(s: T) {}
|
||||||
| ^^^^ required by this bound in `test`
|
| ^^^^ required by this bound in `test`
|
||||||
|
|
||||||
error[E0277]: `UnsafeCell<NoSync>` cannot be shared between threads safely
|
error[E0277]: `UnsafeCell<NoSync>` cannot be shared between threads safely
|
||||||
--> $DIR/typeck-unsafe-always-share.rs:27:5
|
--> $DIR/typeck-unsafe-always-share.rs:27:10
|
||||||
|
|
|
|
||||||
LL | test(ms);
|
LL | test(ms);
|
||||||
| ^^^^ `UnsafeCell<NoSync>` cannot be shared between threads safely
|
| ---- ^^ `UnsafeCell<NoSync>` cannot be shared between threads safely
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: within `MySync<NoSync>`, the trait `Sync` is not implemented for `UnsafeCell<NoSync>`
|
= help: within `MySync<NoSync>`, the trait `Sync` is not implemented for `UnsafeCell<NoSync>`
|
||||||
note: required because it appears within the type `MySync<NoSync>`
|
note: required because it appears within the type `MySync<NoSync>`
|
||||||
|
|
|
@ -16,7 +16,7 @@ LL | udrop::<A<[u8]>>(A { 0: *foo() });
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the trait `Sized` is not implemented for `[u8]`
|
= help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]`
|
||||||
note: required because it appears within the type `A<[u8]>`
|
note: required because it appears within the type `A<[u8]>`
|
||||||
--> $DIR/unsized-exprs.rs:3:8
|
--> $DIR/unsized-exprs.rs:3:8
|
||||||
|
|
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7fbbf4e8f23e3c24b8afff541dcb17e53eb5ff88
|
Subproject commit 6c1bc24b8b49d4bc965f67d7037906dc199c72b7
|
Loading…
Add table
Reference in a new issue