mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
Auto merge of #90984 - matthiaskrgr:rollup-j5bs96a, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #89610 (warn on must_use use on async fn's) - #90667 (Improve diagnostics when a static lifetime is expected) - #90687 (Permit const panics in stable const contexts in stdlib) - #90772 (Add Vec::retain_mut) - #90861 (Print escaped string if char literal has multiple characters, but only one printable character) - #90884 (Fix span for non-satisfied trivial trait bounds) - #90900 (Remove workaround for the forward progress handling in LLVM) - #90901 (Improve ManuallyDrop suggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
c9c4b5d727
@ -316,7 +316,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||
extended_asm.add_input_operand(None, "r", result.llval);
|
||||
extended_asm.add_clobber("memory");
|
||||
extended_asm.set_volatile_flag(true);
|
||||
|
||||
|
||||
// We have copied the value to `result` already.
|
||||
return;
|
||||
}
|
||||
@ -363,10 +363,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||
cond
|
||||
}
|
||||
|
||||
fn sideeffect(&mut self) {
|
||||
// TODO(antoyo)
|
||||
}
|
||||
|
||||
fn type_test(&mut self, _pointer: Self::Value, _typeid: Self::Value) -> Self::Value {
|
||||
// Unsupported.
|
||||
self.context.new_rvalue_from_int(self.int_type, 0)
|
||||
|
@ -597,7 +597,6 @@ impl CodegenCx<'b, 'tcx> {
|
||||
ifn!("llvm.trap", fn() -> void);
|
||||
ifn!("llvm.debugtrap", fn() -> void);
|
||||
ifn!("llvm.frameaddress", fn(t_i32) -> i8p);
|
||||
ifn!("llvm.sideeffect", fn() -> void);
|
||||
|
||||
ifn!("llvm.powi.f32", fn(t_f32, t_i32) -> t_f32);
|
||||
ifn!("llvm.powi.f64", fn(t_f64, t_i32) -> t_f64);
|
||||
|
@ -392,15 +392,6 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
self.call_intrinsic("llvm.expect.i1", &[cond, self.const_bool(expected)])
|
||||
}
|
||||
|
||||
fn sideeffect(&mut self) {
|
||||
// This kind of check would make a ton of sense in the caller, but currently the only
|
||||
// caller of this function is in `rustc_codegen_ssa`, which is agnostic to whether LLVM
|
||||
// codegen backend being used, and so is unable to check the LLVM version.
|
||||
if unsafe { llvm::LLVMRustVersionMajor() } < 12 {
|
||||
self.call_intrinsic("llvm.sideeffect", &[]);
|
||||
}
|
||||
}
|
||||
|
||||
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Value) -> Self::Value {
|
||||
// Test the called operand using llvm.type.test intrinsic. The LowerTypeTests link-time
|
||||
// optimization pass replaces calls to this intrinsic with code to test type membership.
|
||||
|
@ -980,17 +980,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
|
||||
mir::TerminatorKind::Goto { target } => {
|
||||
if bb == target {
|
||||
// This is an unconditional branch back to this same basic block. That means we
|
||||
// have something like a `loop {}` statement. LLVM versions before 12.0
|
||||
// miscompile this because they assume forward progress. For older versions
|
||||
// try to handle just this specific case which comes up commonly in practice
|
||||
// (e.g., in embedded code).
|
||||
//
|
||||
// NB: the `sideeffect` currently checks for the LLVM version used internally.
|
||||
bx.sideeffect();
|
||||
}
|
||||
|
||||
helper.funclet_br(self, &mut bx, target);
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,6 @@ pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
|
||||
fn abort(&mut self);
|
||||
fn assume(&mut self, val: Self::Value);
|
||||
fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
|
||||
/// Emits a forced side effect.
|
||||
///
|
||||
/// Currently has any effect only when LLVM versions prior to 12.0 are used as the backend.
|
||||
fn sideeffect(&mut self);
|
||||
/// Trait method used to test whether a given pointer is associated with a type identifier.
|
||||
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Value) -> Self::Value;
|
||||
/// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in
|
||||
|
@ -3,8 +3,6 @@
|
||||
use crate::infer::error_reporting::nice_region_error::find_anon_type::find_anon_type;
|
||||
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::FnRetTy;
|
||||
use rustc_middle::ty;
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
@ -48,19 +46,24 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
return None; // inapplicable
|
||||
};
|
||||
|
||||
// Suggesting to add a `'static` lifetime to a parameter is nearly always incorrect,
|
||||
// and can steer users down the wrong path.
|
||||
if *named == ty::ReStatic {
|
||||
return None;
|
||||
}
|
||||
|
||||
debug!("try_report_named_anon_conflict: named = {:?}", named);
|
||||
debug!("try_report_named_anon_conflict: anon_param_info = {:?}", anon_param_info);
|
||||
debug!("try_report_named_anon_conflict: region_info = {:?}", region_info);
|
||||
|
||||
let (param, new_ty, new_ty_span, br, is_first, scope_def_id, is_impl_item) = (
|
||||
anon_param_info.param,
|
||||
anon_param_info.param_ty,
|
||||
anon_param_info.param_ty_span,
|
||||
anon_param_info.bound_region,
|
||||
anon_param_info.is_first,
|
||||
region_info.def_id,
|
||||
region_info.is_impl_item,
|
||||
);
|
||||
let param = anon_param_info.param;
|
||||
let new_ty = anon_param_info.param_ty;
|
||||
let new_ty_span = anon_param_info.param_ty_span;
|
||||
let br = anon_param_info.bound_region;
|
||||
let is_first = anon_param_info.is_first;
|
||||
let scope_def_id = region_info.def_id;
|
||||
let is_impl_item = region_info.is_impl_item;
|
||||
|
||||
match br {
|
||||
ty::BrAnon(_) => {}
|
||||
_ => {
|
||||
@ -75,26 +78,10 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
return None;
|
||||
}
|
||||
|
||||
if let Some((_, fndecl)) = find_anon_type(self.tcx(), anon, &br) {
|
||||
if self.is_self_anon(is_first, scope_def_id) {
|
||||
return None;
|
||||
}
|
||||
|
||||
if let FnRetTy::Return(ty) = &fndecl.output {
|
||||
let mut v = ty::TraitObjectVisitor(vec![], self.tcx().hir());
|
||||
v.visit_ty(ty);
|
||||
|
||||
debug!("try_report_named_anon_conflict: ret ty {:?}", ty);
|
||||
if sub == &ty::ReStatic
|
||||
&& v.0.into_iter().any(|t| t.span.desugaring_kind().is_none())
|
||||
{
|
||||
// If the failure is due to a `'static` requirement coming from a `dyn` or
|
||||
// `impl` Trait that *isn't* caused by `async fn` desugaring, handle this case
|
||||
// better in `static_impl_trait`.
|
||||
debug!("try_report_named_anon_conflict: impl Trait + 'static");
|
||||
return None;
|
||||
}
|
||||
}
|
||||
if find_anon_type(self.tcx(), anon, &br).is_some()
|
||||
&& self.is_self_anon(is_first, scope_def_id)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
let (error_var, span_label_var) = match param.pat.simple_ident() {
|
||||
@ -114,16 +101,12 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
);
|
||||
|
||||
diag.span_label(span, format!("lifetime `{}` required", named));
|
||||
// Suggesting `'static` is nearly always incorrect, and can steer users
|
||||
// down the wrong path.
|
||||
if *named != ty::ReStatic {
|
||||
diag.span_suggestion(
|
||||
new_ty_span,
|
||||
&format!("add explicit lifetime `{}` to {}", named, span_label_var),
|
||||
new_ty.to_string(),
|
||||
Applicability::Unspecified,
|
||||
);
|
||||
}
|
||||
diag.span_suggestion(
|
||||
new_ty_span,
|
||||
&format!("add explicit lifetime `{}` to {}", named, span_label_var),
|
||||
new_ty.to_string(),
|
||||
Applicability::Unspecified,
|
||||
);
|
||||
|
||||
Some(diag)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ use crate::traits::{Obligation, ObligationCause, PredicateObligation};
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
||||
use rustc_middle::ty::{self, ToPredicate, TyCtxt, WithConstness};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn anonymize_predicate<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
@ -97,6 +98,22 @@ pub fn elaborate_predicates<'tcx>(
|
||||
elaborate_obligations(tcx, obligations)
|
||||
}
|
||||
|
||||
pub fn elaborate_predicates_with_span<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
predicates: impl Iterator<Item = (ty::Predicate<'tcx>, Span)>,
|
||||
) -> Elaborator<'tcx> {
|
||||
let obligations = predicates
|
||||
.map(|(predicate, span)| {
|
||||
predicate_obligation(
|
||||
predicate,
|
||||
ty::ParamEnv::empty(),
|
||||
ObligationCause::dummy_with_span(span),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
elaborate_obligations(tcx, obligations)
|
||||
}
|
||||
|
||||
pub fn elaborate_obligations<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
mut obligations: Vec<PredicateObligation<'tcx>>,
|
||||
|
@ -82,6 +82,33 @@ pub(crate) fn emit_unescape_error(
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
let printable: Vec<char> = lit
|
||||
.chars()
|
||||
.filter(|&x| {
|
||||
unicode_width::UnicodeWidthChar::width(x).unwrap_or(0) != 0
|
||||
&& !x.is_whitespace()
|
||||
})
|
||||
.collect();
|
||||
|
||||
if let [ch] = printable.as_slice() {
|
||||
has_help = true;
|
||||
|
||||
handler.span_note(
|
||||
span,
|
||||
&format!(
|
||||
"there are non-printing characters, the full sequence is `{}`",
|
||||
lit.escape_default(),
|
||||
),
|
||||
);
|
||||
|
||||
handler.span_suggestion(
|
||||
span,
|
||||
"consider removing the non-printing characters",
|
||||
ch.to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if !has_help {
|
||||
|
@ -112,6 +112,7 @@ impl CheckAttrVisitor<'tcx> {
|
||||
self.check_default_method_body_is_const(attr, span, target)
|
||||
}
|
||||
sym::must_not_suspend => self.check_must_not_suspend(&attr, span, target),
|
||||
sym::must_use => self.check_must_use(hir_id, &attr, span, target),
|
||||
sym::rustc_const_unstable
|
||||
| sym::rustc_const_stable
|
||||
| sym::unstable
|
||||
@ -1046,6 +1047,37 @@ impl CheckAttrVisitor<'tcx> {
|
||||
is_valid
|
||||
}
|
||||
|
||||
/// Warns against some misuses of `#[must_use]`
|
||||
fn check_must_use(
|
||||
&self,
|
||||
hir_id: HirId,
|
||||
attr: &Attribute,
|
||||
span: &Span,
|
||||
_target: Target,
|
||||
) -> bool {
|
||||
let node = self.tcx.hir().get(hir_id);
|
||||
if let Some(fn_node) = node.fn_kind() {
|
||||
if let rustc_hir::IsAsync::Async = fn_node.asyncness() {
|
||||
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
|
||||
lint.build(
|
||||
"`must_use` attribute on `async` functions \
|
||||
applies to the anonymous `Future` returned by the \
|
||||
function, not the value within",
|
||||
)
|
||||
.span_label(
|
||||
*span,
|
||||
"this attribute does nothing, the `Future`s \
|
||||
returned by async functions are already `must_use`",
|
||||
)
|
||||
.emit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// For now, its always valid
|
||||
true
|
||||
}
|
||||
|
||||
/// Checks if `#[must_not_suspend]` is applied to a function. Returns `true` if valid.
|
||||
fn check_must_not_suspend(&self, attr: &Attribute, span: &Span, target: Target) -> bool {
|
||||
match target {
|
||||
|
@ -65,7 +65,8 @@ pub use self::specialize::{specialization_graph, translate_substs, OverlapError}
|
||||
pub use self::structural_match::search_for_structural_match_violation;
|
||||
pub use self::structural_match::NonStructuralMatchTy;
|
||||
pub use self::util::{
|
||||
elaborate_obligations, elaborate_predicates, elaborate_trait_ref, elaborate_trait_refs,
|
||||
elaborate_obligations, elaborate_predicates, elaborate_predicates_with_span,
|
||||
elaborate_trait_ref, elaborate_trait_refs,
|
||||
};
|
||||
pub use self::util::{expand_trait_aliases, TraitAliasExpander};
|
||||
pub use self::util::{
|
||||
|
@ -371,16 +371,26 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
|
||||
let param_env = tcx.param_env(item_def_id);
|
||||
for field in fields {
|
||||
let field_ty = field.ty(tcx, substs);
|
||||
// We are currently checking the type this field came from, so it must be local.
|
||||
let field_span = tcx.hir().span_if_local(field.did).unwrap();
|
||||
if field_ty.needs_drop(tcx, param_env) {
|
||||
let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {
|
||||
// We are currently checking the type this field came from, so it must be local.
|
||||
Some(Node::Field(field)) => (field.span, field.ty.span),
|
||||
_ => unreachable!("mir field has to correspond to hir field"),
|
||||
};
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
field_span,
|
||||
E0740,
|
||||
"unions may not contain fields that need dropping"
|
||||
)
|
||||
.span_note(field_span, "`std::mem::ManuallyDrop` can be used to wrap the type")
|
||||
.multipart_suggestion_verbose(
|
||||
"wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped",
|
||||
vec![
|
||||
(ty_span.shrink_to_lo(), format!("std::mem::ManuallyDrop<")),
|
||||
(ty_span.shrink_to_hi(), ">".into()),
|
||||
],
|
||||
Applicability::MaybeIncorrect,
|
||||
)
|
||||
.emit();
|
||||
return false;
|
||||
}
|
||||
|
@ -1641,19 +1641,38 @@ fn report_bivariance(tcx: TyCtxt<'_>, param: &rustc_hir::GenericParam<'_>) {
|
||||
|
||||
/// Feature gates RFC 2056 -- trivial bounds, checking for global bounds that
|
||||
/// aren't true.
|
||||
fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
|
||||
fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, mut span: Span, id: hir::HirId) {
|
||||
let empty_env = ty::ParamEnv::empty();
|
||||
|
||||
let def_id = fcx.tcx.hir().local_def_id(id);
|
||||
let predicates = fcx.tcx.predicates_of(def_id).predicates.iter().map(|(p, _)| *p);
|
||||
let predicates_with_span =
|
||||
fcx.tcx.predicates_of(def_id).predicates.iter().map(|(p, span)| (*p, *span));
|
||||
// Check elaborated bounds.
|
||||
let implied_obligations = traits::elaborate_predicates(fcx.tcx, predicates);
|
||||
let implied_obligations = traits::elaborate_predicates_with_span(fcx.tcx, predicates_with_span);
|
||||
|
||||
for obligation in implied_obligations {
|
||||
let pred = obligation.predicate;
|
||||
// Match the existing behavior.
|
||||
if pred.is_global(fcx.tcx) && !pred.has_late_bound_regions() {
|
||||
let pred = fcx.normalize_associated_types_in(span, pred);
|
||||
let hir_node = fcx.tcx.hir().find(id);
|
||||
|
||||
// only use the span of the predicate clause (#90869)
|
||||
|
||||
if let Some(hir::Generics { where_clause, .. }) =
|
||||
hir_node.and_then(|node| node.generics())
|
||||
{
|
||||
let obligation_span = obligation.cause.span(fcx.tcx);
|
||||
|
||||
span = where_clause
|
||||
.predicates
|
||||
.iter()
|
||||
// There seems to be no better way to find out which predicate we are in
|
||||
.find(|pred| pred.span().contains(obligation_span))
|
||||
.map(|pred| pred.span())
|
||||
.unwrap_or(obligation_span);
|
||||
}
|
||||
|
||||
let obligation = traits::Obligation::new(
|
||||
traits::ObligationCause::new(span, id, traits::TrivialBound),
|
||||
empty_env,
|
||||
|
@ -1444,6 +1444,34 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
pub fn retain<F>(&mut self, mut f: F)
|
||||
where
|
||||
F: FnMut(&T) -> bool,
|
||||
{
|
||||
self.retain_mut(|elem| f(elem));
|
||||
}
|
||||
|
||||
/// Retains only the elements specified by the predicate, passing a mutable reference to it.
|
||||
///
|
||||
/// In other words, remove all elements `e` such that `f(&mut e)` returns `false`.
|
||||
/// This method operates in place, visiting each element exactly once in the
|
||||
/// original order, and preserves the order of the retained elements.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(vec_retain_mut)]
|
||||
///
|
||||
/// let mut vec = vec![1, 2, 3, 4];
|
||||
/// vec.retain_mut(|x| if *x > 3 {
|
||||
/// false
|
||||
/// } else {
|
||||
/// *x += 1;
|
||||
/// true
|
||||
/// });
|
||||
/// assert_eq!(vec, [2, 3, 4]);
|
||||
/// ```
|
||||
#[unstable(feature = "vec_retain_mut", issue = "90829")]
|
||||
pub fn retain_mut<F>(&mut self, mut f: F)
|
||||
where
|
||||
F: FnMut(&mut T) -> bool,
|
||||
{
|
||||
let original_len = self.len();
|
||||
// Avoid double drop if the drop guard is not executed,
|
||||
@ -1496,7 +1524,7 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
g: &mut BackshiftOnDrop<'_, T, A>,
|
||||
) -> bool
|
||||
where
|
||||
F: FnMut(&T) -> bool,
|
||||
F: FnMut(&mut T) -> bool,
|
||||
{
|
||||
// SAFETY: Unchecked element must be valid.
|
||||
let cur = unsafe { &mut *g.v.as_mut_ptr().add(g.processed_len) };
|
||||
|
@ -36,6 +36,7 @@ use crate::panic::{Location, PanicInfo};
|
||||
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
|
||||
#[cfg_attr(feature = "panic_immediate_abort", inline)]
|
||||
#[track_caller]
|
||||
#[rustc_const_unstable(feature = "core_panic", issue = "none")]
|
||||
#[lang = "panic"] // needed by codegen for panic on overflow and other `Assert` MIR terminators
|
||||
pub const fn panic(expr: &'static str) -> ! {
|
||||
// Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially
|
||||
|
@ -727,7 +727,7 @@ impl Duration {
|
||||
pub const fn from_secs_f64(secs: f64) -> Duration {
|
||||
match Duration::try_from_secs_f64(secs) {
|
||||
Ok(v) => v,
|
||||
Err(e) => crate::panicking::panic(e.description()),
|
||||
Err(e) => panic!("{}", e.description()),
|
||||
}
|
||||
}
|
||||
|
||||
@ -788,7 +788,7 @@ impl Duration {
|
||||
pub const fn from_secs_f32(secs: f32) -> Duration {
|
||||
match Duration::try_from_secs_f32(secs) {
|
||||
Ok(v) => v,
|
||||
Err(e) => crate::panicking::panic(e.description()),
|
||||
Err(e) => panic!("{}", e.description()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,18 @@
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
error[E0521]: borrowed data escapes outside of function
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
||||
|
|
||||
LL | fn foo(x: &()) {
|
||||
| - - let's call the lifetime of this reference `'1`
|
||||
| |
|
||||
| `x` is a reference that is only valid in the function body
|
||||
LL | / bar(|| {
|
||||
LL | |
|
||||
LL | | let _ = x;
|
||||
LL | | })
|
||||
| |______^ lifetime `'static` required
|
||||
| | ^
|
||||
| | |
|
||||
| |______`x` escapes the function body here
|
||||
| argument requires that `'1` must outlive `'static`
|
||||
|
||||
error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
|
||||
@ -31,5 +38,5 @@ LL | bar(move || {
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0373, E0621.
|
||||
Some errors have detailed explanations: E0373, E0521.
|
||||
For more information about an error, try `rustc --explain E0373`.
|
||||
|
@ -3,7 +3,7 @@ fn bar<F>(blk: F) where F: FnOnce() + 'static {
|
||||
|
||||
fn foo(x: &()) {
|
||||
bar(|| {
|
||||
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
|
||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
let _ = x;
|
||||
})
|
||||
}
|
||||
|
@ -1,9 +1,21 @@
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
|
||||
|
|
||||
LL | fn foo(x: &()) {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
LL | bar(|| {
|
||||
| _________^
|
||||
LL | |
|
||||
LL | | let _ = x;
|
||||
LL | | })
|
||||
| |_____^ ...is captured here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
||||
|
|
||||
LL | bar(|| {
|
||||
| ^^^ lifetime `'static` required
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
@ -9,11 +9,10 @@ trait Bar {}
|
||||
impl Bar for [u16; 4] {}
|
||||
impl Bar for [[u16; 3]; 3] {}
|
||||
|
||||
trait Foo //~ ERROR the trait bound `[u16; 3]: Bar` is not satisfied [E0277]
|
||||
//~^ ERROR the trait bound `[[u16; 3]; 2]: Bar` is not satisfied [E0277]
|
||||
where
|
||||
[<u8 as Baz>::Quaks; 2]: Bar,
|
||||
<u8 as Baz>::Quaks: Bar,
|
||||
trait Foo
|
||||
where
|
||||
[<u8 as Baz>::Quaks; 2]: Bar, //~ ERROR the trait bound `[[u16; 3]; 2]: Bar` is not satisfied [E0277]
|
||||
<u8 as Baz>::Quaks: Bar, //~ ERROR the trait bound `[u16; 3]: Bar` is not satisfied [E0277]
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,8 @@
|
||||
error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
|
||||
--> $DIR/issue-67185-2.rs:12:1
|
||||
--> $DIR/issue-67185-2.rs:15:5
|
||||
|
|
||||
LL | / trait Foo
|
||||
LL | |
|
||||
LL | | where
|
||||
LL | | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
LL | | <u8 as Baz>::Quaks: Bar,
|
||||
LL | | {
|
||||
LL | | }
|
||||
| |_^ the trait `Bar` is not implemented for `[u16; 3]`
|
||||
LL | <u8 as Baz>::Quaks: Bar,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<[[u16; 3]; 3] as Bar>
|
||||
@ -17,16 +11,10 @@ LL | | }
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
|
||||
--> $DIR/issue-67185-2.rs:12:1
|
||||
--> $DIR/issue-67185-2.rs:14:5
|
||||
|
|
||||
LL | / trait Foo
|
||||
LL | |
|
||||
LL | | where
|
||||
LL | | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
LL | | <u8 as Baz>::Quaks: Bar,
|
||||
LL | | {
|
||||
LL | | }
|
||||
| |_^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
||||
LL | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<[[u16; 3]; 3] as Bar>
|
||||
@ -35,7 +23,7 @@ LL | | }
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
|
||||
--> $DIR/issue-67185-2.rs:22:6
|
||||
--> $DIR/issue-67185-2.rs:21:6
|
||||
|
|
||||
LL | impl Foo for FooImpl {}
|
||||
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
||||
@ -44,16 +32,16 @@ LL | impl Foo for FooImpl {}
|
||||
<[[u16; 3]; 3] as Bar>
|
||||
<[u16; 4] as Bar>
|
||||
note: required by a bound in `Foo`
|
||||
--> $DIR/issue-67185-2.rs:16:29
|
||||
--> $DIR/issue-67185-2.rs:15:25
|
||||
|
|
||||
LL | trait Foo
|
||||
| --- required by a bound in this
|
||||
...
|
||||
LL | <u8 as Baz>::Quaks: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
LL | <u8 as Baz>::Quaks: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
|
||||
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
|
||||
--> $DIR/issue-67185-2.rs:22:6
|
||||
--> $DIR/issue-67185-2.rs:21:6
|
||||
|
|
||||
LL | impl Foo for FooImpl {}
|
||||
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
||||
@ -62,16 +50,16 @@ LL | impl Foo for FooImpl {}
|
||||
<[[u16; 3]; 3] as Bar>
|
||||
<[u16; 4] as Bar>
|
||||
note: required by a bound in `Foo`
|
||||
--> $DIR/issue-67185-2.rs:15:34
|
||||
--> $DIR/issue-67185-2.rs:14:30
|
||||
|
|
||||
LL | trait Foo
|
||||
| --- required by a bound in this
|
||||
...
|
||||
LL | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
LL | where
|
||||
LL | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
|
||||
error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
|
||||
--> $DIR/issue-67185-2.rs:26:14
|
||||
--> $DIR/issue-67185-2.rs:25:14
|
||||
|
|
||||
LL | fn f(_: impl Foo) {}
|
||||
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
||||
@ -80,16 +68,16 @@ LL | fn f(_: impl Foo) {}
|
||||
<[[u16; 3]; 3] as Bar>
|
||||
<[u16; 4] as Bar>
|
||||
note: required by a bound in `Foo`
|
||||
--> $DIR/issue-67185-2.rs:15:34
|
||||
--> $DIR/issue-67185-2.rs:14:30
|
||||
|
|
||||
LL | trait Foo
|
||||
| --- required by a bound in this
|
||||
...
|
||||
LL | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
LL | where
|
||||
LL | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
|
||||
error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
|
||||
--> $DIR/issue-67185-2.rs:26:14
|
||||
--> $DIR/issue-67185-2.rs:25:14
|
||||
|
|
||||
LL | fn f(_: impl Foo) {}
|
||||
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
||||
@ -98,13 +86,13 @@ LL | fn f(_: impl Foo) {}
|
||||
<[[u16; 3]; 3] as Bar>
|
||||
<[u16; 4] as Bar>
|
||||
note: required by a bound in `Foo`
|
||||
--> $DIR/issue-67185-2.rs:16:29
|
||||
--> $DIR/issue-67185-2.rs:15:25
|
||||
|
|
||||
LL | trait Foo
|
||||
| --- required by a bound in this
|
||||
...
|
||||
LL | <u8 as Baz>::Quaks: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
LL | <u8 as Baz>::Quaks: Bar,
|
||||
| ^^^ required by this bound in `Foo`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
warning: panic message is not a string literal
|
||||
--> $DIR/const_panic_stability.rs:14:12
|
||||
|
|
||||
LL | panic!({ "foo" });
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(non_fmt_panics)]` on by default
|
||||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
|
||||
help: add a "{}" format string to Display the message
|
||||
|
|
||||
LL | panic!("{}", { "foo" });
|
||||
| +++++
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
@ -0,0 +1,13 @@
|
||||
error: format argument must be a string literal
|
||||
--> $DIR/const_panic_stability.rs:14:12
|
||||
|
|
||||
LL | panic!({ "foo" });
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
help: you might be missing a string literal to format with
|
||||
|
|
||||
LL | panic!("{}", { "foo" });
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
17
src/test/ui/consts/const-eval/const_panic_stability.rs
Normal file
17
src/test/ui/consts/const-eval/const_panic_stability.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// revisions: e2018 e2021
|
||||
//[e2018] edition:2018
|
||||
//[e2021] edition:2021
|
||||
//[e2018] check-pass
|
||||
#![crate_type = "lib"]
|
||||
#![stable(feature = "foo", since = "1.0.0")]
|
||||
#![feature(staged_api)]
|
||||
|
||||
#[stable(feature = "foo", since = "1.0.0")]
|
||||
#[rustc_const_stable(feature = "foo", since = "1.0.0")]
|
||||
const fn foo() {
|
||||
assert!(false);
|
||||
assert!(false, "foo");
|
||||
panic!({ "foo" });
|
||||
//[e2018]~^ WARNING panic message is not a string literal
|
||||
//[e2021]~^^ ERROR format argument must be a string literal
|
||||
}
|
@ -12,8 +12,8 @@ trait Bar<X> { }
|
||||
|
||||
// We don't always check where clauses for sanity, but in this case
|
||||
// wfcheck does report an error here:
|
||||
fn vacuous<A>() //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied
|
||||
where i32: Foo<u32, A>
|
||||
fn vacuous<A>()
|
||||
where i32: Foo<u32, A> //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied
|
||||
{
|
||||
// ... the original intention was to check that we don't use that
|
||||
// vacuous where clause (which could never be satisfied) to accept
|
||||
|
@ -1,14 +1,8 @@
|
||||
error[E0277]: the trait bound `i32: Bar<u32>` is not satisfied
|
||||
--> $DIR/cross-fn-cache-hole.rs:15:1
|
||||
--> $DIR/cross-fn-cache-hole.rs:16:11
|
||||
|
|
||||
LL | / fn vacuous<A>()
|
||||
LL | | where i32: Foo<u32, A>
|
||||
LL | | {
|
||||
LL | | // ... the original intention was to check that we don't use that
|
||||
... |
|
||||
LL | | require::<i32, u32>();
|
||||
LL | | }
|
||||
| |_^ the trait `Bar<u32>` is not implemented for `i32`
|
||||
LL | where i32: Foo<u32, A>
|
||||
| ^^^^^^^^^^^^^^^^ the trait `Bar<u32>` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
@ -1,87 +1,71 @@
|
||||
error[E0277]: the trait bound `i32: Foo` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:10:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:10:14
|
||||
|
|
||||
LL | enum E where i32: Foo { V }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `i32: Foo` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:12:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:12:16
|
||||
|
|
||||
LL | struct S where i32: Foo;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `i32: Foo` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:14:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:14:15
|
||||
|
|
||||
LL | trait T where i32: Foo {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `i32: Foo` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:16:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:16:15
|
||||
|
|
||||
LL | union U where i32: Foo { f: i32 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `i32: Foo` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:20:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:20:23
|
||||
|
|
||||
LL | / impl Foo for () where i32: Foo {
|
||||
LL | | fn test(&self) {
|
||||
LL | | 3i32.test();
|
||||
LL | | Foo::test(&4i32);
|
||||
LL | | generic_function(5i32);
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^ the trait `Foo` is not implemented for `i32`
|
||||
LL | impl Foo for () where i32: Foo {
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `i32: Foo` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:28:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:28:14
|
||||
|
|
||||
LL | / fn f() where i32: Foo
|
||||
LL | | {
|
||||
LL | | let s = S;
|
||||
LL | | 3i32.test();
|
||||
LL | | Foo::test(&4i32);
|
||||
LL | | generic_function(5i32);
|
||||
LL | | }
|
||||
| |_^ the trait `Foo` is not implemented for `i32`
|
||||
LL | fn f() where i32: Foo
|
||||
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `String: Neg` is not satisfied
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:36:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:36:38
|
||||
|
|
||||
LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> {
|
||||
LL | | -s
|
||||
LL | | }
|
||||
| |_^ the trait `Neg` is not implemented for `String`
|
||||
LL | fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Neg` is not implemented for `String`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: `i32` is not an iterator
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:40:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:40:20
|
||||
|
|
||||
LL | / fn use_for() where i32: Iterator {
|
||||
LL | | for _ in 2i32 {}
|
||||
LL | | }
|
||||
| |_^ `i32` is not an iterator
|
||||
LL | fn use_for() where i32: Iterator {
|
||||
| ^^^^^^^^^^^^^ `i32` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `i32`
|
||||
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||
@ -89,22 +73,20 @@ LL | | }
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:52:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:52:32
|
||||
|
|
||||
LL | struct TwoStrs(str, str) where str: Sized;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
= help: see issue #48214
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:55:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:55:26
|
||||
|
|
||||
LL | / fn unsized_local() where Dst<dyn A>: Sized {
|
||||
LL | | let x: Dst<dyn A> = *(Box::new(Dst { x: 1 }) as Box<Dst<dyn A>>);
|
||||
LL | | }
|
||||
| |_^ doesn't have a size known at compile-time
|
||||
LL | fn unsized_local() where Dst<dyn A>: Sized {
|
||||
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)`
|
||||
note: required because it appears within the type `Dst<(dyn A + 'static)>`
|
||||
@ -116,12 +98,10 @@ LL | struct Dst<X: ?Sized> {
|
||||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:59:1
|
||||
--> $DIR/feature-gate-trivial_bounds.rs:59:30
|
||||
|
|
||||
LL | / fn return_str() -> str where str: Sized {
|
||||
LL | | *"Sized".to_string().into_boxed_str()
|
||||
LL | | }
|
||||
| |_^ doesn't have a size known at compile-time
|
||||
LL | fn return_str() -> str where str: Sized {
|
||||
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
= help: see issue #48214
|
||||
|
@ -13,11 +13,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: String,
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/feature-gate-untagged_unions.rs:16:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: String,
|
||||
| ^^^^^^^^^
|
||||
LL | a: std::mem::ManuallyDrop<String>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: unions may not contain fields that need dropping
|
||||
--> $DIR/feature-gate-untagged_unions.rs:24:5
|
||||
@ -25,11 +24,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: T,
|
||||
| ^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/feature-gate-untagged_unions.rs:24:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: T,
|
||||
| ^^^^
|
||||
LL | a: std::mem::ManuallyDrop<T>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/generator-region-requirements.rs:13:51
|
||||
|
|
||||
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
...
|
||||
LL | GeneratorState::Complete(c) => return c,
|
||||
| ^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -6,11 +6,11 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
|
||||
let mut g = || {
|
||||
yield;
|
||||
x
|
||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
};
|
||||
loop {
|
||||
match Pin::new(&mut g).resume(()) {
|
||||
GeneratorState::Complete(c) => return c,
|
||||
//~^ ERROR explicit lifetime required
|
||||
GeneratorState::Yielded(_) => (),
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
--> $DIR/generator-region-requirements.rs:12:51
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/generator-region-requirements.rs:8:9
|
||||
|
|
||||
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
|
||||
| -------- this data with an anonymous lifetime `'_`...
|
||||
...
|
||||
LL | x
|
||||
| ^ ...is captured here...
|
||||
...
|
||||
LL | GeneratorState::Complete(c) => return c,
|
||||
| ^ lifetime `'static` required
|
||||
| - ...and is required to live as long as `'static` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
@ -0,0 +1,26 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:17:5
|
||||
|
|
||||
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | x.m()
|
||||
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:22:5
|
||||
|
|
||||
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | x.m()
|
||||
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:27:5
|
||||
|
|
||||
LL | fn h(x: &()) -> &'static () {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | x.m()
|
||||
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -15,17 +15,17 @@ impl X for () {
|
||||
|
||||
fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
||||
x.m()
|
||||
//~^ ERROR explicit lifetime required
|
||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
}
|
||||
|
||||
fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
||||
x.m()
|
||||
//~^ ERROR explicit lifetime required
|
||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
}
|
||||
|
||||
fn h(x: &()) -> &'static () {
|
||||
x.m()
|
||||
//~^ ERROR explicit lifetime required
|
||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,21 +1,27 @@
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:17:5
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:17:7
|
||||
|
|
||||
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
||||
| ------------------------------- this data with an anonymous lifetime `'_`...
|
||||
LL | x.m()
|
||||
| ^^^^^ lifetime `'static` required
|
||||
| --^-- ...is captured and required to live as long as `'static` here
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:22:5
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:22:7
|
||||
|
|
||||
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
||||
| -- this data with an anonymous lifetime `'_`...
|
||||
LL | x.m()
|
||||
| ^^^^^ lifetime `'static` required
|
||||
| --^-- ...is captured and required to live as long as `'static` here
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:27:5
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/projection-type-lifetime-mismatch.rs:27:7
|
||||
|
|
||||
LL | fn h(x: &()) -> &'static () {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
LL | x.m()
|
||||
| ^^^^^ lifetime `'static` required
|
||||
| --^-- ...is captured and required to live as long as `'static` here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
10
src/test/ui/issues/issue-46983.nll.stderr
Normal file
10
src/test/ui/issues/issue-46983.nll.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/issue-46983.rs:2:5
|
||||
|
|
||||
LL | fn foo(x: &u32) -> &'static u32 {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | &*x
|
||||
| ^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn foo(x: &u32) -> &'static u32 {
|
||||
&*x
|
||||
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
|
||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,9 +1,11 @@
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/issue-46983.rs:2:5
|
||||
|
|
||||
LL | fn foo(x: &u32) -> &'static u32 {
|
||||
| ---- this data with an anonymous lifetime `'_`...
|
||||
LL | &*x
|
||||
| ^^^ lifetime `'static` required
|
||||
| ^^^ ...is captured and required to live as long as `'static` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
@ -0,0 +1,24 @@
|
||||
error[E0597]: `foo` does not live long enough
|
||||
--> $DIR/issue-90600-expected-return-static-indirect.rs:7:32
|
||||
|
|
||||
LL | let refcell = RefCell::new(&mut foo);
|
||||
| ^^^^^^^^ borrowed value does not live long enough
|
||||
LL |
|
||||
LL | let read = &refcell as &RefCell<dyn Read>;
|
||||
| -------- cast requires that `foo` is borrowed for `'static`
|
||||
...
|
||||
LL | }
|
||||
| - `foo` dropped here while still borrowed
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/issue-90600-expected-return-static-indirect.rs:9:16
|
||||
|
|
||||
LL | fn inner(mut foo: &[u8]) {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
...
|
||||
LL | let read = &refcell as &RefCell<dyn Read>;
|
||||
| ^^^^^^^^ cast requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
@ -0,0 +1,14 @@
|
||||
use std::cell::RefCell;
|
||||
use std::io::Read;
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn inner(mut foo: &[u8]) {
|
||||
let refcell = RefCell::new(&mut foo);
|
||||
//~^ ERROR `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
let read = &refcell as &RefCell<dyn Read>;
|
||||
|
||||
read_thing(read);
|
||||
}
|
||||
|
||||
fn read_thing(refcell: &RefCell<dyn Read>) {}
|
@ -0,0 +1,14 @@
|
||||
error[E0759]: `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/issue-90600-expected-return-static-indirect.rs:7:32
|
||||
|
|
||||
LL | fn inner(mut foo: &[u8]) {
|
||||
| ----- this data with an anonymous lifetime `'_`...
|
||||
LL | let refcell = RefCell::new(&mut foo);
|
||||
| ^^^^^^^^ ...is captured here...
|
||||
...
|
||||
LL | read_thing(read);
|
||||
| ---- ...and is required to live as long as `'static` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
43
src/test/ui/lint/unused/unused-async.rs
Normal file
43
src/test/ui/lint/unused/unused-async.rs
Normal file
@ -0,0 +1,43 @@
|
||||
// edition:2018
|
||||
// run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[must_use]
|
||||
//~^ WARNING `must_use`
|
||||
async fn test() -> i32 {
|
||||
1
|
||||
}
|
||||
|
||||
|
||||
struct Wowee {}
|
||||
|
||||
impl Wowee {
|
||||
#[must_use]
|
||||
//~^ WARNING `must_use`
|
||||
async fn test_method() -> i32 {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME(guswynn) update this test when async-fn-in-traits works
|
||||
trait Doer {
|
||||
#[must_use]
|
||||
async fn test_trait_method() -> i32;
|
||||
WARNING must_use
|
||||
async fn test_other_trait() -> i32;
|
||||
}
|
||||
|
||||
impl Doer for Wowee {
|
||||
async fn test_trait_method() -> i32 {
|
||||
1
|
||||
}
|
||||
#[must_use]
|
||||
async fn test_other_trait() -> i32 {
|
||||
WARNING must_use
|
||||
1
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
}
|
26
src/test/ui/lint/unused/unused-async.stderr
Normal file
26
src/test/ui/lint/unused/unused-async.stderr
Normal file
@ -0,0 +1,26 @@
|
||||
warning: `must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within
|
||||
--> $DIR/unused-async.rs:5:1
|
||||
|
|
||||
LL | #[must_use]
|
||||
| ^^^^^^^^^^^
|
||||
LL |
|
||||
LL | / async fn test() -> i32 {
|
||||
LL | | 1
|
||||
LL | | }
|
||||
| |_- this attribute does nothing, the `Future`s returned by async functions are already `must_use`
|
||||
|
|
||||
= note: `#[warn(unused_attributes)]` on by default
|
||||
|
||||
warning: `must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within
|
||||
--> $DIR/unused-async.rs:15:5
|
||||
|
|
||||
LL | #[must_use]
|
||||
| ^^^^^^^^^^^
|
||||
LL |
|
||||
LL | / async fn test_method() -> i32 {
|
||||
LL | | 1
|
||||
LL | | }
|
||||
| |_____- this attribute does nothing, the `Future`s returned by async functions are already `must_use`
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
fn foo(x: &u32) -> &'static u32 {
|
||||
&*x
|
||||
//~^ ERROR explicit lifetime required in the type of `x`
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,9 +1,10 @@
|
||||
error[E0621]: explicit lifetime required in the type of `x`
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:9:5
|
||||
|
|
||||
LL | fn foo(x: &u32) -> &'static u32 {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | &*x
|
||||
| ^^^ lifetime `ReStatic` required
|
||||
| ^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
|
@ -12,7 +12,7 @@ fn foo(s: &mut (i32,)) -> i32 {
|
||||
|
||||
fn bar(s: &Box<(i32,)>) -> &'static i32 {
|
||||
// FIXME(#46983): error message should be better
|
||||
&s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621]
|
||||
&s.0 //~ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -9,13 +9,15 @@ LL | *s = (2,);
|
||||
LL | *x
|
||||
| -- borrow later used here
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `s`
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/guarantor-issue-46974.rs:15:5
|
||||
|
|
||||
LL | fn bar(s: &Box<(i32,)>) -> &'static i32 {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | // FIXME(#46983): error message should be better
|
||||
LL | &s.0
|
||||
| ^^^^ lifetime `'static` required
|
||||
| ^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0506, E0621.
|
||||
For more information about an error, try `rustc --explain E0506`.
|
||||
For more information about this error, try `rustc --explain E0506`.
|
||||
|
10
src/test/ui/parser/char/whitespace-character-literal.rs
Normal file
10
src/test/ui/parser/char/whitespace-character-literal.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// This tests that the error generated when a character literal has multiple
|
||||
// characters in it contains a note about non-printing characters.
|
||||
|
||||
fn main() {
|
||||
let _hair_space_around = ' x';
|
||||
//~^ ERROR: character literal may only contain one codepoint
|
||||
//~| NOTE: there are non-printing characters, the full sequence is `\u{200a}x\u{200b}`
|
||||
//~| HELP: consider removing the non-printing characters
|
||||
//~| SUGGESTION: x
|
||||
}
|
16
src/test/ui/parser/char/whitespace-character-literal.stderr
Normal file
16
src/test/ui/parser/char/whitespace-character-literal.stderr
Normal file
@ -0,0 +1,16 @@
|
||||
error: character literal may only contain one codepoint
|
||||
--> $DIR/whitespace-character-literal.rs:5:30
|
||||
|
|
||||
LL | let _hair_space_around = ' x';
|
||||
| ^--^
|
||||
| |
|
||||
| help: consider removing the non-printing characters: `x`
|
||||
|
|
||||
note: there are non-printing characters, the full sequence is `\u{200a}x\u{200b}`
|
||||
--> $DIR/whitespace-character-literal.rs:5:31
|
||||
|
|
||||
LL | let _hair_space_around = ' x';
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,28 +0,0 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/regions-static-bound.rs:9:5
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | t //[ll]~ ERROR E0312
|
||||
| ^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `u`
|
||||
--> $DIR/regions-static-bound.rs:14:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
|
||||
LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
|
||||
| ^^^^^^^^^^^^^ lifetime `'static` required
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `v`
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
|
||||
...
|
||||
LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
@ -1,23 +0,0 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/regions-static-bound.rs:9:5
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | t
|
||||
| ^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `u`
|
||||
--> $DIR/regions-static-bound.rs:14:5
|
||||
|
|
||||
LL | static_id(&u);
|
||||
| ^^^^^^^^^^^^^ lifetime `'static` required
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `v`
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
|
|
||||
LL | static_id_indirect(&v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
@ -1,29 +0,0 @@
|
||||
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
||||
--> $DIR/regions-static-bound.rs:9:5
|
||||
|
|
||||
LL | t
|
||||
| ^
|
||||
|
|
||||
= note: ...the reference is valid for the static lifetime...
|
||||
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
|
||||
--> $DIR/regions-static-bound.rs:8:24
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| ^^
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `u`
|
||||
--> $DIR/regions-static-bound.rs:14:5
|
||||
|
|
||||
LL | static_id(&u);
|
||||
| ^^^^^^^^^ lifetime `'static` required
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `v`
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
|
|
||||
LL | static_id_indirect(&v);
|
||||
| ^^^^^^^^^^^^^^^^^^ lifetime `'static` required
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0312, E0621.
|
||||
For more information about an error, try `rustc --explain E0312`.
|
@ -1,23 +1,38 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/regions-static-bound.rs:9:5
|
||||
--> $DIR/regions-static-bound.rs:6:5
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | t
|
||||
| ^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `u`
|
||||
--> $DIR/regions-static-bound.rs:14:5
|
||||
error[E0521]: borrowed data escapes outside of function
|
||||
--> $DIR/regions-static-bound.rs:10:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| - - let's call the lifetime of this reference `'1`
|
||||
| |
|
||||
| `u` is a reference that is only valid in the function body
|
||||
LL | static_id(&u);
|
||||
| ^^^^^^^^^^^^^ lifetime `'static` required
|
||||
| ^^^^^^^^^^^^^
|
||||
| |
|
||||
| `u` escapes the function body here
|
||||
| argument requires that `'1` must outlive `'static`
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `v`
|
||||
--> $DIR/regions-static-bound.rs:16:5
|
||||
error[E0521]: borrowed data escapes outside of function
|
||||
--> $DIR/regions-static-bound.rs:11:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| - - let's call the lifetime of this reference `'2`
|
||||
| |
|
||||
| `v` is a reference that is only valid in the function body
|
||||
LL | static_id(&u);
|
||||
LL | static_id_indirect(&v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `v` escapes the function body here
|
||||
| argument requires that `'2` must outlive `'static`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
For more information about this error, try `rustc --explain E0521`.
|
||||
|
@ -1,20 +1,14 @@
|
||||
// revisions: migrate nll
|
||||
//[nll] compile-flags:-Zborrowck=mir
|
||||
|
||||
fn static_id<'a,'b>(t: &'a ()) -> &'static ()
|
||||
where 'a: 'static { t }
|
||||
fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
|
||||
where 'a: 'b, 'b: 'static { t }
|
||||
fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
t //[migrate]~ ERROR E0312
|
||||
//[nll]~^ ERROR lifetime may not live long enough
|
||||
t //~ ERROR E0312
|
||||
}
|
||||
|
||||
fn error(u: &(), v: &()) {
|
||||
static_id(&u); //[migrate]~ ERROR explicit lifetime required in the type of `u` [E0621]
|
||||
//[nll]~^ ERROR explicit lifetime required in the type of `u` [E0621]
|
||||
static_id_indirect(&v); //[migrate]~ ERROR explicit lifetime required in the type of `v` [E0621]
|
||||
//[nll]~^ ERROR explicit lifetime required in the type of `v` [E0621]
|
||||
static_id(&u); //~ ERROR `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
static_id_indirect(&v); //~ ERROR `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
46
src/test/ui/regions/regions-static-bound.stderr
Normal file
46
src/test/ui/regions/regions-static-bound.stderr
Normal file
@ -0,0 +1,46 @@
|
||||
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
||||
--> $DIR/regions-static-bound.rs:6:5
|
||||
|
|
||||
LL | t
|
||||
| ^
|
||||
|
|
||||
= note: ...the reference is valid for the static lifetime...
|
||||
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
|
||||
--> $DIR/regions-static-bound.rs:5:24
|
||||
|
|
||||
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
|
||||
| ^^
|
||||
|
||||
error[E0759]: `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/regions-static-bound.rs:10:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
LL | static_id(&u);
|
||||
| ^^^^^^^^^ -- ...is captured here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/regions-static-bound.rs:10:5
|
||||
|
|
||||
LL | static_id(&u);
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/regions-static-bound.rs:11:5
|
||||
|
|
||||
LL | fn error(u: &(), v: &()) {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
LL | static_id(&u);
|
||||
LL | static_id_indirect(&v);
|
||||
| ^^^^^^^^^^^^^^^^^^ -- ...is captured here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/regions-static-bound.rs:11:5
|
||||
|
|
||||
LL | static_id_indirect(&v);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0312, E0759.
|
||||
For more information about an error, try `rustc --explain E0312`.
|
@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: A,
|
||||
| ^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/issue-41073.rs:4:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: A,
|
||||
| ^^^^
|
||||
LL | a: std::mem::ManuallyDrop<A>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | bar: Bar,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-custom-drop.rs:7:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | bar: Bar,
|
||||
| ^^^^^^^^
|
||||
LL | bar: std::mem::ManuallyDrop<Bar>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: String,
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-with-drop-fields.rs:11:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: String,
|
||||
| ^^^^^^^^^
|
||||
LL | a: std::mem::ManuallyDrop<String>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: unions may not contain fields that need dropping
|
||||
--> $DIR/union-with-drop-fields.rs:19:5
|
||||
@ -16,11 +15,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: S,
|
||||
| ^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-with-drop-fields.rs:19:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: S,
|
||||
| ^^^^
|
||||
LL | a: std::mem::ManuallyDrop<S>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: unions may not contain fields that need dropping
|
||||
--> $DIR/union-with-drop-fields.rs:24:5
|
||||
@ -28,11 +26,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: T,
|
||||
| ^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-with-drop-fields.rs:24:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: T,
|
||||
| ^^^^
|
||||
LL | a: std::mem::ManuallyDrop<T>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -4,11 +4,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: String,
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-with-drop-fields.rs:11:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: String,
|
||||
| ^^^^^^^^^
|
||||
LL | a: std::mem::ManuallyDrop<String>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: unions may not contain fields that need dropping
|
||||
--> $DIR/union-with-drop-fields.rs:19:5
|
||||
@ -16,11 +15,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: S,
|
||||
| ^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-with-drop-fields.rs:19:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: S,
|
||||
| ^^^^
|
||||
LL | a: std::mem::ManuallyDrop<S>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0740]: unions may not contain fields that need dropping
|
||||
--> $DIR/union-with-drop-fields.rs:24:5
|
||||
@ -28,11 +26,10 @@ error[E0740]: unions may not contain fields that need dropping
|
||||
LL | a: T,
|
||||
| ^^^^
|
||||
|
|
||||
note: `std::mem::ManuallyDrop` can be used to wrap the type
|
||||
--> $DIR/union-with-drop-fields.rs:24:5
|
||||
help: wrap the type with `std::mem::ManuallyDrop` and ensure it is manually dropped
|
||||
|
|
||||
LL | a: T,
|
||||
| ^^^^
|
||||
LL | a: std::mem::ManuallyDrop<T>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -9,7 +9,7 @@ const ENTRY_LIMIT: usize = 1000;
|
||||
// FIXME: The following limits should be reduced eventually.
|
||||
const ROOT_ENTRY_LIMIT: usize = 1102;
|
||||
const ISSUES_ENTRY_LIMIT: usize = 2310;
|
||||
const PARSER_LIMIT: usize = 1004;
|
||||
const PARSER_LIMIT: usize = 1005;
|
||||
|
||||
fn check_entries(path: &Path, bad: &mut bool) {
|
||||
let dirs = walkdir::WalkDir::new(&path.join("test/ui"))
|
||||
|
Loading…
Reference in New Issue
Block a user