mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
Auto merge of #121859 - matthiaskrgr:rollup-i724wpm, r=matthiaskrgr
Rollup of 12 pull requests Successful merges: - #120646 (Fix incorrect suggestion for uninitialized binding in pattern) - #121416 (Improve error messages for generics with default parameters) - #121475 (Add tidy check for .stderr/.stdout files for non-existent test revisions) - #121580 (make unused_imports less assertive in test modules) - #121736 (Remove `Mutex::unlock` Function) - #121784 (Make the success arms of `if lhs || rhs` meet up in a separate block) - #121818 (CFI: Remove unused `typeid_for_fnsig`) - #121819 (Handle stashing of delayed bugs) - #121828 (Remove unused fluent messages) - #121831 (Fix typo in comment) - #121850 (Make `ZeroablePrimitive` trait unsafe.) - #121853 (normalizes-to: handle negative impls) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
2dceda4f32
@ -613,7 +613,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
if self.sugg_span.is_some() {
|
||||
return;
|
||||
}
|
||||
if let hir::StmtKind::Local(hir::Local { span, ty, init: None, .. }) = &ex.kind
|
||||
|
||||
// FIXME: We make sure that this is a normal top-level binding,
|
||||
// but we could suggest `todo!()` for all uninitalized bindings in the pattern pattern
|
||||
if let hir::StmtKind::Local(hir::Local { span, ty, init: None, pat, .. }) =
|
||||
&ex.kind
|
||||
&& let hir::PatKind::Binding(..) = pat.kind
|
||||
&& span.contains(self.decl_span)
|
||||
{
|
||||
self.sugg_span = ty.map_or(Some(self.decl_span), |ty| Some(ty.span));
|
||||
|
@ -221,12 +221,6 @@ builtin_macros_requires_cfg_pattern =
|
||||
macro requires a cfg-pattern as an argument
|
||||
.label = cfg-pattern required
|
||||
|
||||
builtin_macros_should_panic = functions using `#[should_panic]` must return `()`
|
||||
|
||||
builtin_macros_test_arg_non_lifetime = functions used as tests can not have any non-lifetime generic parameters
|
||||
|
||||
builtin_macros_test_args = functions used as tests can not have any arguments
|
||||
|
||||
builtin_macros_test_bad_fn = {$kind} functions cannot be used for tests
|
||||
.label = `{$kind}` because of this
|
||||
|
||||
|
@ -712,6 +712,7 @@ impl DiagCtxt {
|
||||
/// Stashes a diagnostic for possible later improvement in a different,
|
||||
/// later stage of the compiler. Possible actions depend on the diagnostic
|
||||
/// level:
|
||||
/// - Level::Bug, Level:Fatal: not allowed, will trigger a panic.
|
||||
/// - Level::Error: immediately counted as an error that has occurred, because it
|
||||
/// is guaranteed to be emitted eventually. Can be later accessed with the
|
||||
/// provided `span` and `key` through
|
||||
@ -719,26 +720,39 @@ impl DiagCtxt {
|
||||
/// [`DiagCtxt::try_steal_replace_and_emit_err`]. These do not allow
|
||||
/// cancellation or downgrading of the error. Returns
|
||||
/// `Some(ErrorGuaranteed)`.
|
||||
/// - Level::DelayedBug: this does happen occasionally with errors that are
|
||||
/// downgraded to delayed bugs. It is not stashed, but immediately
|
||||
/// emitted as a delayed bug. This is because stashing it would cause it
|
||||
/// to be counted by `err_count` which we don't want. It doesn't matter
|
||||
/// that we cannot steal and improve it later, because it's not a
|
||||
/// user-facing error. Returns `Some(ErrorGuaranteed)` as is normal for
|
||||
/// delayed bugs.
|
||||
/// - Level::Warning and lower (i.e. !is_error()): can be accessed with the
|
||||
/// provided `span` and `key` through [`DiagCtxt::steal_non_err()`]. This
|
||||
/// allows cancelling and downgrading of the diagnostic. Returns `None`.
|
||||
/// - Others: not allowed, will trigger a panic.
|
||||
pub fn stash_diagnostic(
|
||||
&self,
|
||||
span: Span,
|
||||
key: StashKey,
|
||||
diag: DiagInner,
|
||||
) -> Option<ErrorGuaranteed> {
|
||||
let guar = if diag.level() == Level::Error {
|
||||
// This `unchecked_error_guaranteed` is valid. It is where the
|
||||
// `ErrorGuaranteed` for stashed errors originates. See
|
||||
// `DiagCtxtInner::drop`.
|
||||
#[allow(deprecated)]
|
||||
Some(ErrorGuaranteed::unchecked_error_guaranteed())
|
||||
} else if !diag.is_error() {
|
||||
None
|
||||
} else {
|
||||
self.span_bug(span, format!("invalid level in `stash_diagnostic`: {}", diag.level));
|
||||
let guar = match diag.level {
|
||||
Bug | Fatal => {
|
||||
self.span_bug(
|
||||
span,
|
||||
format!("invalid level in `stash_diagnostic`: {:?}", diag.level),
|
||||
);
|
||||
}
|
||||
Error => {
|
||||
// This `unchecked_error_guaranteed` is valid. It is where the
|
||||
// `ErrorGuaranteed` for stashed errors originates. See
|
||||
// `DiagCtxtInner::drop`.
|
||||
#[allow(deprecated)]
|
||||
Some(ErrorGuaranteed::unchecked_error_guaranteed())
|
||||
}
|
||||
DelayedBug => return self.inner.borrow_mut().emit_diagnostic(diag),
|
||||
ForceWarning(_) | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow
|
||||
| Expect(_) => None,
|
||||
};
|
||||
|
||||
// FIXME(Centril, #69537): Consider reintroducing panic on overwriting a stashed diagnostic
|
||||
@ -780,11 +794,11 @@ impl DiagCtxt {
|
||||
let err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key);
|
||||
err.map(|(err, guar)| {
|
||||
// The use of `::<ErrorGuaranteed>` is safe because level is `Level::Error`.
|
||||
assert_eq!(err.level, Level::Error);
|
||||
assert_eq!(err.level, Error);
|
||||
assert!(guar.is_some());
|
||||
let mut err = Diag::<ErrorGuaranteed>::new_diagnostic(self, err);
|
||||
modify_err(&mut err);
|
||||
assert_eq!(err.level, Level::Error);
|
||||
assert_eq!(err.level, Error);
|
||||
err.emit()
|
||||
})
|
||||
}
|
||||
@ -803,7 +817,7 @@ impl DiagCtxt {
|
||||
let old_err = self.inner.borrow_mut().stashed_diagnostics.swap_remove(&key);
|
||||
match old_err {
|
||||
Some((old_err, guar)) => {
|
||||
assert_eq!(old_err.level, Level::Error);
|
||||
assert_eq!(old_err.level, Error);
|
||||
assert!(guar.is_some());
|
||||
// Because `old_err` has already been counted, it can only be
|
||||
// safely cancelled because the `new_err` supplants it.
|
||||
@ -1367,7 +1381,7 @@ impl DiagCtxtInner {
|
||||
}
|
||||
|
||||
if diagnostic.has_future_breakage() {
|
||||
// Future breakages aren't emitted if they're Level::Allow,
|
||||
// Future breakages aren't emitted if they're `Level::Allow`,
|
||||
// but they still need to be constructed and stashed below,
|
||||
// so they'll trigger the must_produce_diag check.
|
||||
self.suppressed_expected_diag = true;
|
||||
@ -1453,7 +1467,7 @@ impl DiagCtxtInner {
|
||||
diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {});
|
||||
if already_emitted {
|
||||
let msg = "duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`";
|
||||
diagnostic.sub(Level::Note, msg, MultiSpan::new());
|
||||
diagnostic.sub(Note, msg, MultiSpan::new());
|
||||
}
|
||||
|
||||
if is_error {
|
||||
@ -1623,7 +1637,7 @@ impl DiagCtxtInner {
|
||||
bug.arg("level", bug.level);
|
||||
let msg = crate::fluent_generated::errors_invalid_flushed_delayed_diagnostic_level;
|
||||
let msg = self.eagerly_translate_for_subdiag(&bug, msg); // after the `arg` call
|
||||
bug.sub(Level::Note, msg, bug.span.primary_span().unwrap().into());
|
||||
bug.sub(Note, msg, bug.span.primary_span().unwrap().into());
|
||||
}
|
||||
bug.level = Bug;
|
||||
|
||||
@ -1671,7 +1685,7 @@ impl DelayedDiagInner {
|
||||
diag.arg("emitted_at", diag.emitted_at.clone());
|
||||
diag.arg("note", self.note);
|
||||
let msg = dcx.eagerly_translate_for_subdiag(&diag, msg); // after the `arg` calls
|
||||
diag.sub(Level::Note, msg, diag.span.primary_span().unwrap_or(DUMMY_SP).into());
|
||||
diag.sub(Note, msg, diag.span.primary_span().unwrap_or(DUMMY_SP).into());
|
||||
diag
|
||||
}
|
||||
}
|
||||
|
@ -239,8 +239,6 @@ hir_analysis_missing_one_of_trait_item = not all trait items implemented, missin
|
||||
.label = missing one of `{$missing_items_msg}` in implementation
|
||||
.note = required because of this annotation
|
||||
|
||||
hir_analysis_missing_tilde_const = missing `~const` qualifier for specialization
|
||||
|
||||
hir_analysis_missing_trait_item = not all trait items implemented, missing: `{$missing_items_msg}`
|
||||
.label = missing `{$missing_items_msg}` in implementation
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use rustc_ast::TraitObjectSyntax;
|
||||
use rustc_errors::{codes::*, Diag, EmissionGuarantee, Level, StashKey};
|
||||
use rustc_errors::{codes::*, Diag, EmissionGuarantee, StashKey};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_lint_defs::{builtin::BARE_TRAIT_OBJECTS, Applicability};
|
||||
@ -237,15 +237,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
// check if the impl trait that we are considering is a impl of a local trait
|
||||
self.maybe_lint_blanket_trait_impl(self_ty, &mut diag);
|
||||
match diag.level() {
|
||||
Level::Error => {
|
||||
diag.stash(self_ty.span, StashKey::TraitMissingMethod);
|
||||
}
|
||||
Level::DelayedBug => {
|
||||
diag.emit();
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
diag.stash(self_ty.span, StashKey::TraitMissingMethod);
|
||||
} else {
|
||||
let msg = "trait objects without an explicit `dyn` are deprecated";
|
||||
tcx.node_span_lint(BARE_TRAIT_OBJECTS, self_ty.hir_id, self_ty.span, msg, |lint| {
|
||||
|
@ -1247,10 +1247,23 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
(&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => {
|
||||
let did1 = def1.did();
|
||||
let did2 = def2.did();
|
||||
let sub_no_defaults_1 =
|
||||
self.tcx.generics_of(did1).own_args_no_defaults(self.tcx, sub1);
|
||||
let sub_no_defaults_2 =
|
||||
self.tcx.generics_of(did2).own_args_no_defaults(self.tcx, sub2);
|
||||
|
||||
let generics1 = self.tcx.generics_of(did1);
|
||||
let generics2 = self.tcx.generics_of(did2);
|
||||
|
||||
let non_default_after_default = generics1
|
||||
.check_concrete_type_after_default(self.tcx, sub1)
|
||||
|| generics2.check_concrete_type_after_default(self.tcx, sub2);
|
||||
let sub_no_defaults_1 = if non_default_after_default {
|
||||
generics1.own_args(sub1)
|
||||
} else {
|
||||
generics1.own_args_no_defaults(self.tcx, sub1)
|
||||
};
|
||||
let sub_no_defaults_2 = if non_default_after_default {
|
||||
generics2.own_args(sub2)
|
||||
} else {
|
||||
generics2.own_args_no_defaults(self.tcx, sub2)
|
||||
};
|
||||
let mut values = (DiagStyledString::new(), DiagStyledString::new());
|
||||
let path1 = self.tcx.def_path_str(did1);
|
||||
let path2 = self.tcx.def_path_str(did2);
|
||||
|
@ -104,7 +104,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
if let Some(span) = in_test_module {
|
||||
diag.span_help(
|
||||
sess.source_map().guess_head_span(span),
|
||||
"consider adding a `#[cfg(test)]` to the containing module",
|
||||
"if this is a test module, consider adding a `#[cfg(test)]` to the containing module",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -360,6 +360,30 @@ impl<'tcx> Generics {
|
||||
let own = &args[self.parent_count..][..self.params.len()];
|
||||
if self.has_self && self.parent.is_none() { &own[1..] } else { own }
|
||||
}
|
||||
|
||||
/// Returns true if a concrete type is specified after a default type.
|
||||
/// For example, consider `struct T<W = usize, X = Vec<W>>(W, X)`
|
||||
/// `T<usize, String>` will return true
|
||||
/// `T<usize>` will return false
|
||||
pub fn check_concrete_type_after_default(
|
||||
&'tcx self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
args: &'tcx [ty::GenericArg<'tcx>],
|
||||
) -> bool {
|
||||
let mut default_param_seen = false;
|
||||
for param in self.params.iter() {
|
||||
if let Some(inst) =
|
||||
param.default_value(tcx).map(|default| default.instantiate(tcx, args))
|
||||
{
|
||||
if inst == args[param.index as usize] {
|
||||
default_param_seen = true;
|
||||
} else if default_param_seen {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Bounds on generics.
|
||||
|
@ -93,8 +93,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
variable_source_info,
|
||||
true,
|
||||
));
|
||||
this.cfg.goto(lhs_success_block, variable_source_info, rhs_success_block);
|
||||
rhs_success_block.unit()
|
||||
|
||||
// Make the LHS and RHS success arms converge to a common block.
|
||||
// (We can't just make LHS goto RHS, because `rhs_success_block`
|
||||
// might contain statements that we don't want on the LHS path.)
|
||||
let success_block = this.cfg.start_new_block();
|
||||
this.cfg.goto(lhs_success_block, variable_source_info, success_block);
|
||||
this.cfg.goto(rhs_success_block, variable_source_info, success_block);
|
||||
success_block.unit()
|
||||
}
|
||||
ExprKind::Unary { op: UnOp::Not, arg } => {
|
||||
let local_scope = this.local_scope();
|
||||
|
@ -586,7 +586,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||
}
|
||||
|
||||
Aggregate(ref kind, ref fields) => {
|
||||
// Do not const pop union fields as they can be
|
||||
// Do not const prop union fields as they can be
|
||||
// made to produce values that don't match their
|
||||
// underlying layout's type (see ICE #121534).
|
||||
// If the last element of the `Adt` tuple
|
||||
|
@ -284,9 +284,6 @@ parse_found_expr_would_be_stmt = expected expression, found `{$token}`
|
||||
parse_function_body_equals_expr = function body cannot be `= expression;`
|
||||
.suggestion = surround the expression with `{"{"}` and `{"}"}` instead of `=` and `;`
|
||||
|
||||
parse_gen_fn = `gen` functions are not yet implemented
|
||||
.help = for now you can use `gen {"{}"}` blocks and return `impl Iterator` instead
|
||||
|
||||
parse_generic_args_in_pat_require_turbofish_syntax = generic args in patterns require the turbofish syntax
|
||||
|
||||
parse_generic_parameters_without_angle_brackets = generic parameters without surrounding angle brackets
|
||||
|
@ -8,10 +8,6 @@ resolve_add_as_non_derive =
|
||||
resolve_added_macro_use =
|
||||
have you added the `#[macro_use]` on the module/import?
|
||||
|
||||
resolve_ampersand_used_without_explicit_lifetime_name =
|
||||
`&` without an explicit lifetime name cannot be used here
|
||||
.note = explicit lifetime name needed here
|
||||
|
||||
resolve_ancestor_only =
|
||||
visibilities can only be restricted to ancestor modules
|
||||
|
||||
@ -100,12 +96,6 @@ resolve_const_param_in_non_trivial_anon_const =
|
||||
resolve_const_param_in_ty_of_const_param =
|
||||
const parameters may not be used in the type of const parameters
|
||||
|
||||
resolve_crate_may_not_be_imported =
|
||||
`$crate` may not be imported
|
||||
|
||||
resolve_crate_root_imports_must_be_named_explicitly =
|
||||
crate root imports need to be explicitly named: `use crate as name;`
|
||||
|
||||
resolve_expected_found =
|
||||
expected module, found {$res} `{$path_str}`
|
||||
.label = not a module
|
||||
@ -220,9 +210,6 @@ resolve_param_in_ty_of_const_param =
|
||||
the type of const parameters must not depend on other generic parameters
|
||||
.label = the type must not depend on the parameter `{$name}`
|
||||
|
||||
resolve_parent_module_reset_for_binding =
|
||||
parent module is reset for binding
|
||||
|
||||
resolve_proc_macro_same_crate = can't use a procedural macro from the same crate that defines it
|
||||
.help = you can define integration tests in a directory named `tests`
|
||||
|
||||
@ -270,11 +257,6 @@ resolve_trait_impl_duplicate =
|
||||
.old_span_label = previous definition here
|
||||
.trait_item_span = item in trait
|
||||
|
||||
resolve_trait_impl_mismatch =
|
||||
item `{$name}` is an associated {$kind}, which doesn't match its trait `{$trait_path}`
|
||||
.label = does not match trait
|
||||
.label_trait_item = item in trait
|
||||
|
||||
resolve_try_using_similarly_named_label =
|
||||
try using similarly named label
|
||||
|
||||
@ -295,10 +277,6 @@ resolve_undeclared_label =
|
||||
use of undeclared label `{$name}`
|
||||
.label = undeclared label `{$name}`
|
||||
|
||||
resolve_underscore_lifetime_name_cannot_be_used_here =
|
||||
`'_` cannot be used here
|
||||
.note = `'_` is a reserved lifetime name
|
||||
|
||||
resolve_unexpected_res_change_ty_to_const_param_sugg =
|
||||
you might have meant to write a const parameter here
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
/// For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
|
||||
/// see design document in the tracking issue #89653.
|
||||
use bitflags::bitflags;
|
||||
use rustc_middle::ty::{FnSig, Instance, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{Instance, Ty, TyCtxt};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use std::hash::Hasher;
|
||||
use twox_hash::XxHash64;
|
||||
|
||||
bitflags! {
|
||||
/// Options for typeid_for_fnabi and typeid_for_fnsig.
|
||||
/// Options for typeid_for_fnabi.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct TypeIdOptions: u32 {
|
||||
const GENERALIZE_POINTERS = 1;
|
||||
@ -30,15 +30,6 @@ pub fn typeid_for_fnabi<'tcx>(
|
||||
typeid_itanium_cxx_abi::typeid_for_fnabi(tcx, fn_abi, options)
|
||||
}
|
||||
|
||||
/// Returns a type metadata identifier for the specified FnSig.
|
||||
pub fn typeid_for_fnsig<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn_sig: &FnSig<'tcx>,
|
||||
options: TypeIdOptions,
|
||||
) -> String {
|
||||
typeid_itanium_cxx_abi::typeid_for_fnsig(tcx, fn_sig, options)
|
||||
}
|
||||
|
||||
/// Returns a type metadata identifier for the specified Instance.
|
||||
pub fn typeid_for_instance<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
@ -61,19 +52,6 @@ pub fn kcfi_typeid_for_fnabi<'tcx>(
|
||||
hash.finish() as u32
|
||||
}
|
||||
|
||||
/// Returns a KCFI type metadata identifier for the specified FnSig.
|
||||
pub fn kcfi_typeid_for_fnsig<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn_sig: &FnSig<'tcx>,
|
||||
options: TypeIdOptions,
|
||||
) -> u32 {
|
||||
// A KCFI type metadata identifier is a 32-bit constant produced by taking the lower half of the
|
||||
// xxHash64 of the type metadata identifier. (See llvm/llvm-project@cff5bef.)
|
||||
let mut hash: XxHash64 = Default::default();
|
||||
hash.write(typeid_itanium_cxx_abi::typeid_for_fnsig(tcx, fn_sig, options).as_bytes());
|
||||
hash.finish() as u32
|
||||
}
|
||||
|
||||
/// Returns a KCFI type metadata identifier for the specified Instance.
|
||||
pub fn kcfi_typeid_for_instance<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
@ -1074,41 +1074,6 @@ pub fn typeid_for_fnabi<'tcx>(
|
||||
typeid
|
||||
}
|
||||
|
||||
/// Returns a type metadata identifier for the specified FnSig using the Itanium C++ ABI with vendor
|
||||
/// extended type qualifiers and types for Rust types that are not used at the FFI boundary.
|
||||
pub fn typeid_for_fnsig<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn_sig: &FnSig<'tcx>,
|
||||
options: TypeIdOptions,
|
||||
) -> String {
|
||||
// A name is mangled by prefixing "_Z" to an encoding of its name, and in the case of functions
|
||||
// its type.
|
||||
let mut typeid = String::from("_Z");
|
||||
|
||||
// Clang uses the Itanium C++ ABI's virtual tables and RTTI typeinfo structure name as type
|
||||
// metadata identifiers for function pointers. The typeinfo name encoding is a two-character
|
||||
// code (i.e., 'TS') prefixed to the type encoding for the function.
|
||||
typeid.push_str("TS");
|
||||
|
||||
// A dictionary of substitution candidates used for compression (see
|
||||
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression).
|
||||
let mut dict: FxHashMap<DictKey<'tcx>, usize> = FxHashMap::default();
|
||||
|
||||
// Encode the function signature
|
||||
typeid.push_str(&encode_fnsig(tcx, fn_sig, &mut dict, options));
|
||||
|
||||
// Add encoding suffixes
|
||||
if options.contains(EncodeTyOptions::NORMALIZE_INTEGERS) {
|
||||
typeid.push_str(".normalized");
|
||||
}
|
||||
|
||||
if options.contains(EncodeTyOptions::GENERALIZE_POINTERS) {
|
||||
typeid.push_str(".generalized");
|
||||
}
|
||||
|
||||
typeid
|
||||
}
|
||||
|
||||
/// Returns a type metadata identifier for the specified Instance using the Itanium C++ ABI with
|
||||
/// vendor extended type qualifiers and types for Rust types that are not used at the FFI boundary.
|
||||
pub fn typeid_for_instance<'tcx>(
|
||||
|
@ -162,15 +162,28 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
|
||||
let tcx = ecx.tcx();
|
||||
|
||||
let goal_trait_ref = goal.predicate.alias.trait_ref(tcx);
|
||||
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||
let impl_trait_header = tcx.impl_trait_header(impl_def_id).unwrap();
|
||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
|
||||
if !drcx.args_may_unify(goal_trait_ref.args, impl_trait_ref.skip_binder().args) {
|
||||
if !drcx.args_may_unify(
|
||||
goal.predicate.trait_ref(tcx).args,
|
||||
impl_trait_header.skip_binder().trait_ref.args,
|
||||
) {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
// We have to ignore negative impls when projecting.
|
||||
let impl_polarity = impl_trait_header.skip_binder().polarity;
|
||||
match impl_polarity {
|
||||
ty::ImplPolarity::Negative => return Err(NoSolution),
|
||||
ty::ImplPolarity::Reservation => {
|
||||
unimplemented!("reservation impl for trait with assoc item: {:?}", goal)
|
||||
}
|
||||
ty::ImplPolarity::Positive => {}
|
||||
};
|
||||
|
||||
ecx.probe_trait_candidate(CandidateSource::Impl(impl_def_id)).enter(|ecx| {
|
||||
let impl_args = ecx.fresh_args_for_item(impl_def_id);
|
||||
let impl_trait_ref = impl_trait_ref.instantiate(tcx, impl_args);
|
||||
let impl_trait_ref = impl_trait_header.instantiate(tcx, impl_args).trait_ref;
|
||||
|
||||
ecx.eq(goal.param_env, goal_trait_ref, impl_trait_ref)?;
|
||||
|
||||
|
@ -24,13 +24,17 @@ mod private {
|
||||
/// A marker trait for primitive types which can be zero.
|
||||
///
|
||||
/// This is an implementation detail for <code>[NonZero]\<T></code> which may disappear or be replaced at any time.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Types implementing this trait must be primitves that are valid when zeroed.
|
||||
#[unstable(
|
||||
feature = "nonzero_internals",
|
||||
reason = "implementation detail which may disappear or be replaced at any time",
|
||||
issue = "none"
|
||||
)]
|
||||
#[const_trait]
|
||||
pub trait ZeroablePrimitive: Sized + Copy + private::Sealed {}
|
||||
pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {}
|
||||
|
||||
macro_rules! impl_zeroable_primitive {
|
||||
($primitive:ty) => {
|
||||
@ -46,7 +50,7 @@ macro_rules! impl_zeroable_primitive {
|
||||
reason = "implementation detail which may disappear or be replaced at any time",
|
||||
issue = "none"
|
||||
)]
|
||||
impl const ZeroablePrimitive for $primitive {}
|
||||
unsafe impl const ZeroablePrimitive for $primitive {}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -369,26 +369,6 @@ impl<T: ?Sized> Mutex<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Immediately drops the guard, and consequently unlocks the mutex.
|
||||
///
|
||||
/// This function is equivalent to calling [`drop`] on the guard but is more self-documenting.
|
||||
/// Alternately, the guard will be automatically dropped when it goes out of scope.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(mutex_unlock)]
|
||||
///
|
||||
/// use std::sync::Mutex;
|
||||
/// let mutex = Mutex::new(0);
|
||||
///
|
||||
/// let mut guard = mutex.lock().unwrap();
|
||||
/// *guard += 20;
|
||||
/// Mutex::unlock(guard);
|
||||
/// ```
|
||||
#[unstable(feature = "mutex_unlock", issue = "81872")]
|
||||
pub fn unlock(guard: MutexGuard<'_, T>) {
|
||||
drop(guard);
|
||||
}
|
||||
|
||||
/// Determines whether the mutex is poisoned.
|
||||
///
|
||||
/// If another thread is active, the mutex can still become poisoned at any
|
||||
|
32
src/tools/tidy/src/iter_header.rs
Normal file
32
src/tools/tidy/src/iter_header.rs
Normal file
@ -0,0 +1,32 @@
|
||||
const COMMENT: &str = "//@";
|
||||
|
||||
/// A header line, like `//@name: value` consists of the prefix `//@` and the directive
|
||||
/// `name: value`. It is also possibly revisioned, e.g. `//@[revision] name: value`.
|
||||
pub(crate) struct HeaderLine<'ln> {
|
||||
pub(crate) revision: Option<&'ln str>,
|
||||
pub(crate) directive: &'ln str,
|
||||
}
|
||||
|
||||
/// Iterate through compiletest headers in a test contents.
|
||||
///
|
||||
/// Adjusted from compiletest/src/header.rs.
|
||||
pub(crate) fn iter_header<'ln>(contents: &'ln str, it: &mut dyn FnMut(HeaderLine<'ln>)) {
|
||||
for ln in contents.lines() {
|
||||
let ln = ln.trim();
|
||||
|
||||
// We're left with potentially `[rev]name: value`.
|
||||
let Some(remainder) = ln.strip_prefix(COMMENT) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if let Some(remainder) = remainder.trim_start().strip_prefix('[') {
|
||||
let Some((revision, remainder)) = remainder.split_once(']') else {
|
||||
panic!("malformed revision directive: expected `//@[rev]`, found `{ln}`");
|
||||
};
|
||||
// We trimmed off the `[rev]` portion, left with `name: value`.
|
||||
it(HeaderLine { revision: Some(revision), directive: remainder.trim() });
|
||||
} else {
|
||||
it(HeaderLine { revision: None, directive: remainder.trim() });
|
||||
}
|
||||
}
|
||||
}
|
@ -65,6 +65,7 @@ pub mod ext_tool_checks;
|
||||
pub mod extdeps;
|
||||
pub mod features;
|
||||
pub mod fluent_alphabetical;
|
||||
pub(crate) mod iter_header;
|
||||
pub mod mir_opt_tests;
|
||||
pub mod pal;
|
||||
pub mod rustdoc_css_themes;
|
||||
@ -73,6 +74,7 @@ pub mod style;
|
||||
pub mod target_policy;
|
||||
pub mod target_specific_tests;
|
||||
pub mod tests_placement;
|
||||
pub mod tests_revision_unpaired_stdout_stderr;
|
||||
pub mod ui_tests;
|
||||
pub mod unit_tests;
|
||||
pub mod unstable_book;
|
||||
|
@ -100,6 +100,7 @@ fn main() {
|
||||
|
||||
// Checks over tests.
|
||||
check!(tests_placement, &root_path);
|
||||
check!(tests_revision_unpaired_stdout_stderr, &tests_path);
|
||||
check!(debug_artifacts, &tests_path);
|
||||
check!(ui_tests, &tests_path, bless);
|
||||
check!(mir_opt_tests, &tests_path, bless);
|
||||
|
@ -4,32 +4,12 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::iter_header::{iter_header, HeaderLine};
|
||||
use crate::walk::filter_not_rust;
|
||||
|
||||
const COMMENT: &str = "//@";
|
||||
const LLVM_COMPONENTS_HEADER: &str = "needs-llvm-components:";
|
||||
const COMPILE_FLAGS_HEADER: &str = "compile-flags:";
|
||||
|
||||
/// Iterate through compiletest headers in a test contents.
|
||||
///
|
||||
/// Adjusted from compiletest/src/header.rs.
|
||||
fn iter_header<'a>(contents: &'a str, it: &mut dyn FnMut(Option<&'a str>, &'a str)) {
|
||||
for ln in contents.lines() {
|
||||
let ln = ln.trim();
|
||||
if ln.starts_with(COMMENT) && ln[COMMENT.len()..].trim_start().starts_with('[') {
|
||||
if let Some(close_brace) = ln.find(']') {
|
||||
let open_brace = ln.find('[').unwrap();
|
||||
let lncfg = &ln[open_brace + 1..close_brace];
|
||||
it(Some(lncfg), ln[(close_brace + 1)..].trim_start());
|
||||
} else {
|
||||
panic!("malformed condition directive: expected `//[foo]`, found `{ln}`")
|
||||
}
|
||||
} else if ln.starts_with(COMMENT) {
|
||||
it(None, ln[COMMENT.len()..].trim_start());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct RevisionInfo<'a> {
|
||||
target_arch: Option<&'a str>,
|
||||
@ -40,9 +20,9 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
crate::walk::walk(path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| {
|
||||
let file = entry.path().display();
|
||||
let mut header_map = BTreeMap::new();
|
||||
iter_header(content, &mut |cfg, directive| {
|
||||
iter_header(content, &mut |HeaderLine { revision, directive }| {
|
||||
if let Some(value) = directive.strip_prefix(LLVM_COMPONENTS_HEADER) {
|
||||
let info = header_map.entry(cfg).or_insert(RevisionInfo::default());
|
||||
let info = header_map.entry(revision).or_insert(RevisionInfo::default());
|
||||
let comp_vec = info.llvm_components.get_or_insert(Vec::new());
|
||||
for component in value.split(' ') {
|
||||
let component = component.trim();
|
||||
@ -56,7 +36,7 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
if let Some((arch, _)) =
|
||||
v.trim_start_matches(|c| c == ' ' || c == '=').split_once("-")
|
||||
{
|
||||
let info = header_map.entry(cfg).or_insert(RevisionInfo::default());
|
||||
let info = header_map.entry(revision).or_insert(RevisionInfo::default());
|
||||
info.target_arch.replace(arch);
|
||||
} else {
|
||||
eprintln!("{file}: seems to have a malformed --target value");
|
||||
|
146
src/tools/tidy/src/tests_revision_unpaired_stdout_stderr.rs
Normal file
146
src/tools/tidy/src/tests_revision_unpaired_stdout_stderr.rs
Normal file
@ -0,0 +1,146 @@
|
||||
//! Checks that there are no unpaired `.stderr` or `.stdout` for a test with and without revisions.
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::iter_header::*;
|
||||
use crate::walk::*;
|
||||
|
||||
// Should be kept in sync with `CompareMode` in `src/tools/compiletest/src/common.rs`,
|
||||
// as well as `run`.
|
||||
const IGNORES: &[&str] = &[
|
||||
"polonius",
|
||||
"chalk",
|
||||
"split-dwarf",
|
||||
"split-dwarf-single",
|
||||
"next-solver-coherence",
|
||||
"next-solver",
|
||||
"run",
|
||||
];
|
||||
const EXTENSIONS: &[&str] = &["stdout", "stderr"];
|
||||
const SPECIAL_TEST: &str = "tests/ui/command/need-crate-arg-ignore-tidy.x.rs";
|
||||
|
||||
pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
|
||||
// Recurse over subdirectories under `tests/`
|
||||
walk_dir(tests_path.as_ref(), filter, &mut |entry| {
|
||||
// We are inspecting a folder. Collect the paths to interesting files `.rs`, `.stderr`,
|
||||
// `.stdout` under the current folder (shallow).
|
||||
let mut files_under_inspection = BTreeSet::new();
|
||||
for sibling in std::fs::read_dir(entry.path()).unwrap() {
|
||||
let Ok(sibling) = sibling else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if sibling.path().is_dir() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let sibling_path = sibling.path();
|
||||
|
||||
let Some(ext) = sibling_path.extension().map(OsStr::to_str).flatten() else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if ext == "rs" || EXTENSIONS.contains(&ext) {
|
||||
files_under_inspection.insert(sibling_path);
|
||||
}
|
||||
}
|
||||
|
||||
let mut test_info = BTreeMap::new();
|
||||
|
||||
for test in
|
||||
files_under_inspection.iter().filter(|f| f.extension().is_some_and(|ext| ext == "rs"))
|
||||
{
|
||||
if test.ends_with(SPECIAL_TEST) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut expected_revisions = BTreeSet::new();
|
||||
|
||||
let contents = std::fs::read_to_string(test).unwrap();
|
||||
|
||||
// Collect directives.
|
||||
iter_header(&contents, &mut |HeaderLine { revision, directive }| {
|
||||
// We're trying to *find* `//@ revision: xxx` directives themselves, not revisioned
|
||||
// directives.
|
||||
if revision.is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
let directive = directive.trim();
|
||||
|
||||
if directive.starts_with("revisions") {
|
||||
let Some((name, value)) = directive.split_once([':', ' ']) else {
|
||||
return;
|
||||
};
|
||||
|
||||
if name == "revisions" {
|
||||
let revs = value.split(' ');
|
||||
for rev in revs {
|
||||
expected_revisions.insert(rev.to_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let Some((test_name, _)) = test.to_str().map(|s| s.split_once('.')).flatten() else {
|
||||
continue;
|
||||
};
|
||||
|
||||
test_info.insert(test_name.to_string(), (test, expected_revisions));
|
||||
}
|
||||
|
||||
// Our test file `foo.rs` has specified no revisions. There should not be any
|
||||
// `foo.rev{.stderr,.stdout}` files. rustc-dev-guide says test output files can have names
|
||||
// of the form: `test-name.revision.compare_mode.extension`, but our only concern is
|
||||
// `test-name.revision` and `extension`.
|
||||
for sibling in files_under_inspection.iter().filter(|f| {
|
||||
f.extension().map(OsStr::to_str).flatten().is_some_and(|ext| EXTENSIONS.contains(&ext))
|
||||
}) {
|
||||
let filename_components = sibling.to_str().unwrap().split('.').collect::<Vec<_>>();
|
||||
let file_prefix = filename_components[0];
|
||||
|
||||
let Some((test_path, expected_revisions)) = test_info.get(file_prefix) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
match filename_components[..] {
|
||||
// Cannot have a revision component, skip.
|
||||
[] | [_] => return,
|
||||
[_, _] if !expected_revisions.is_empty() => {
|
||||
// Found unrevisioned output files for a revisioned test.
|
||||
tidy_error!(
|
||||
bad,
|
||||
"found unrevisioned output file `{}` for a revisioned test `{}`",
|
||||
sibling.display(),
|
||||
test_path.display(),
|
||||
);
|
||||
}
|
||||
[_, _] => return,
|
||||
[_, found_revision, .., extension] => {
|
||||
if !IGNORES.contains(&found_revision)
|
||||
&& !expected_revisions.contains(found_revision)
|
||||
// This is from `//@ stderr-per-bitwidth`
|
||||
&& !(extension == "stderr" && ["32bit", "64bit"].contains(&found_revision))
|
||||
{
|
||||
// Found some unexpected revision-esque component that is not a known
|
||||
// compare-mode or expected revision.
|
||||
tidy_error!(
|
||||
bad,
|
||||
"found output file `{}` for unexpected revision `{}` of test `{}`",
|
||||
sibling.display(),
|
||||
found_revision,
|
||||
test_path.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn filter(path: &Path) -> bool {
|
||||
filter_dirs(path) // ignore certain dirs
|
||||
|| (path.file_name().is_some_and(|name| name == "auxiliary")) // ignore auxiliary folder
|
||||
}
|
@ -86,3 +86,20 @@ pub(crate) fn walk_no_read(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Walk through directories and skip symlinks.
|
||||
pub(crate) fn walk_dir(
|
||||
path: &Path,
|
||||
skip: impl Send + Sync + 'static + Fn(&Path) -> bool,
|
||||
f: &mut dyn FnMut(&DirEntry),
|
||||
) {
|
||||
let mut walker = ignore::WalkBuilder::new(path);
|
||||
let walker = walker.filter_entry(move |e| !skip(e.path()));
|
||||
for entry in walker.build() {
|
||||
if let Ok(entry) = entry {
|
||||
if entry.path().is_dir() {
|
||||
f(&entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ fn test_complex() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
StorageLive(_2);
|
||||
_2 = E::f() -> [return: bb1, unwind: bb37];
|
||||
_2 = E::f() -> [return: bb1, unwind: bb38];
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -34,7 +34,7 @@ fn test_complex() -> () {
|
||||
}
|
||||
|
||||
bb3: {
|
||||
goto -> bb22;
|
||||
goto -> bb23;
|
||||
}
|
||||
|
||||
bb4: {
|
||||
@ -51,7 +51,7 @@ fn test_complex() -> () {
|
||||
|
||||
bb7: {
|
||||
StorageLive(_4);
|
||||
_4 = always_true() -> [return: bb8, unwind: bb37];
|
||||
_4 = always_true() -> [return: bb8, unwind: bb38];
|
||||
}
|
||||
|
||||
bb8: {
|
||||
@ -73,7 +73,7 @@ fn test_complex() -> () {
|
||||
}
|
||||
|
||||
bb11: {
|
||||
drop(_7) -> [return: bb13, unwind: bb37];
|
||||
drop(_7) -> [return: bb13, unwind: bb38];
|
||||
}
|
||||
|
||||
bb12: {
|
||||
@ -83,11 +83,11 @@ fn test_complex() -> () {
|
||||
bb13: {
|
||||
StorageDead(_7);
|
||||
StorageDead(_6);
|
||||
goto -> bb19;
|
||||
goto -> bb20;
|
||||
}
|
||||
|
||||
bb14: {
|
||||
drop(_7) -> [return: bb15, unwind: bb37];
|
||||
drop(_7) -> [return: bb15, unwind: bb38];
|
||||
}
|
||||
|
||||
bb15: {
|
||||
@ -107,106 +107,110 @@ fn test_complex() -> () {
|
||||
}
|
||||
|
||||
bb17: {
|
||||
drop(_10) -> [return: bb19, unwind: bb37];
|
||||
drop(_10) -> [return: bb19, unwind: bb38];
|
||||
}
|
||||
|
||||
bb18: {
|
||||
goto -> bb20;
|
||||
goto -> bb21;
|
||||
}
|
||||
|
||||
bb19: {
|
||||
StorageDead(_10);
|
||||
StorageDead(_9);
|
||||
_1 = const ();
|
||||
goto -> bb23;
|
||||
goto -> bb20;
|
||||
}
|
||||
|
||||
bb20: {
|
||||
drop(_10) -> [return: bb21, unwind: bb37];
|
||||
_1 = const ();
|
||||
goto -> bb24;
|
||||
}
|
||||
|
||||
bb21: {
|
||||
StorageDead(_10);
|
||||
StorageDead(_9);
|
||||
goto -> bb22;
|
||||
drop(_10) -> [return: bb22, unwind: bb38];
|
||||
}
|
||||
|
||||
bb22: {
|
||||
_1 = const ();
|
||||
StorageDead(_10);
|
||||
StorageDead(_9);
|
||||
goto -> bb23;
|
||||
}
|
||||
|
||||
bb23: {
|
||||
_1 = const ();
|
||||
goto -> bb24;
|
||||
}
|
||||
|
||||
bb24: {
|
||||
StorageDead(_8);
|
||||
StorageDead(_5);
|
||||
StorageDead(_4);
|
||||
StorageDead(_2);
|
||||
StorageDead(_1);
|
||||
StorageLive(_11);
|
||||
_11 = always_true() -> [return: bb24, unwind: bb37];
|
||||
}
|
||||
|
||||
bb24: {
|
||||
switchInt(move _11) -> [0: bb26, otherwise: bb25];
|
||||
_11 = always_true() -> [return: bb25, unwind: bb38];
|
||||
}
|
||||
|
||||
bb25: {
|
||||
goto -> bb35;
|
||||
switchInt(move _11) -> [0: bb27, otherwise: bb26];
|
||||
}
|
||||
|
||||
bb26: {
|
||||
goto -> bb27;
|
||||
goto -> bb36;
|
||||
}
|
||||
|
||||
bb27: {
|
||||
StorageLive(_12);
|
||||
_12 = E::f() -> [return: bb28, unwind: bb37];
|
||||
goto -> bb28;
|
||||
}
|
||||
|
||||
bb28: {
|
||||
PlaceMention(_12);
|
||||
_13 = discriminant(_12);
|
||||
switchInt(move _13) -> [1: bb32, otherwise: bb30];
|
||||
StorageLive(_12);
|
||||
_12 = E::f() -> [return: bb29, unwind: bb38];
|
||||
}
|
||||
|
||||
bb29: {
|
||||
PlaceMention(_12);
|
||||
_13 = discriminant(_12);
|
||||
switchInt(move _13) -> [1: bb33, otherwise: bb31];
|
||||
}
|
||||
|
||||
bb30: {
|
||||
FakeRead(ForMatchedPlace(None), _12);
|
||||
unreachable;
|
||||
}
|
||||
|
||||
bb30: {
|
||||
goto -> bb35;
|
||||
}
|
||||
|
||||
bb31: {
|
||||
goto -> bb29;
|
||||
goto -> bb36;
|
||||
}
|
||||
|
||||
bb32: {
|
||||
falseEdge -> [real: bb34, imaginary: bb30];
|
||||
}
|
||||
|
||||
bb33: {
|
||||
goto -> bb30;
|
||||
}
|
||||
|
||||
bb33: {
|
||||
falseEdge -> [real: bb35, imaginary: bb31];
|
||||
}
|
||||
|
||||
bb34: {
|
||||
_0 = const ();
|
||||
goto -> bb36;
|
||||
goto -> bb31;
|
||||
}
|
||||
|
||||
bb35: {
|
||||
_0 = const ();
|
||||
goto -> bb36;
|
||||
goto -> bb37;
|
||||
}
|
||||
|
||||
bb36: {
|
||||
_0 = const ();
|
||||
goto -> bb37;
|
||||
}
|
||||
|
||||
bb37: {
|
||||
StorageDead(_11);
|
||||
StorageDead(_12);
|
||||
return;
|
||||
}
|
||||
|
||||
bb37 (cleanup): {
|
||||
bb38 (cleanup): {
|
||||
resume;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ fn test_or() -> () {
|
||||
}
|
||||
|
||||
bb1: {
|
||||
drop(_3) -> [return: bb3, unwind: bb12];
|
||||
drop(_3) -> [return: bb3, unwind: bb13];
|
||||
}
|
||||
|
||||
bb2: {
|
||||
@ -30,11 +30,11 @@ fn test_or() -> () {
|
||||
bb3: {
|
||||
StorageDead(_3);
|
||||
StorageDead(_2);
|
||||
goto -> bb8;
|
||||
goto -> bb9;
|
||||
}
|
||||
|
||||
bb4: {
|
||||
drop(_3) -> [return: bb5, unwind: bb12];
|
||||
drop(_3) -> [return: bb5, unwind: bb13];
|
||||
}
|
||||
|
||||
bb5: {
|
||||
@ -50,38 +50,42 @@ fn test_or() -> () {
|
||||
}
|
||||
|
||||
bb6: {
|
||||
drop(_6) -> [return: bb8, unwind: bb12];
|
||||
drop(_6) -> [return: bb8, unwind: bb13];
|
||||
}
|
||||
|
||||
bb7: {
|
||||
goto -> bb9;
|
||||
goto -> bb10;
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageDead(_6);
|
||||
StorageDead(_5);
|
||||
_0 = const ();
|
||||
goto -> bb11;
|
||||
goto -> bb9;
|
||||
}
|
||||
|
||||
bb9: {
|
||||
drop(_6) -> [return: bb10, unwind: bb12];
|
||||
_0 = const ();
|
||||
goto -> bb12;
|
||||
}
|
||||
|
||||
bb10: {
|
||||
StorageDead(_6);
|
||||
StorageDead(_5);
|
||||
_0 = const ();
|
||||
goto -> bb11;
|
||||
drop(_6) -> [return: bb11, unwind: bb13];
|
||||
}
|
||||
|
||||
bb11: {
|
||||
StorageDead(_6);
|
||||
StorageDead(_5);
|
||||
_0 = const ();
|
||||
goto -> bb12;
|
||||
}
|
||||
|
||||
bb12: {
|
||||
StorageDead(_4);
|
||||
StorageDead(_1);
|
||||
return;
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
bb13 (cleanup): {
|
||||
resume;
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
error: return type notation uses `()` instead of `(..)` for elided arguments
|
||||
--> $DIR/bad-inputs-and-output.rs:20:24
|
||||
|
|
||||
LL | fn baz<T: Trait<method(..): Send>>() {}
|
||||
| ^^ help: remove the `..`
|
||||
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/bad-inputs-and-output.rs:12:17
|
||||
|
|
||||
LL | fn foo<T: Trait<method(i32): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/bad-inputs-and-output.rs:16:17
|
||||
|
|
||||
LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/bad-inputs-and-output.rs:5:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: argument types not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:12:23
|
||||
|
|
||||
LL | fn foo<T: Trait<method(i32): Send>>() {}
|
||||
| ^^^^^ help: remove the input types: `()`
|
||||
|
||||
error: return type not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:16:25
|
||||
|
|
||||
LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
| ^^^^^^ help: remove the return type
|
||||
|
||||
error: aborting due to 5 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,48 +0,0 @@
|
||||
error: return type notation uses `()` instead of `(..)` for elided arguments
|
||||
--> $DIR/bad-inputs-and-output.rs:20:24
|
||||
|
|
||||
LL | fn baz<T: Trait<method(..): Send>>() {}
|
||||
| ^^ help: remove the `..`
|
||||
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/bad-inputs-and-output.rs:12:17
|
||||
|
|
||||
LL | fn foo<T: Trait<method(i32): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: associated type bounds are unstable
|
||||
--> $DIR/bad-inputs-and-output.rs:16:17
|
||||
|
|
||||
LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/bad-inputs-and-output.rs:5:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: argument types not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:12:23
|
||||
|
|
||||
LL | fn foo<T: Trait<method(i32): Send>>() {}
|
||||
| ^^^^^ help: remove the input types: `()`
|
||||
|
||||
error: return type not allowed with return type notation
|
||||
--> $DIR/bad-inputs-and-output.rs:16:25
|
||||
|
|
||||
LL | fn bar<T: Trait<method() -> (): Send>>() {}
|
||||
| ^^^^^^ help: remove the return type
|
||||
|
||||
error: aborting due to 5 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,11 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/basic.rs:8:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,29 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/basic.rs:8:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/basic.rs:26:13
|
||||
|
|
||||
LL | is_send(foo::<T>());
|
||||
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
|
||||
note: future is not `Send` as it awaits another future which is not `Send`
|
||||
--> $DIR/basic.rs:16:5
|
||||
|
|
||||
LL | T::method().await?;
|
||||
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/basic.rs:20:20
|
||||
|
|
||||
LL | fn is_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
@ -1,11 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/basic.rs:8:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,29 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/basic.rs:8:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/basic.rs:26:13
|
||||
|
|
||||
LL | is_send(foo::<T>());
|
||||
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
|
||||
note: future is not `Send` as it awaits another future which is not `Send`
|
||||
--> $DIR/basic.rs:16:5
|
||||
|
|
||||
LL | T::method().await?;
|
||||
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/basic.rs:20:20
|
||||
|
|
||||
LL | fn is_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
@ -1,50 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/issue-110963-early.rs:6:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
LL | | let mut hc = hc;
|
||||
LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
LL | | let mut hc = hc;
|
||||
LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -1,50 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/issue-110963-early.rs:6:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
LL | | let mut hc = hc;
|
||||
LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-110963-early.rs:17:5
|
||||
|
|
||||
LL | / spawn(async move {
|
||||
LL | | let mut hc = hc;
|
||||
LL | | if !hc.check().await {
|
||||
LL | | log_health_check_failure().await;
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^ one type is more general than the other
|
||||
|
|
||||
= note: expected trait `Send`
|
||||
found trait `for<'a> Send`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-110963-early.rs:37:17
|
||||
|
|
||||
LL | F: Future + Send + 'static,
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -1,11 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/issue-110963-late.rs:6:12
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,10 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/super-method-bound.rs:6:31
|
||||
|
|
||||
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,11 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/supertrait-bound.rs:5:49
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,11 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/supertrait-bound.rs:5:49
|
||||
|
|
||||
LL | #![feature(return_type_notation)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,28 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/ty-or-ct-params.rs:5:31
|
||||
|
|
||||
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: return type notation is not allowed for functions that have type parameters
|
||||
--> $DIR/ty-or-ct-params.rs:16:12
|
||||
|
|
||||
LL | async fn bar<T>() {}
|
||||
| - type parameter declared here
|
||||
...
|
||||
LL | T: Foo<bar(): Send, baz(): Send>,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: return type notation is not allowed for functions that have const parameters
|
||||
--> $DIR/ty-or-ct-params.rs:16:25
|
||||
|
|
||||
LL | async fn baz<const N: usize>() {}
|
||||
| -------------- const parameter declared here
|
||||
...
|
||||
LL | T: Foo<bar(): Send, baz(): Send>,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
@ -1,28 +0,0 @@
|
||||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/ty-or-ct-params.rs:5:31
|
||||
|
|
||||
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: return type notation is not allowed for functions that have type parameters
|
||||
--> $DIR/ty-or-ct-params.rs:16:12
|
||||
|
|
||||
LL | async fn bar<T>() {}
|
||||
| - type parameter declared here
|
||||
...
|
||||
LL | T: Foo<bar(): Send, baz(): Send>,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: return type notation is not allowed for functions that have const parameters
|
||||
--> $DIR/ty-or-ct-params.rs:16:25
|
||||
|
|
||||
LL | async fn baz<const N: usize>() {}
|
||||
| -------------- const parameter declared here
|
||||
...
|
||||
LL | T: Foo<bar(): Send, baz(): Send>,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
@ -3,4 +3,17 @@ fn foo(x: isize) { println!("{}", x); }
|
||||
fn main() {
|
||||
let x: isize;
|
||||
foo(x); //~ ERROR E0381
|
||||
|
||||
// test for #120634
|
||||
struct A(u8);
|
||||
struct B { d: u8 }
|
||||
let (a, );
|
||||
let [b, ];
|
||||
let A(c);
|
||||
let B { d };
|
||||
let _: (u8, u8, u8, u8) = (a, b, c, d);
|
||||
//~^ ERROR used binding `a`
|
||||
//~| ERROR used binding `b`
|
||||
//~| ERROR used binding `c`
|
||||
//~| ERROR used binding `d`
|
||||
}
|
||||
|
@ -11,6 +11,41 @@ help: consider assigning a value
|
||||
LL | let x: isize = 0;
|
||||
| +++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0381]: used binding `a` isn't initialized
|
||||
--> $DIR/borrowck-uninit.rs:14:32
|
||||
|
|
||||
LL | let (a, );
|
||||
| - binding declared here but left uninitialized
|
||||
...
|
||||
LL | let _: (u8, u8, u8, u8) = (a, b, c, d);
|
||||
| ^ `a` used here but it isn't initialized
|
||||
|
||||
error[E0381]: used binding `b` isn't initialized
|
||||
--> $DIR/borrowck-uninit.rs:14:35
|
||||
|
|
||||
LL | let [b, ];
|
||||
| - binding declared here but left uninitialized
|
||||
...
|
||||
LL | let _: (u8, u8, u8, u8) = (a, b, c, d);
|
||||
| ^ `b` used here but it isn't initialized
|
||||
|
||||
error[E0381]: used binding `c` isn't initialized
|
||||
--> $DIR/borrowck-uninit.rs:14:38
|
||||
|
|
||||
LL | let A(c);
|
||||
| - binding declared here but left uninitialized
|
||||
LL | let B { d };
|
||||
LL | let _: (u8, u8, u8, u8) = (a, b, c, d);
|
||||
| ^ `c` used here but it isn't initialized
|
||||
|
||||
error[E0381]: used binding `d` isn't initialized
|
||||
--> $DIR/borrowck-uninit.rs:14:41
|
||||
|
|
||||
LL | let B { d };
|
||||
| - binding declared here but left uninitialized
|
||||
LL | let _: (u8, u8, u8, u8) = (a, b, c, d);
|
||||
| ^ `d` used here but it isn't initialized
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0381`.
|
||||
|
@ -1,27 +0,0 @@
|
||||
error[E0658]: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
|
||||
error: parenthesized generic arguments cannot be used in associated type constraints
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^--
|
||||
| |
|
||||
| help: remove these parentheses
|
||||
|
||||
error[E0220]: associated type `m` not found for `Trait`
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^ associated type `m` not found
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0220, E0658.
|
||||
For more information about an error, try `rustc --explain E0220`.
|
@ -1,27 +0,0 @@
|
||||
error[E0658]: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
|
||||
error: parenthesized generic arguments cannot be used in associated type constraints
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^--
|
||||
| |
|
||||
| help: remove these parentheses
|
||||
|
||||
error[E0220]: associated type `m` not found for `Trait`
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^ associated type `m` not found
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0220, E0658.
|
||||
For more information about an error, try `rustc --explain E0220`.
|
@ -1,13 +0,0 @@
|
||||
warning: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,13 +0,0 @@
|
||||
warning: return type notation is experimental
|
||||
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
||||
|
|
||||
LL | fn foo<T: Trait<m(): Send>>() {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
|
||||
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -1,79 +0,0 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-71955.rs:54:5
|
||||
|
|
||||
LL | foo(bar, "string", |s| s.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>`
|
||||
found type `for<'r> FnOnce<(&'r &str,)>`
|
||||
note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:54:24
|
||||
|
|
||||
LL | foo(bar, "string", |s| s.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:34:9
|
||||
|
|
||||
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-71955.rs:54:5
|
||||
|
|
||||
LL | foo(bar, "string", |s| s.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected type `FnOnce<(&&str,)>`
|
||||
found type `for<'r> FnOnce<(&'r &str,)>`
|
||||
note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:54:24
|
||||
|
|
||||
LL | foo(bar, "string", |s| s.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:34:44
|
||||
|
|
||||
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
|
||||
| ^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-71955.rs:58:5
|
||||
|
|
||||
LL | foo(baz, "string", |s| s.0.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>`
|
||||
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
|
||||
note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:58:24
|
||||
|
|
||||
LL | foo(baz, "string", |s| s.0.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:34:9
|
||||
|
|
||||
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-71955.rs:58:5
|
||||
|
|
||||
LL | foo(baz, "string", |s| s.0.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected type `FnOnce<(&Wrapper<'_>,)>`
|
||||
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
|
||||
note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:58:24
|
||||
|
|
||||
LL | foo(baz, "string", |s| s.0.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:34:44
|
||||
|
|
||||
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -16,7 +16,7 @@ error: unused import: `super::a`
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: consider adding a `#[cfg(test)]` to the containing module
|
||||
help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module
|
||||
--> $DIR/unused-imports-in-test-module.rs:8:1
|
||||
|
|
||||
LL | mod test {
|
||||
@ -28,7 +28,7 @@ error: unused import: `super::a`
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: consider adding a `#[cfg(test)]` to the containing module
|
||||
help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module
|
||||
--> $DIR/unused-imports-in-test-module.rs:18:1
|
||||
|
|
||||
LL | mod tests {
|
||||
@ -40,7 +40,7 @@ error: unused import: `super::a`
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: consider adding a `#[cfg(test)]` to the containing module
|
||||
help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module
|
||||
--> $DIR/unused-imports-in-test-module.rs:28:1
|
||||
|
|
||||
LL | mod test_a {
|
||||
@ -52,7 +52,7 @@ error: unused import: `super::a`
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: consider adding a `#[cfg(test)]` to the containing module
|
||||
help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module
|
||||
--> $DIR/unused-imports-in-test-module.rs:38:1
|
||||
|
|
||||
LL | mod a_test {
|
||||
@ -64,7 +64,7 @@ error: unused import: `super::a`
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: consider adding a `#[cfg(test)]` to the containing module
|
||||
help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module
|
||||
--> $DIR/unused-imports-in-test-module.rs:48:1
|
||||
|
|
||||
LL | mod tests_a {
|
||||
@ -76,7 +76,7 @@ error: unused import: `super::a`
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: consider adding a `#[cfg(test)]` to the containing module
|
||||
help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module
|
||||
--> $DIR/unused-imports-in-test-module.rs:58:1
|
||||
|
|
||||
LL | mod a_tests {
|
||||
|
@ -1,13 +0,0 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-1.rs:11:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
LL | &mut x
|
||||
| ^^^^^^ returns a reference to a captured variable which escapes the closure body
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -1,15 +0,0 @@
|
||||
error: captured variable cannot escape `FnMut` closure body
|
||||
--> $DIR/issue-40510-3.rs:11:9
|
||||
|
|
||||
LL | || {
|
||||
| - inferred to be a `FnMut` closure
|
||||
LL | / || {
|
||||
LL | | x.push(())
|
||||
LL | | }
|
||||
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
||||
|
|
||||
= note: `FnMut` closures only have access to their captured variables while they are executing...
|
||||
= note: ...therefore, they cannot allow references to captured variables to escape
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -1,21 +0,0 @@
|
||||
error[E0308]: `match` arms have incompatible types
|
||||
--> $DIR/old-lub-glb-hr-noteq1.rs:17:14
|
||||
|
|
||||
LL | let z = match 22 {
|
||||
| _____________-
|
||||
LL | | 0 => x,
|
||||
| | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
|
||||
LL | | _ => y,
|
||||
| | ^ one type is more general than the other
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
|
||||
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -1,12 +0,0 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/old-lub-glb-hr-noteq1.rs:17:14
|
||||
|
|
||||
LL | _ => y,
|
||||
| ^ one type is more general than the other
|
||||
|
|
||||
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
|
||||
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -0,0 +1,22 @@
|
||||
//@ revisions: current next
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
|
||||
// Check that negative impls for traits with associated types
|
||||
// do not result in an ICE when trying to normalize.
|
||||
#![feature(negative_impls)]
|
||||
trait Trait {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
struct Local<T>(T);
|
||||
impl !Trait for Local<u32> {}
|
||||
impl Trait for Local<i32> {
|
||||
type Assoc = i32;
|
||||
}
|
||||
|
||||
trait NoOverlap {}
|
||||
impl<T: Trait<Assoc = u32>> NoOverlap for T {}
|
||||
impl<T> NoOverlap for Local<T> {}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,11 @@
|
||||
struct What<W = usize, X = Vec<W>>(W, X);
|
||||
|
||||
fn main() {
|
||||
let mut b: What<usize> = What(5, vec![1, 2, 3]);
|
||||
let c: What<usize, String> = What(1, String::from("meow"));
|
||||
b = c; //~ ERROR mismatched types
|
||||
|
||||
let mut f: What<usize, Vec<String>> = What(1, vec![String::from("meow")]);
|
||||
let e: What<usize> = What(5, vec![1, 2, 3]);
|
||||
f = e; //~ ERROR mismatched types
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/clarify-error-for-generics-with-default-issue-120785.rs:6:9
|
||||
|
|
||||
LL | let mut b: What<usize> = What(5, vec![1, 2, 3]);
|
||||
| ----------- expected due to this type
|
||||
LL | let c: What<usize, String> = What(1, String::from("meow"));
|
||||
LL | b = c;
|
||||
| ^ expected `What`, found `What<usize, String>`
|
||||
|
|
||||
= note: expected struct `What<_, Vec<usize>>`
|
||||
found struct `What<_, String>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/clarify-error-for-generics-with-default-issue-120785.rs:10:9
|
||||
|
|
||||
LL | let mut f: What<usize, Vec<String>> = What(1, vec![String::from("meow")]);
|
||||
| ------------------------ expected due to this type
|
||||
LL | let e: What<usize> = What(5, vec![1, 2, 3]);
|
||||
LL | f = e;
|
||||
| ^ expected `What<usize, Vec<String>>`, found `What`
|
||||
|
|
||||
= note: expected struct `What<_, Vec<String>>`
|
||||
found struct `What<_, Vec<usize>>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
8
tests/ui/typeck/invalid-stashed-level-issue-121812.rs
Normal file
8
tests/ui/typeck/invalid-stashed-level-issue-121812.rs
Normal file
@ -0,0 +1,8 @@
|
||||
union U {
|
||||
a: u16,
|
||||
b: [u8; 3],
|
||||
}
|
||||
|
||||
fn main() {
|
||||
_ = U { b: [()] }; //~ ERROR mismatched types
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-stashed-level-issue-121812.rs:7:17
|
||||
|
|
||||
LL | _ = U { b: [()] };
|
||||
| ^^ expected `u8`, found `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user