Rollup merge of #125667 - oli-obk:taintify, r=TaKO8Ki
Silence follow-up errors directly based on error types and regions During type_of, we used to just return an error type if there were any errors encountered. This is problematic, because it means a struct declared as `struct Foo<'static>` will end up not finding any inherent or trait impls because those impl blocks' `Self` type will be `{type error}` instead of `Foo<'re_error>`. Now it's the latter, silencing nonsensical follow-up errors about `Foo` not having any methods. Unfortunately that now allows for new follow-up errors, because borrowck treats `'re_error` as `'static`, causing nonsensical errors about non-error lifetimes not outliving `'static`. So what I also did was to just strip all outlives bounds that borrowck found, thus never letting it check them. There are probably more nuanced ways to do this, but I worried there would be other nonsensical errors if some outlives bounds were missing. Also from the test changes, it looked like an improvement everywhere.
This commit is contained in:
commit
5019bb608a
43 changed files with 271 additions and 297 deletions
|
@ -125,8 +125,8 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
|
||||||
placeholder_indices,
|
placeholder_indices,
|
||||||
placeholder_index_to_region: _,
|
placeholder_index_to_region: _,
|
||||||
liveness_constraints,
|
liveness_constraints,
|
||||||
outlives_constraints,
|
mut outlives_constraints,
|
||||||
member_constraints,
|
mut member_constraints,
|
||||||
universe_causes,
|
universe_causes,
|
||||||
type_tests,
|
type_tests,
|
||||||
} = constraints;
|
} = constraints;
|
||||||
|
@ -144,6 +144,16 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
|
||||||
&universal_region_relations,
|
&universal_region_relations,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if let Some(guar) = universal_regions.tainted_by_errors() {
|
||||||
|
// Suppress unhelpful extra errors in `infer_opaque_types` by clearing out all
|
||||||
|
// outlives bounds that we may end up checking.
|
||||||
|
outlives_constraints = Default::default();
|
||||||
|
member_constraints = Default::default();
|
||||||
|
|
||||||
|
// Also taint the entire scope.
|
||||||
|
infcx.set_tainted_by_errors(guar);
|
||||||
|
}
|
||||||
|
|
||||||
let mut regioncx = RegionInferenceContext::new(
|
let mut regioncx = RegionInferenceContext::new(
|
||||||
infcx,
|
infcx,
|
||||||
var_origins,
|
var_origins,
|
||||||
|
|
|
@ -29,7 +29,8 @@ use rustc_middle::ty::{self, InlineConstArgs, InlineConstArgsParts, RegionVid, T
|
||||||
use rustc_middle::ty::{GenericArgs, GenericArgsRef};
|
use rustc_middle::ty::{GenericArgs, GenericArgsRef};
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::symbol::{kw, sym};
|
use rustc_span::symbol::{kw, sym};
|
||||||
use rustc_span::Symbol;
|
use rustc_span::{ErrorGuaranteed, Symbol};
|
||||||
|
use std::cell::Cell;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use crate::renumber::RegionCtxt;
|
use crate::renumber::RegionCtxt;
|
||||||
|
@ -186,6 +187,10 @@ struct UniversalRegionIndices<'tcx> {
|
||||||
|
|
||||||
/// The vid assigned to `'static`. Used only for diagnostics.
|
/// The vid assigned to `'static`. Used only for diagnostics.
|
||||||
pub fr_static: RegionVid,
|
pub fr_static: RegionVid,
|
||||||
|
|
||||||
|
/// Whether we've encountered an error region. If we have, cancel all
|
||||||
|
/// outlives errors, as they are likely bogus.
|
||||||
|
pub tainted_by_errors: Cell<Option<ErrorGuaranteed>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -408,6 +413,10 @@ impl<'tcx> UniversalRegions<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn tainted_by_errors(&self) -> Option<ErrorGuaranteed> {
|
||||||
|
self.indices.tainted_by_errors.get()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UniversalRegionsBuilder<'cx, 'tcx> {
|
struct UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
|
@ -663,7 +672,11 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
let global_mapping = iter::once((tcx.lifetimes.re_static, fr_static));
|
let global_mapping = iter::once((tcx.lifetimes.re_static, fr_static));
|
||||||
let arg_mapping = iter::zip(identity_args.regions(), fr_args.regions().map(|r| r.as_var()));
|
let arg_mapping = iter::zip(identity_args.regions(), fr_args.regions().map(|r| r.as_var()));
|
||||||
|
|
||||||
UniversalRegionIndices { indices: global_mapping.chain(arg_mapping).collect(), fr_static }
|
UniversalRegionIndices {
|
||||||
|
indices: global_mapping.chain(arg_mapping).collect(),
|
||||||
|
fr_static,
|
||||||
|
tainted_by_errors: Cell::new(None),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_inputs_and_output(
|
fn compute_inputs_and_output(
|
||||||
|
@ -868,7 +881,8 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
|
||||||
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
||||||
if let ty::ReVar(..) = *r {
|
if let ty::ReVar(..) = *r {
|
||||||
r.as_var()
|
r.as_var()
|
||||||
} else if r.is_error() {
|
} else if let ty::ReError(guar) = *r {
|
||||||
|
self.tainted_by_errors.set(Some(guar));
|
||||||
// We use the `'static` `RegionVid` because `ReError` doesn't actually exist in the
|
// We use the `'static` `RegionVid` because `ReError` doesn't actually exist in the
|
||||||
// `UniversalRegionIndices`. This is fine because 1) it is a fallback only used if
|
// `UniversalRegionIndices`. This is fine because 1) it is a fallback only used if
|
||||||
// errors are being emitted and 2) it leaves the happy path unaffected.
|
// errors are being emitted and 2) it leaves the happy path unaffected.
|
||||||
|
|
|
@ -502,7 +502,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
|
||||||
bug!("unexpected sort of node in type_of(): {:?}", x);
|
bug!("unexpected sort of node in type_of(): {:?}", x);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if let Err(e) = icx.check_tainted_by_errors() {
|
if let Err(e) = icx.check_tainted_by_errors()
|
||||||
|
&& !output.references_error()
|
||||||
|
{
|
||||||
ty::EarlyBinder::bind(Ty::new_error(tcx, e))
|
ty::EarlyBinder::bind(Ty::new_error(tcx, e))
|
||||||
} else {
|
} else {
|
||||||
ty::EarlyBinder::bind(output)
|
ty::EarlyBinder::bind(output)
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
// This test ensures that it's not crashing rustdoc.
|
// This test ensures that it's not crashing rustdoc.
|
||||||
|
|
||||||
pub struct Foo<'a, 'b, T> {
|
pub struct Foo<'a, 'b, T> {
|
||||||
field1: dyn Bar<'a, 'b,>,
|
field1: dyn Bar<'a, 'b>,
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
//~| ERROR
|
//~| ERROR
|
||||||
|
//~| ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Bar<'x, 's, U>
|
pub trait Bar<'x, 's, U>
|
||||||
where U: 'x,
|
where
|
||||||
Self:'x,
|
U: 'x,
|
||||||
Self:'s
|
Self: 'x,
|
||||||
{}
|
Self: 's,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -1,26 +1,43 @@
|
||||||
error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
|
error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
|
||||||
--> $DIR/unable-fulfill-trait.rs:4:17
|
--> $DIR/unable-fulfill-trait.rs:4:17
|
||||||
|
|
|
|
||||||
LL | field1: dyn Bar<'a, 'b,>,
|
LL | field1: dyn Bar<'a, 'b>,
|
||||||
| ^^^ expected 1 generic argument
|
| ^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: trait defined here, with 1 generic parameter: `U`
|
note: trait defined here, with 1 generic parameter: `U`
|
||||||
--> $DIR/unable-fulfill-trait.rs:9:11
|
--> $DIR/unable-fulfill-trait.rs:10:11
|
||||||
|
|
|
|
||||||
LL | pub trait Bar<'x, 's, U>
|
LL | pub trait Bar<'x, 's, U>
|
||||||
| ^^^ -
|
| ^^^ -
|
||||||
help: add missing generic argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | field1: dyn Bar<'a, 'b, U,>,
|
LL | field1: dyn Bar<'a, 'b, U>,
|
||||||
| +++
|
| +++
|
||||||
|
|
||||||
error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
|
error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
|
||||||
--> $DIR/unable-fulfill-trait.rs:4:13
|
--> $DIR/unable-fulfill-trait.rs:4:13
|
||||||
|
|
|
|
||||||
LL | field1: dyn Bar<'a, 'b,>,
|
LL | field1: dyn Bar<'a, 'b>,
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error[E0478]: lifetime bound not satisfied
|
||||||
|
--> $DIR/unable-fulfill-trait.rs:4:13
|
||||||
|
|
|
||||||
|
LL | field1: dyn Bar<'a, 'b>,
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: lifetime parameter instantiated with the lifetime `'b` as defined here
|
||||||
|
--> $DIR/unable-fulfill-trait.rs:3:20
|
||||||
|
|
|
||||||
|
LL | pub struct Foo<'a, 'b, T> {
|
||||||
|
| ^^
|
||||||
|
note: but lifetime parameter must outlive the lifetime `'a` as defined here
|
||||||
|
--> $DIR/unable-fulfill-trait.rs:3:16
|
||||||
|
|
|
||||||
|
LL | pub struct Foo<'a, 'b, T> {
|
||||||
|
| ^^
|
||||||
|
|
||||||
Some errors have detailed explanations: E0107, E0227.
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0107, E0227, E0478.
|
||||||
For more information about an error, try `rustc --explain E0107`.
|
For more information about an error, try `rustc --explain E0107`.
|
||||||
|
|
|
@ -13,7 +13,7 @@ impl<T> Windows { //~ ERROR: missing generics for struct `Windows`
|
||||||
|
|
||||||
impl<T> Windows<T> {
|
impl<T> Windows<T> {
|
||||||
fn T() -> Option<Self::Item> {}
|
fn T() -> Option<Self::Item> {}
|
||||||
//~^ ERROR: ambiguous associated type
|
//[no_gate]~^ ERROR: ambiguous associated type
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -20,20 +20,7 @@ help: add missing generic argument
|
||||||
LL | impl<T> Windows<T> {
|
LL | impl<T> Windows<T> {
|
||||||
| +++
|
| +++
|
||||||
|
|
||||||
error[E0223]: ambiguous associated type
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/issue-109071.rs:15:22
|
|
||||||
|
|
|
||||||
LL | fn T() -> Option<Self::Item> {}
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
help: use fully-qualified syntax
|
|
||||||
|
|
|
||||||
LL | fn T() -> Option<<Windows<T> as IntoAsyncIterator>::Item> {}
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
LL | fn T() -> Option<<Windows<T> as IntoIterator>::Item> {}
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
Some errors have detailed explanations: E0107, E0637.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0107, E0223, E0637.
|
|
||||||
For more information about an error, try `rustc --explain E0107`.
|
For more information about an error, try `rustc --explain E0107`.
|
||||||
|
|
|
@ -8,6 +8,5 @@ impl Lexer<'d> { //~ ERROR use of undeclared lifetime name `'d`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test(_: Lexer::Cursor) {}
|
fn test(_: Lexer::Cursor) {}
|
||||||
//~^ ERROR: lifetime may not live long enough
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -6,15 +6,6 @@ LL | impl Lexer<'d> {
|
||||||
| |
|
| |
|
||||||
| help: consider introducing lifetime `'d` here: `<'d>`
|
| help: consider introducing lifetime `'d` here: `<'d>`
|
||||||
|
|
||||||
error: lifetime may not live long enough
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/issue-109299.rs:10:1
|
|
||||||
|
|
|
||||||
LL | fn test(_: Lexer::Cursor) {}
|
|
||||||
| ^^^^^^^^-^^^^^^^^^^^^^^^^
|
|
||||||
| | |
|
|
||||||
| | has type `Lexer<'1>::Cursor`
|
|
||||||
| requires that `'1` must outlive `'static`
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0261`.
|
For more information about this error, try `rustc --explain E0261`.
|
||||||
|
|
|
@ -5,7 +5,6 @@ struct DataWrapper<'static> {
|
||||||
//~^ ERROR invalid lifetime parameter name: `'static`
|
//~^ ERROR invalid lifetime parameter name: `'static`
|
||||||
data: &'a [u8; Self::SIZE],
|
data: &'a [u8; Self::SIZE],
|
||||||
//~^ ERROR use of undeclared lifetime name `'a`
|
//~^ ERROR use of undeclared lifetime name `'a`
|
||||||
//~^^ ERROR lifetime may not live long enough
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DataWrapper<'a> {
|
impl DataWrapper<'a> {
|
||||||
|
|
|
@ -14,7 +14,7 @@ LL | data: &'a [u8; Self::SIZE],
|
||||||
| ^^ undeclared lifetime
|
| ^^ undeclared lifetime
|
||||||
|
|
||||||
error[E0261]: use of undeclared lifetime name `'a`
|
error[E0261]: use of undeclared lifetime name `'a`
|
||||||
--> $DIR/generic_const_early_param.rs:11:18
|
--> $DIR/generic_const_early_param.rs:10:18
|
||||||
|
|
|
|
||||||
LL | impl DataWrapper<'a> {
|
LL | impl DataWrapper<'a> {
|
||||||
| - ^^ undeclared lifetime
|
| - ^^ undeclared lifetime
|
||||||
|
@ -30,13 +30,7 @@ LL | #![feature(generic_const_exprs)]
|
||||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= note: `#[warn(incomplete_features)]` on by default
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
|
||||||
error: lifetime may not live long enough
|
error: aborting due to 3 previous errors; 1 warning emitted
|
||||||
--> $DIR/generic_const_early_param.rs:6:20
|
|
||||||
|
|
|
||||||
LL | data: &'a [u8; Self::SIZE],
|
|
||||||
| ^^^^^^^^^^ requires that `'_` must outlive `'static`
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors; 1 warning emitted
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0261, E0262.
|
Some errors have detailed explanations: E0261, E0262.
|
||||||
For more information about an error, try `rustc --explain E0261`.
|
For more information about an error, try `rustc --explain E0261`.
|
||||||
|
|
|
@ -7,7 +7,7 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
|
||||||
= note: type parameters may not be used in the type of const parameters
|
= note: type parameters may not be used in the type of const parameters
|
||||||
|
|
||||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||||
--> $DIR/issue-71381.rs:22:40
|
--> $DIR/issue-71381.rs:23:40
|
||||||
|
|
|
|
||||||
LL | const FN: unsafe extern "C" fn(Args),
|
LL | const FN: unsafe extern "C" fn(Args),
|
||||||
| ^^^^ the type must not depend on the parameter `Args`
|
| ^^^^ the type must not depend on the parameter `Args`
|
||||||
|
|
|
@ -7,13 +7,29 @@ LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
|
||||||
= note: type parameters may not be used in the type of const parameters
|
= note: type parameters may not be used in the type of const parameters
|
||||||
|
|
||||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||||
--> $DIR/issue-71381.rs:22:40
|
--> $DIR/issue-71381.rs:23:40
|
||||||
|
|
|
|
||||||
LL | const FN: unsafe extern "C" fn(Args),
|
LL | const FN: unsafe extern "C" fn(Args),
|
||||||
| ^^^^ the type must not depend on the parameter `Args`
|
| ^^^^ the type must not depend on the parameter `Args`
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in the type of const parameters
|
= note: type parameters may not be used in the type of const parameters
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: using function pointers as const generic parameters is forbidden
|
||||||
|
--> $DIR/issue-71381.rs:14:61
|
||||||
|
|
|
||||||
|
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: the only supported types are integers, `bool` and `char`
|
||||||
|
|
||||||
|
error: using function pointers as const generic parameters is forbidden
|
||||||
|
--> $DIR/issue-71381.rs:23:19
|
||||||
|
|
|
||||||
|
LL | const FN: unsafe extern "C" fn(Args),
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: the only supported types are integers, `bool` and `char`
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0770`.
|
For more information about this error, try `rustc --explain E0770`.
|
||||||
|
|
|
@ -13,6 +13,7 @@ unsafe extern "C" fn pass(args: PassArg) {
|
||||||
impl Test {
|
impl Test {
|
||||||
pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
|
pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
|
||||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||||
|
//[min]~^^ ERROR: using function pointers as const generic parameters is forbidden
|
||||||
self.0 = Self::trampiline::<Args, IDX, FN> as _
|
self.0 = Self::trampiline::<Args, IDX, FN> as _
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ impl Test {
|
||||||
const IDX: usize,
|
const IDX: usize,
|
||||||
const FN: unsafe extern "C" fn(Args),
|
const FN: unsafe extern "C" fn(Args),
|
||||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||||
|
//[min]~^^ ERROR: using function pointers as const generic parameters is forbidden
|
||||||
>(
|
>(
|
||||||
args: Args,
|
args: Args,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -6,6 +6,14 @@ LL | fn func<A, const F: fn(inner: A)>(outer: A) {
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in the type of const parameters
|
= note: type parameters may not be used in the type of const parameters
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: using function pointers as const generic parameters is forbidden
|
||||||
|
--> $DIR/issue-71611.rs:5:21
|
||||||
|
|
|
||||||
|
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: the only supported types are integers, `bool` and `char`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0770`.
|
For more information about this error, try `rustc --explain E0770`.
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
fn func<A, const F: fn(inner: A)>(outer: A) {
|
fn func<A, const F: fn(inner: A)>(outer: A) {
|
||||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||||
|
//[min]~| ERROR: using function pointers as const generic parameters is forbidden
|
||||||
F(outer);
|
F(outer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ impl Opcode2 {
|
||||||
pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) {
|
pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) {
|
||||||
move |i| match msg_type {
|
move |i| match msg_type {
|
||||||
Opcode2::OP2 => unimplemented!(),
|
Opcode2::OP2 => unimplemented!(),
|
||||||
|
//~^ ERROR: could not evaluate constant pattern
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,13 @@ help: you might be missing a type parameter
|
||||||
LL | pub struct Opcode2<S>(&'a S);
|
LL | pub struct Opcode2<S>(&'a S);
|
||||||
| +++
|
| +++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: could not evaluate constant pattern
|
||||||
|
--> $DIR/ice-type-mismatch-when-copying-112824.rs:15:9
|
||||||
|
|
|
||||||
|
LL | Opcode2::OP2 => unimplemented!(),
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0261, E0412.
|
Some errors have detailed explanations: E0261, E0412.
|
||||||
For more information about an error, try `rustc --explain E0261`.
|
For more information about an error, try `rustc --explain E0261`.
|
||||||
|
|
|
@ -9,7 +9,6 @@ impl<T> X for T { //~ ERROR: not all trait items implemented
|
||||||
//~^ ERROR missing generics for associated type
|
//~^ ERROR missing generics for associated type
|
||||||
//~^^ ERROR missing generics for associated type
|
//~^^ ERROR missing generics for associated type
|
||||||
//~| ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters
|
//~| ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters
|
||||||
//~| ERROR may not live long enough
|
|
||||||
t
|
t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,16 +51,7 @@ help: add missing lifetime argument
|
||||||
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
|
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error: lifetime may not live long enough
|
error: aborting due to 4 previous errors
|
||||||
--> $DIR/gat-trait-path-missing-lifetime.rs:8:3
|
|
||||||
|
|
|
||||||
LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
|
|
||||||
| ^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
| | |
|
|
||||||
| | lifetime `'a` defined here
|
|
||||||
| requires that `'a` must outlive `'static`
|
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0046, E0049, E0107.
|
Some errors have detailed explanations: E0046, E0049, E0107.
|
||||||
For more information about an error, try `rustc --explain E0046`.
|
For more information about an error, try `rustc --explain E0046`.
|
||||||
|
|
|
@ -52,5 +52,4 @@ fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> {
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let doc = create_doc();
|
let doc = create_doc();
|
||||||
let lexer: Lexer<'_, DocCursorImpl<'_>> = Lexer::from(&doc);
|
let lexer: Lexer<'_, DocCursorImpl<'_>> = Lexer::from(&doc);
|
||||||
//~^ ERROR: `doc` does not live long enough
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,21 +27,7 @@ LL | type Cursor<'a>: DocCursor<'a>;
|
||||||
= note: this bound is currently required to ensure that impls have maximum flexibility
|
= note: this bound is currently required to ensure that impls have maximum flexibility
|
||||||
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
|
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
|
||||||
|
|
||||||
error[E0597]: `doc` does not live long enough
|
error: aborting due to 3 previous errors
|
||||||
--> $DIR/issue-70304.rs:54:59
|
|
||||||
|
|
|
||||||
LL | let doc = create_doc();
|
|
||||||
| --- binding `doc` declared here
|
|
||||||
LL | let lexer: Lexer<'_, DocCursorImpl<'_>> = Lexer::from(&doc);
|
|
||||||
| ------------^^^^-
|
|
||||||
| | |
|
|
||||||
| | borrowed value does not live long enough
|
|
||||||
| argument requires that `doc` is borrowed for `'static`
|
|
||||||
LL |
|
|
||||||
LL | }
|
|
||||||
| - `doc` dropped here while still borrowed
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
Some errors have detailed explanations: E0106, E0637.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0106, E0597, E0637.
|
|
||||||
For more information about an error, try `rustc --explain E0106`.
|
For more information about an error, try `rustc --explain E0106`.
|
||||||
|
|
|
@ -9,6 +9,9 @@ impl Provider for () {
|
||||||
struct Holder<B> {
|
struct Holder<B> {
|
||||||
inner: Box<dyn Provider<A = B>>,
|
inner: Box<dyn Provider<A = B>>,
|
||||||
//~^ ERROR: missing generics for associated type
|
//~^ ERROR: missing generics for associated type
|
||||||
|
//~| ERROR: missing generics for associated type
|
||||||
|
//~| ERROR: missing generics for associated type
|
||||||
|
//~| ERROR: the trait `Provider` cannot be made into an object
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -14,6 +14,57 @@ help: add missing lifetime argument
|
||||||
LL | inner: Box<dyn Provider<A<'a> = B>>,
|
LL | inner: Box<dyn Provider<A<'a> = B>>,
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0107]: missing generics for associated type `Provider::A`
|
||||||
|
--> $DIR/issue-71176.rs:10:27
|
||||||
|
|
|
||||||
|
LL | inner: Box<dyn Provider<A = B>>,
|
||||||
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
||||||
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
--> $DIR/issue-71176.rs:2:10
|
||||||
|
|
|
||||||
|
LL | type A<'a>;
|
||||||
|
| ^ --
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
help: add missing lifetime argument
|
||||||
|
|
|
||||||
|
LL | inner: Box<dyn Provider<A<'a> = B>>,
|
||||||
|
| ++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0107`.
|
error[E0107]: missing generics for associated type `Provider::A`
|
||||||
|
--> $DIR/issue-71176.rs:10:27
|
||||||
|
|
|
||||||
|
LL | inner: Box<dyn Provider<A = B>>,
|
||||||
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
||||||
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
--> $DIR/issue-71176.rs:2:10
|
||||||
|
|
|
||||||
|
LL | type A<'a>;
|
||||||
|
| ^ --
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
help: add missing lifetime argument
|
||||||
|
|
|
||||||
|
LL | inner: Box<dyn Provider<A<'a> = B>>,
|
||||||
|
| ++++
|
||||||
|
|
||||||
|
error[E0038]: the trait `Provider` cannot be made into an object
|
||||||
|
--> $DIR/issue-71176.rs:10:14
|
||||||
|
|
|
||||||
|
LL | inner: Box<dyn Provider<A = B>>,
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ `Provider` cannot be made into an object
|
||||||
|
|
|
||||||
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||||
|
--> $DIR/issue-71176.rs:2:10
|
||||||
|
|
|
||||||
|
LL | trait Provider {
|
||||||
|
| -------- this trait cannot be made into an object...
|
||||||
|
LL | type A<'a>;
|
||||||
|
| ^ ...because it contains the generic associated type `A`
|
||||||
|
= help: consider moving `A` to another trait
|
||||||
|
= help: only type `()` implements the trait, consider using it directly instead
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0038, E0107.
|
||||||
|
For more information about an error, try `rustc --explain E0038`.
|
||||||
|
|
|
@ -22,8 +22,7 @@ fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
|
||||||
//~^ ERROR missing generics for associated type
|
//~^ ERROR missing generics for associated type
|
||||||
{
|
{
|
||||||
for n in 0i16..100 {
|
for n in 0i16..100 {
|
||||||
*dst.test_mut() = n.into(); //~ ERROR: cannot borrow
|
*dst.test_mut() = n.into();
|
||||||
//~^ ERROR: borrowed data escapes outside of function
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,30 +25,6 @@ help: add missing lifetime argument
|
||||||
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output<'a> = &'a mut f32>)
|
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output<'a> = &'a mut f32>)
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error[E0499]: cannot borrow `*dst` as mutable more than once at a time
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/issue-80433.rs:25:10
|
|
||||||
|
|
|
||||||
LL | *dst.test_mut() = n.into();
|
|
||||||
| ^^^-----------
|
|
||||||
| |
|
|
||||||
| `*dst` was mutably borrowed here in the previous iteration of the loop
|
|
||||||
| argument requires that `*dst` is borrowed for `'static`
|
|
||||||
|
|
||||||
error[E0521]: borrowed data escapes outside of function
|
For more information about this error, try `rustc --explain E0107`.
|
||||||
--> $DIR/issue-80433.rs:25:10
|
|
||||||
|
|
|
||||||
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
|
|
||||||
| -- --- `dst` is a reference that is only valid in the function body
|
|
||||||
| |
|
|
||||||
| lifetime `'a` defined here
|
|
||||||
...
|
|
||||||
LL | *dst.test_mut() = n.into();
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `dst` escapes the function body here
|
|
||||||
| argument requires that `'a` must outlive `'static`
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0107, E0499, E0521.
|
|
||||||
For more information about an error, try `rustc --explain E0107`.
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
// issue: 114146
|
// issue: 114146
|
||||||
|
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
fn bar<'other: 'a>() -> impl Sized + 'a {}
|
fn bar<'other: 'a>() -> impl Sized + 'a {}
|
||||||
//~^ ERROR use of undeclared lifetime name `'a`
|
//~^ ERROR use of undeclared lifetime name `'a`
|
||||||
//~| ERROR use of undeclared lifetime name `'a`
|
//~| ERROR use of undeclared lifetime name `'a`
|
||||||
//~| ERROR expected generic lifetime parameter, found `'static`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0261]: use of undeclared lifetime name `'a`
|
error[E0261]: use of undeclared lifetime name `'a`
|
||||||
--> $DIR/bad-item-bound-within-rpitit-2.rs:5:20
|
--> $DIR/bad-item-bound-within-rpitit-2.rs:4:20
|
||||||
|
|
|
|
||||||
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
|
||||||
| ^^ undeclared lifetime
|
| ^^ undeclared lifetime
|
||||||
|
@ -14,7 +14,7 @@ LL | trait Foo<'a> {
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error[E0261]: use of undeclared lifetime name `'a`
|
error[E0261]: use of undeclared lifetime name `'a`
|
||||||
--> $DIR/bad-item-bound-within-rpitit-2.rs:5:42
|
--> $DIR/bad-item-bound-within-rpitit-2.rs:4:42
|
||||||
|
|
|
|
||||||
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
|
||||||
| ^^ undeclared lifetime
|
| ^^ undeclared lifetime
|
||||||
|
@ -28,15 +28,6 @@ help: consider introducing lifetime `'a` here
|
||||||
LL | trait Foo<'a> {
|
LL | trait Foo<'a> {
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error[E0792]: expected generic lifetime parameter, found `'static`
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/bad-item-bound-within-rpitit-2.rs:5:45
|
|
||||||
|
|
|
||||||
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
|
|
||||||
| ------ ^^
|
|
||||||
| |
|
|
||||||
| cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
For more information about this error, try `rustc --explain E0261`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0261, E0792.
|
|
||||||
For more information about an error, try `rustc --explain E0261`.
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ struct Wrap<F>(F);
|
||||||
|
|
||||||
impl<A, B, F> MyFn<A> for Wrap<F>
|
impl<A, B, F> MyFn<A> for Wrap<F>
|
||||||
where
|
where
|
||||||
F: Fn(A) -> B
|
F: Fn(A) -> B,
|
||||||
{
|
{
|
||||||
type Output = B;
|
type Output = B;
|
||||||
|
|
||||||
|
@ -16,13 +16,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct A;
|
struct A;
|
||||||
fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
|
fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> {
|
||||||
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
Wrap(|a| Some(a).into_iter())
|
Wrap(|a| Some(a).into_iter())
|
||||||
//~^ ERROR implementation of `FnOnce` is not general enough
|
|
||||||
//~| ERROR implementation of `FnOnce` is not general enough
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,34 +1,15 @@
|
||||||
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
--> $DIR/issue-67830.rs:21:62
|
--> $DIR/issue-67830.rs:20:64
|
||||||
|
|
|
|
||||||
LL | fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
|
LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> {
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
note: lifetime declared here
|
note: lifetime declared here
|
||||||
--> $DIR/issue-67830.rs:21:23
|
--> $DIR/issue-67830.rs:20:23
|
||||||
|
|
|
|
||||||
LL | fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
|
LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> {
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error: implementation of `FnOnce` is not general enough
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/issue-67830.rs:23:5
|
|
||||||
|
|
|
||||||
LL | Wrap(|a| Some(a).into_iter())
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
|
||||||
|
|
|
||||||
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
|
|
||||||
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
|
|
||||||
|
|
||||||
error: implementation of `FnOnce` is not general enough
|
|
||||||
--> $DIR/issue-67830.rs:23:5
|
|
||||||
|
|
|
||||||
LL | Wrap(|a| Some(a).into_iter())
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
|
||||||
|
|
|
||||||
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
|
|
||||||
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0657`.
|
For more information about this error, try `rustc --explain E0657`.
|
||||||
|
|
|
@ -18,16 +18,11 @@ fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {}
|
||||||
fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||||
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
&()
|
&()
|
||||||
//~^ ERROR implementation of `Hrtb` is not general enough
|
|
||||||
//~| ERROR implementation of `Hrtb` is not general enough
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||||
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
x
|
x
|
||||||
//~^ ERROR implementation of `Hrtb` is not general enough
|
|
||||||
//~| ERROR implementation of `Hrtb` is not general enough
|
|
||||||
//~| ERROR lifetime may not live long enough
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -22,72 +22,18 @@ note: lifetime declared here
|
||||||
LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error: implementation of `Hrtb` is not general enough
|
|
||||||
--> $DIR/issue-88236-2.rs:20:5
|
|
||||||
|
|
|
||||||
LL | &()
|
|
||||||
| ^^^ implementation of `Hrtb` is not general enough
|
|
||||||
|
|
|
||||||
= note: `Hrtb<'0>` would have to be implemented for the type `&()`, for any lifetime `'0`...
|
|
||||||
= note: ...but `Hrtb<'1>` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1`
|
|
||||||
|
|
||||||
error: implementation of `Hrtb` is not general enough
|
|
||||||
--> $DIR/issue-88236-2.rs:20:5
|
|
||||||
|
|
|
||||||
LL | &()
|
|
||||||
| ^^^ implementation of `Hrtb` is not general enough
|
|
||||||
|
|
|
||||||
= note: `Hrtb<'a>` would have to be implemented for the type `&()`
|
|
||||||
= note: ...but `Hrtb<'0>` is actually implemented for the type `&'0 ()`, for some specific lifetime `'0`
|
|
||||||
|
|
||||||
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
--> $DIR/issue-88236-2.rs:25:78
|
--> $DIR/issue-88236-2.rs:23:78
|
||||||
|
|
|
|
||||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
note: lifetime declared here
|
note: lifetime declared here
|
||||||
--> $DIR/issue-88236-2.rs:25:45
|
--> $DIR/issue-88236-2.rs:23:45
|
||||||
|
|
|
|
||||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error: lifetime may not live long enough
|
error: aborting due to 3 previous errors
|
||||||
--> $DIR/issue-88236-2.rs:27:5
|
|
||||||
|
|
|
||||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
|
||||||
| -- lifetime `'b` defined here
|
|
||||||
LL |
|
|
||||||
LL | x
|
|
||||||
| ^ returning this value requires that `'b` must outlive `'static`
|
|
||||||
|
|
|
||||||
help: to declare that `impl for<'a> Hrtb<'a, Assoc = impl Send + '_>` captures data from argument `x`, you can add an explicit `'b` lifetime bound
|
|
||||||
|
|
|
||||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> + 'b {
|
|
||||||
| ++++
|
|
||||||
help: to declare that `impl Send + 'a` captures data from argument `x`, you can add an explicit `'b` lifetime bound
|
|
||||||
|
|
|
||||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a + 'b> {
|
|
||||||
| ++++
|
|
||||||
|
|
||||||
error: implementation of `Hrtb` is not general enough
|
|
||||||
--> $DIR/issue-88236-2.rs:27:5
|
|
||||||
|
|
|
||||||
LL | x
|
|
||||||
| ^ implementation of `Hrtb` is not general enough
|
|
||||||
|
|
|
||||||
= note: `Hrtb<'0>` would have to be implemented for the type `&()`, for any lifetime `'0`...
|
|
||||||
= note: ...but `Hrtb<'1>` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1`
|
|
||||||
|
|
||||||
error: implementation of `Hrtb` is not general enough
|
|
||||||
--> $DIR/issue-88236-2.rs:27:5
|
|
||||||
|
|
|
||||||
LL | x
|
|
||||||
| ^ implementation of `Hrtb` is not general enough
|
|
||||||
|
|
|
||||||
= note: `Hrtb<'a>` would have to be implemented for the type `&()`
|
|
||||||
= note: ...but `Hrtb<'0>` is actually implemented for the type `&'0 ()`, for some specific lifetime `'0`
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0657`.
|
For more information about this error, try `rustc --explain E0657`.
|
||||||
|
|
|
@ -31,7 +31,6 @@ fn one_hrtb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl Qux<'a>> {}
|
||||||
|
|
||||||
fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
|
fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
|
||||||
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
//~| ERROR implementation of `Bar` is not general enough
|
|
||||||
|
|
||||||
fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
||||||
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
|
@ -64,6 +63,5 @@ fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<
|
||||||
// `'b` is not in scope for the outlives bound.
|
// `'b` is not in scope for the outlives bound.
|
||||||
fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
|
fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
|
||||||
//~^ ERROR use of undeclared lifetime name `'b` [E0261]
|
//~^ ERROR use of undeclared lifetime name `'b` [E0261]
|
||||||
//~| ERROR implementation of `Bar` is not general enough
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0261]: use of undeclared lifetime name `'b`
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
--> $DIR/nested-rpit-hrtb.rs:57:77
|
--> $DIR/nested-rpit-hrtb.rs:56:77
|
||||||
|
|
|
|
||||||
LL | fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b> {}
|
LL | fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b> {}
|
||||||
| ^^ undeclared lifetime
|
| ^^ undeclared lifetime
|
||||||
|
@ -15,7 +15,7 @@ LL | fn two_htrb_outlives<'b>() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Siz
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error[E0261]: use of undeclared lifetime name `'b`
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
--> $DIR/nested-rpit-hrtb.rs:65:82
|
--> $DIR/nested-rpit-hrtb.rs:64:82
|
||||||
|
|
|
|
||||||
LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
|
LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
|
||||||
| ^^ undeclared lifetime
|
| ^^ undeclared lifetime
|
||||||
|
@ -65,29 +65,20 @@ note: lifetime declared here
|
||||||
LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
|
LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error: implementation of `Bar` is not general enough
|
|
||||||
--> $DIR/nested-rpit-hrtb.rs:32:78
|
|
||||||
|
|
|
||||||
LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
|
|
||||||
| ^^ implementation of `Bar` is not general enough
|
|
||||||
|
|
|
||||||
= note: `()` must implement `Bar<'a>`
|
|
||||||
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
|
|
||||||
|
|
||||||
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
||||||
--> $DIR/nested-rpit-hrtb.rs:36:73
|
--> $DIR/nested-rpit-hrtb.rs:35:73
|
||||||
|
|
|
|
||||||
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
note: lifetime declared here
|
note: lifetime declared here
|
||||||
--> $DIR/nested-rpit-hrtb.rs:36:44
|
--> $DIR/nested-rpit-hrtb.rs:35:44
|
||||||
|
|
|
|
||||||
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error[E0277]: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied
|
error[E0277]: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied
|
||||||
--> $DIR/nested-rpit-hrtb.rs:46:79
|
--> $DIR/nested-rpit-hrtb.rs:45:79
|
||||||
|
|
|
|
||||||
LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
|
LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
|
||||||
| ^^^^^^^^^^^^ the trait `for<'a> Qux<'b>` is not implemented for `&'a ()`
|
| ^^^^^^^^^^^^ the trait `for<'a> Qux<'b>` is not implemented for `&'a ()`
|
||||||
|
@ -96,7 +87,7 @@ LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc
|
||||||
= help: for that trait implementation, expected `()`, found `&'a ()`
|
= help: for that trait implementation, expected `()`, found `&'a ()`
|
||||||
|
|
||||||
error: implementation of `Bar` is not general enough
|
error: implementation of `Bar` is not general enough
|
||||||
--> $DIR/nested-rpit-hrtb.rs:50:93
|
--> $DIR/nested-rpit-hrtb.rs:49:93
|
||||||
|
|
|
|
||||||
LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {}
|
LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {}
|
||||||
| ^^ implementation of `Bar` is not general enough
|
| ^^ implementation of `Bar` is not general enough
|
||||||
|
@ -105,7 +96,7 @@ LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc =
|
||||||
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
|
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
|
||||||
|
|
||||||
error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied
|
error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied
|
||||||
--> $DIR/nested-rpit-hrtb.rs:61:64
|
--> $DIR/nested-rpit-hrtb.rs:60:64
|
||||||
|
|
|
|
||||||
LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
|
LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()`
|
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()`
|
||||||
|
@ -113,16 +104,7 @@ LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b>
|
||||||
= help: the trait `Qux<'_>` is implemented for `()`
|
= help: the trait `Qux<'_>` is implemented for `()`
|
||||||
= help: for that trait implementation, expected `()`, found `&'a ()`
|
= help: for that trait implementation, expected `()`, found `&'a ()`
|
||||||
|
|
||||||
error: implementation of `Bar` is not general enough
|
error: aborting due to 9 previous errors
|
||||||
--> $DIR/nested-rpit-hrtb.rs:65:86
|
|
||||||
|
|
|
||||||
LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
|
|
||||||
| ^^ implementation of `Bar` is not general enough
|
|
||||||
|
|
|
||||||
= note: `()` must implement `Bar<'a>`
|
|
||||||
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
|
|
||||||
|
|
||||||
error: aborting due to 11 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0261, E0277, E0657.
|
Some errors have detailed explanations: E0261, E0277, E0657.
|
||||||
For more information about an error, try `rustc --explain E0261`.
|
For more information about an error, try `rustc --explain E0261`.
|
||||||
|
|
|
@ -8,6 +8,9 @@ static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
|
||||||
|
|
||||||
const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
||||||
//~^ ERROR cannot find type `Path` in this scope
|
//~^ ERROR cannot find type `Path` in this scope
|
||||||
|
//~| ERROR the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
//~| ERROR the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
//~| ERROR mismatched types
|
||||||
|
|
||||||
static BAZ: ([u8], usize) = ([], 0);
|
static BAZ: ([u8], usize) = ([], 0);
|
||||||
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
|
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
|
|
@ -21,7 +21,35 @@ LL + use std::path::Path;
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||||
--> $DIR/issue-84108.rs:12:13
|
--> $DIR/issue-84108.rs:9:12
|
||||||
|
|
|
||||||
|
LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `[u8]`
|
||||||
|
= note: only the last element of a tuple may have a dynamically sized type
|
||||||
|
|
||||||
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
--> $DIR/issue-84108.rs:9:12
|
||||||
|
|
|
||||||
|
LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `[u8]`
|
||||||
|
= note: only the last element of a tuple may have a dynamically sized type
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/issue-84108.rs:9:45
|
||||||
|
|
|
||||||
|
LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
|
||||||
|
| ^^ expected `[u8]`, found `[_; 0]`
|
||||||
|
|
|
||||||
|
= note: expected slice `[u8]`
|
||||||
|
found array `[_; 0]`
|
||||||
|
|
||||||
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
--> $DIR/issue-84108.rs:15:13
|
||||||
|
|
|
|
||||||
LL | static BAZ: ([u8], usize) = ([], 0);
|
LL | static BAZ: ([u8], usize) = ([], 0);
|
||||||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
@ -30,7 +58,7 @@ LL | static BAZ: ([u8], usize) = ([], 0);
|
||||||
= note: only the last element of a tuple may have a dynamically sized type
|
= note: only the last element of a tuple may have a dynamically sized type
|
||||||
|
|
||||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||||
--> $DIR/issue-84108.rs:12:13
|
--> $DIR/issue-84108.rs:15:13
|
||||||
|
|
|
|
||||||
LL | static BAZ: ([u8], usize) = ([], 0);
|
LL | static BAZ: ([u8], usize) = ([], 0);
|
||||||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
@ -40,7 +68,7 @@ LL | static BAZ: ([u8], usize) = ([], 0);
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/issue-84108.rs:12:30
|
--> $DIR/issue-84108.rs:15:30
|
||||||
|
|
|
|
||||||
LL | static BAZ: ([u8], usize) = ([], 0);
|
LL | static BAZ: ([u8], usize) = ([], 0);
|
||||||
| ^^ expected `[u8]`, found `[_; 0]`
|
| ^^ expected `[u8]`, found `[_; 0]`
|
||||||
|
@ -48,7 +76,7 @@ LL | static BAZ: ([u8], usize) = ([], 0);
|
||||||
= note: expected slice `[u8]`
|
= note: expected slice `[u8]`
|
||||||
found array `[_; 0]`
|
found array `[_; 0]`
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0308, E0412.
|
Some errors have detailed explanations: E0277, E0308, E0412.
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -11,7 +11,7 @@ impl A {
|
||||||
}
|
}
|
||||||
async fn f() {
|
async fn f() {
|
||||||
let mut buf = [0; 512];
|
let mut buf = [0; 512];
|
||||||
let m2 = &buf[..]; //~ ERROR `buf` does not live long enough
|
let m2 = &buf[..];
|
||||||
let m = Self::g(m2).await;
|
let m = Self::g(m2).await;
|
||||||
Self::f2(m).await;
|
Self::f2(m).await;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ impl A {
|
||||||
}
|
}
|
||||||
async fn f() {
|
async fn f() {
|
||||||
let mut buf = [0; 512];
|
let mut buf = [0; 512];
|
||||||
let m2 = &buf[..]; //~ ERROR `buf` does not live long enough
|
let m2 = &buf[..];
|
||||||
let m = Self::g(m2).await;
|
let m = Self::g(m2).await;
|
||||||
Self::f2(m).await;
|
Self::f2(m).await;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,20 +9,6 @@ help: indicate the anonymous lifetime
|
||||||
LL | async fn f2(m: Msg<'_>) {}
|
LL | async fn f2(m: Msg<'_>) {}
|
||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error[E0597]: `buf` does not live long enough
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/issue-69314.rs:14:19
|
|
||||||
|
|
|
||||||
LL | let mut buf = [0; 512];
|
|
||||||
| ------- binding `buf` declared here
|
|
||||||
LL | let m2 = &buf[..];
|
|
||||||
| ^^^ borrowed value does not live long enough
|
|
||||||
LL | let m = Self::g(m2).await;
|
|
||||||
| ----------- argument requires that `buf` is borrowed for `'static`
|
|
||||||
LL | Self::f2(m).await;
|
|
||||||
LL | }
|
|
||||||
| - `buf` dropped here while still borrowed
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
For more information about this error, try `rustc --explain E0726`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0597, E0726.
|
|
||||||
For more information about an error, try `rustc --explain E0597`.
|
|
||||||
|
|
|
@ -2,9 +2,8 @@ struct S<'a>(&'a u8);
|
||||||
fn foo() {}
|
fn foo() {}
|
||||||
|
|
||||||
// Paren generic args in AnonConst
|
// Paren generic args in AnonConst
|
||||||
fn a() -> [u8; foo::()] {
|
fn a() -> [u8; foo()] {
|
||||||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
|
//~^ ERROR mismatched types
|
||||||
//~| ERROR mismatched types
|
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,5 +25,6 @@ fn d<const C: S>() {}
|
||||||
trait Foo<'a> {}
|
trait Foo<'a> {}
|
||||||
struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||||
//~^ ERROR the type of const parameters must not depend on other generic parameters
|
//~^ ERROR the type of const parameters must not depend on other generic parameters
|
||||||
|
//~| ERROR `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error[E0106]: missing lifetime specifier
|
error[E0106]: missing lifetime specifier
|
||||||
--> $DIR/unusual-rib-combinations.rs:22:15
|
--> $DIR/unusual-rib-combinations.rs:21:15
|
||||||
|
|
|
|
||||||
LL | fn d<const C: S>() {}
|
LL | fn d<const C: S>() {}
|
||||||
| ^ expected named lifetime parameter
|
| ^ expected named lifetime parameter
|
||||||
|
|
||||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||||
--> $DIR/unusual-rib-combinations.rs:27:22
|
--> $DIR/unusual-rib-combinations.rs:26:22
|
||||||
|
|
|
|
||||||
LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||||
| ^^ the type must not depend on the parameter `'a`
|
| ^^ the type must not depend on the parameter `'a`
|
||||||
|
@ -13,25 +13,19 @@ LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||||
= note: lifetime parameters may not be used in the type of const parameters
|
= note: lifetime parameters may not be used in the type of const parameters
|
||||||
|
|
||||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||||
--> $DIR/unusual-rib-combinations.rs:5:16
|
--> $DIR/unusual-rib-combinations.rs:11:15
|
||||||
|
|
|
||||||
LL | fn a() -> [u8; foo::()] {
|
|
||||||
| ^^^^^^^ only `Fn` traits may use parentheses
|
|
||||||
|
|
||||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
|
||||||
--> $DIR/unusual-rib-combinations.rs:12:15
|
|
||||||
|
|
|
|
||||||
LL | fn b<const C: u8()>() {}
|
LL | fn b<const C: u8()>() {}
|
||||||
| ^^^^ only `Fn` traits may use parentheses
|
| ^^^^ only `Fn` traits may use parentheses
|
||||||
|
|
||||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||||
--> $DIR/unusual-rib-combinations.rs:16:10
|
--> $DIR/unusual-rib-combinations.rs:15:10
|
||||||
|
|
|
|
||||||
LL | fn c<T = u8()>() {}
|
LL | fn c<T = u8()>() {}
|
||||||
| ^^^^ only `Fn` traits may use parentheses
|
| ^^^^ only `Fn` traits may use parentheses
|
||||||
|
|
||||||
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||||
--> $DIR/unusual-rib-combinations.rs:16:6
|
--> $DIR/unusual-rib-combinations.rs:15:6
|
||||||
|
|
|
|
||||||
LL | fn c<T = u8()>() {}
|
LL | fn c<T = u8()>() {}
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
@ -43,14 +37,11 @@ LL | fn c<T = u8()>() {}
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/unusual-rib-combinations.rs:5:16
|
--> $DIR/unusual-rib-combinations.rs:5:16
|
||||||
|
|
|
|
||||||
LL | fn a() -> [u8; foo::()] {
|
LL | fn a() -> [u8; foo()] {
|
||||||
| ^^^^^^^ expected `usize`, found fn item
|
| ^^^^^ expected `usize`, found `()`
|
||||||
|
|
|
||||||
= note: expected type `usize`
|
|
||||||
found fn item `fn() {foo}`
|
|
||||||
|
|
||||||
error: `S<'_>` is forbidden as the type of a const generic parameter
|
error: `S<'_>` is forbidden as the type of a const generic parameter
|
||||||
--> $DIR/unusual-rib-combinations.rs:22:15
|
--> $DIR/unusual-rib-combinations.rs:21:15
|
||||||
|
|
|
|
||||||
LL | fn d<const C: S>() {}
|
LL | fn d<const C: S>() {}
|
||||||
| ^
|
| ^
|
||||||
|
@ -61,6 +52,18 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more
|
||||||
LL + #![feature(adt_const_params)]
|
LL + #![feature(adt_const_params)]
|
||||||
|
|
|
|
||||||
|
|
||||||
|
error: `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter
|
||||||
|
--> $DIR/unusual-rib-combinations.rs:26:21
|
||||||
|
|
|
||||||
|
LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: the only supported types are integers, `bool` and `char`
|
||||||
|
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||||
|
|
|
||||||
|
LL + #![feature(adt_const_params)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0106, E0214, E0308, E0770.
|
Some errors have detailed explanations: E0106, E0214, E0308, E0770.
|
||||||
|
|
|
@ -5,3 +5,4 @@ struct Apple((Apple, Option(Banana ? Citron)));
|
||||||
//~| ERROR expected one of `)` or `,`, found `Citron`
|
//~| ERROR expected one of `)` or `,`, found `Citron`
|
||||||
//~| ERROR cannot find type `Citron` in this scope [E0412]
|
//~| ERROR cannot find type `Citron` in this scope [E0412]
|
||||||
//~| ERROR parenthesized type parameters may only be used with a `Fn` trait [E0214]
|
//~| ERROR parenthesized type parameters may only be used with a `Fn` trait [E0214]
|
||||||
|
//~| ERROR `Apple` has infinite size
|
||||||
|
|
|
@ -34,7 +34,18 @@ help: use angle brackets instead
|
||||||
LL | struct Apple((Apple, Option<Banana ? Citron>));
|
LL | struct Apple((Apple, Option<Banana ? Citron>));
|
||||||
| ~ ~
|
| ~ ~
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error[E0072]: recursive type `Apple` has infinite size
|
||||||
|
--> $DIR/issue-103748-ICE-wrong-braces.rs:3:1
|
||||||
|
|
|
||||||
|
LL | struct Apple((Apple, Option(Banana ? Citron)));
|
||||||
|
| ^^^^^^^^^^^^ ----- recursive without indirection
|
||||||
|
|
|
||||||
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
||||||
|
|
|
||||||
|
LL | struct Apple((Box<Apple>, Option(Banana ? Citron)));
|
||||||
|
| ++++ +
|
||||||
|
|
||||||
Some errors have detailed explanations: E0214, E0412.
|
error: aborting due to 5 previous errors
|
||||||
For more information about an error, try `rustc --explain E0214`.
|
|
||||||
|
Some errors have detailed explanations: E0072, E0214, E0412.
|
||||||
|
For more information about an error, try `rustc --explain E0072`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue