Auto merge of #108421 - Dylan-DPC:rollup-mpeovxd, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #106541 (implement const iterator using `rustc_do_not_const_check`)
 - #106918 (Rebuild BinaryHeap on unwind from retain)
 - #106923 (Restore behavior when primary bundle is missing)
 - #108169 (Make query keys `Copy`)
 - #108287 (Add test for bad cast with deferred projection equality)
 - #108370 (std: time: Avoid to use "was created" in elapsed() description)
 - #108377 (Fix ICE in 'duplicate diagnostic item' diagnostic)
 - #108388 (parser: provide better suggestions and errors on closures with braces missing)
 - #108391 (Fix `is_terminal`'s handling of long paths on Windows.)
 - #108401 (diagnostics: remove inconsistent English article "this" from E0107)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2023-02-24 20:49:11 +00:00
commit c5c7d2b377
144 changed files with 742 additions and 409 deletions

View File

@ -135,7 +135,10 @@ pub fn fluent_bundle(
let fallback_locale = langid!("en-US");
let requested_fallback_locale = requested_locale.as_ref() == Some(&fallback_locale);
trace!(?requested_fallback_locale);
if requested_fallback_locale && additional_ftl_path.is_none() {
return Ok(None);
}
// If there is only `-Z additional-ftl-path`, assume locale is "en-US", otherwise use user
// provided locale.
let locale = requested_locale.clone().unwrap_or(fallback_locale);
@ -153,7 +156,7 @@ pub fn fluent_bundle(
bundle.set_use_isolating(with_directionality_markers);
// If the user requests the default locale then don't try to load anything.
if !requested_fallback_locale && let Some(requested_locale) = requested_locale {
if let Some(requested_locale) = requested_locale {
let mut found_resources = false;
for sysroot in user_provided_sysroot.iter_mut().chain(sysroot_candidates.iter_mut()) {
sysroot.push("share");

View File

@ -1,4 +1,4 @@
use crate::error::TranslateError;
use crate::error::{TranslateError, TranslateErrorKind};
use crate::snippet::Style;
use crate::{DiagnosticArg, DiagnosticMessage, FluentBundle};
use rustc_data_structures::sync::Lrc;
@ -95,6 +95,16 @@ pub trait Translate {
// The primary bundle was present and translation succeeded
Some(Ok(t)) => t,
// If `translate_with_bundle` returns `Err` with the primary bundle, this is likely
// just that the primary bundle doesn't contain the message being translated, so
// proceed to the fallback bundle.
Some(Err(
primary @ TranslateError::One {
kind: TranslateErrorKind::MessageMissing, ..
},
)) => translate_with_bundle(self.fallback_fluent_bundle())
.map_err(|fallback| primary.and(fallback))?,
// Always yeet out for errors on debug (unless
// `RUSTC_TRANSLATION_NO_DEBUG_ASSERT` is set in the environment - this allows
// local runs of the test suites, of builds with debug assertions, to test the
@ -106,9 +116,8 @@ pub trait Translate {
do yeet primary
}
// If `translate_with_bundle` returns `Err` with the primary bundle, this is likely
// just that the primary bundle doesn't contain the message being translated or
// something else went wrong) so proceed to the fallback bundle.
// ..otherwise, for end users, an error about this wouldn't be useful or actionable, so
// just hide it and try with the fallback bundle.
Some(Err(primary)) => translate_with_bundle(self.fallback_fluent_bundle())
.map_err(|fallback| primary.and(fallback))?,

View File

@ -462,7 +462,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
if self.gen_args.span_ext().is_some() {
format!(
"this {} takes {}{} {} argument{} but {} {} supplied",
"{} takes {}{} {} argument{} but {} {} supplied",
def_kind,
quantifier,
bound,

View File

@ -71,7 +71,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::config;
use rustc_session::Session;
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::Span;
use rustc_span::{sym, Span};
fluent_messages! { "../locales/en-US.ftl" }
@ -207,6 +207,11 @@ fn typeck_with_fallback<'tcx>(
let typeck_results = Inherited::build(tcx, def_id).enter(|inh| {
let param_env = tcx.param_env(def_id);
let param_env = if tcx.has_attr(def_id.to_def_id(), sym::rustc_do_not_const_check) {
param_env.without_const()
} else {
param_env
};
let mut fcx = FnCtxt::new(&inh, param_env, def_id);
if let Some(hir::FnSig { header, decl, .. }) = fn_sig {

View File

@ -982,7 +982,11 @@ impl<'a> Parser<'a> {
let initial_semicolon = self.token.span;
while self.eat(&TokenKind::Semi) {
let _ = self.parse_stmt(ForceCollect::Yes)?;
let _ =
self.parse_stmt_without_recovery(false, ForceCollect::Yes).unwrap_or_else(|e| {
e.cancel();
None
});
}
expect_err.set_primary_message(

View File

@ -407,10 +407,10 @@ passes_duplicate_diagnostic_item =
passes_duplicate_diagnostic_item_in_crate =
duplicate diagnostic item in crate `{$crate_name}`: `{$name}`.
.note = the diagnostic item is first defined in crate `{$orig_crate_name}`.
passes_diagnostic_item_first_defined =
the diagnostic item is first defined here
.note = the diagnostic item is first defined in crate `{$orig_crate_name}`.
passes_abi =
abi: {$abi}

View File

@ -21,7 +21,7 @@ pub trait QueryStorage {
}
pub trait QueryCache: QueryStorage + Sized {
type Key: Hash + Eq + Clone + Debug;
type Key: Hash + Eq + Copy + Debug;
/// Checks if the query is already computed and in the cache.
/// It returns the shard index and a lock guard to the shard,
@ -61,7 +61,7 @@ impl<K: Eq + Hash, V: Copy + Debug> QueryStorage for DefaultCache<K, V> {
impl<K, V> QueryCache for DefaultCache<K, V>
where
K: Eq + Hash + Clone + Debug,
K: Eq + Hash + Copy + Debug,
V: Copy + Debug,
{
type Key = K;
@ -179,7 +179,7 @@ impl<K: Eq + Idx, V: Copy + Debug> QueryStorage for VecCache<K, V> {
impl<K, V> QueryCache for VecCache<K, V>
where
K: Eq + Idx + Clone + Debug,
K: Eq + Idx + Copy + Debug,
V: Copy + Debug,
{
type Key = K;

View File

@ -19,7 +19,9 @@ pub type TryLoadFromDisk<Qcx, Q> =
pub trait QueryConfig<Qcx: QueryContext> {
const NAME: &'static str;
type Key: DepNodeParams<Qcx::DepContext> + Eq + Hash + Clone + Debug;
// `Key` and `Value` are `Copy` instead of `Clone` to ensure copying them stays cheap,
// but it isn't necessary.
type Key: DepNodeParams<Qcx::DepContext> + Eq + Hash + Copy + Debug;
type Value: Debug + Copy;
type Cache: QueryCache<Key = Self::Key, Value = Self::Value>;

View File

@ -48,7 +48,7 @@ enum QueryResult<D: DepKind> {
impl<K, D> QueryState<K, D>
where
K: Eq + Hash + Clone + Debug,
K: Eq + Hash + Copy + Debug,
D: DepKind,
{
pub fn all_inactive(&self) -> bool {
@ -77,7 +77,7 @@ where
for shard in shards.iter() {
for (k, v) in shard.iter() {
if let QueryResult::Started(ref job) = *v {
let query = make_query(qcx, k.clone());
let query = make_query(qcx, *k);
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
}
}
@ -91,7 +91,7 @@ where
// really hurt much.)
for (k, v) in self.active.try_lock()?.iter() {
if let QueryResult::Started(ref job) = *v {
let query = make_query(qcx, k.clone());
let query = make_query(qcx, *k);
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
}
}
@ -111,7 +111,7 @@ impl<K, D: DepKind> Default for QueryState<K, D> {
/// This will poison the relevant query if dropped.
struct JobOwner<'tcx, K, D: DepKind>
where
K: Eq + Hash + Clone,
K: Eq + Hash + Copy,
{
state: &'tcx QueryState<K, D>,
key: K,
@ -163,7 +163,7 @@ where
impl<'tcx, K, D: DepKind> JobOwner<'tcx, K, D>
where
K: Eq + Hash + Clone,
K: Eq + Hash + Copy,
{
/// Either gets a `JobOwner` corresponding the query, allowing us to
/// start executing the query, or returns with the result of the query.
@ -195,7 +195,7 @@ where
let job = qcx.current_query_job();
let job = QueryJob::new(id, span, job);
let key = entry.key().clone();
let key = *entry.key();
entry.insert(QueryResult::Started(job));
let owner = JobOwner { state, id, key };
@ -274,7 +274,7 @@ where
impl<'tcx, K, D> Drop for JobOwner<'tcx, K, D>
where
K: Eq + Hash + Clone,
K: Eq + Hash + Copy,
D: DepKind,
{
#[inline(never)]
@ -291,7 +291,7 @@ where
QueryResult::Started(job) => job,
QueryResult::Poisoned => panic!(),
};
shard.insert(self.key.clone(), QueryResult::Poisoned);
shard.insert(self.key, QueryResult::Poisoned);
job
};
// Also signal the completion of the job, so waiters
@ -310,7 +310,7 @@ pub(crate) struct CycleError<D: DepKind> {
/// The result of `try_start`.
enum TryGetJob<'tcx, K, D>
where
K: Eq + Hash + Clone,
K: Eq + Hash + Copy,
D: DepKind,
{
/// The query is not yet started. Contains a guard to the cache eventually used to start it.
@ -358,10 +358,9 @@ where
Q: QueryConfig<Qcx>,
Qcx: QueryContext,
{
match JobOwner::<'_, Q::Key, Qcx::DepKind>::try_start(&qcx, state, span, key.clone()) {
match JobOwner::<'_, Q::Key, Qcx::DepKind>::try_start(&qcx, state, span, key) {
TryGetJob::NotYetStarted(job) => {
let (result, dep_node_index) =
execute_job::<Q, Qcx>(qcx, key.clone(), dep_node, job.id);
let (result, dep_node_index) = execute_job::<Q, Qcx>(qcx, key, dep_node, job.id);
if Q::FEEDABLE {
// We should not compute queries that also got a value via feeding.
// This can't happen, as query feeding adds the very dependencies to the fed query
@ -551,7 +550,7 @@ where
let prof_timer = qcx.dep_context().profiler().query_provider();
// The dep-graph for this computation is already in-place.
let result = dep_graph.with_ignore(|| Q::compute(qcx, key.clone()));
let result = dep_graph.with_ignore(|| Q::compute(qcx, *key));
prof_timer.finish_with_query_invocation_id(dep_node_index.into());

View File

@ -851,18 +851,30 @@ impl<T: Ord> BinaryHeap<T> {
where
F: FnMut(&T) -> bool,
{
let mut first_removed = self.len();
struct RebuildOnDrop<'a, T: Ord> {
heap: &'a mut BinaryHeap<T>,
first_removed: usize,
}
let mut guard = RebuildOnDrop { first_removed: self.len(), heap: self };
let mut i = 0;
self.data.retain(|e| {
guard.heap.data.retain(|e| {
let keep = f(e);
if !keep && i < first_removed {
first_removed = i;
if !keep && i < guard.first_removed {
guard.first_removed = i;
}
i += 1;
keep
});
// data[0..first_removed] is untouched, so we only need to rebuild the tail:
self.rebuild_tail(first_removed);
impl<'a, T: Ord> Drop for RebuildOnDrop<'a, T> {
fn drop(&mut self) {
// data[..first_removed] is untouched, so we only need to
// rebuild the tail:
self.heap.rebuild_tail(self.first_removed);
}
}
}
}

View File

@ -474,6 +474,25 @@ fn test_retain() {
assert!(a.is_empty());
}
#[test]
fn test_retain_catch_unwind() {
let mut heap = BinaryHeap::from(vec![3, 1, 2]);
// Removes the 3, then unwinds out of retain.
let _ = catch_unwind(AssertUnwindSafe(|| {
heap.retain(|e| {
if *e == 1 {
panic!();
}
false
});
}));
// Naively this would be [1, 2] (an invalid heap) if BinaryHeap delegates to
// Vec's retain impl and then does not rebuild the heap after that unwinds.
assert_eq!(heap.into_vec(), [2, 1]);
}
// old binaryheap failed this test
//
// Integrity means that all elements are present after a comparison panics,

View File

@ -69,6 +69,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
#[doc(notable_trait)]
#[rustc_diagnostic_item = "Iterator"]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[cfg_attr(not(bootstrap), const_trait)]
pub trait Iterator {
/// The type of the elements being iterated over.
#[rustc_diagnostic_item = "IteratorItem"]
@ -141,6 +142,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "iter_next_chunk", reason = "recently added", issue = "98326")]
#[rustc_do_not_const_check]
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], array::IntoIter<Self::Item, N>>
@ -218,6 +220,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn size_hint(&self) -> (usize, Option<usize>) {
(0, None)
}
@ -255,6 +258,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn count(self) -> usize
where
Self: Sized,
@ -285,6 +289,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn last(self) -> Option<Self::Item>
where
Self: Sized,
@ -331,6 +336,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "iter_advance_by", reason = "recently added", issue = "77404")]
#[rustc_do_not_const_check]
fn advance_by(&mut self, n: usize) -> Result<(), usize> {
for i in 0..n {
self.next().ok_or(i)?;
@ -379,6 +385,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.advance_by(n).ok()?;
self.next()
@ -431,6 +438,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_step_by", since = "1.28.0")]
#[rustc_do_not_const_check]
fn step_by(self, step: usize) -> StepBy<Self>
where
Self: Sized,
@ -502,6 +510,7 @@ pub trait Iterator {
/// [`OsStr`]: ../../std/ffi/struct.OsStr.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter>
where
Self: Sized,
@ -620,6 +629,7 @@ pub trait Iterator {
/// [`zip`]: crate::iter::zip
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
where
Self: Sized,
@ -662,6 +672,7 @@ pub trait Iterator {
/// [`intersperse_with`]: Iterator::intersperse_with
#[inline]
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
#[rustc_do_not_const_check]
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where
Self: Sized,
@ -720,6 +731,7 @@ pub trait Iterator {
/// [`intersperse`]: Iterator::intersperse
#[inline]
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
#[rustc_do_not_const_check]
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where
Self: Sized,
@ -779,6 +791,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn map<B, F>(self, f: F) -> Map<Self, F>
where
Self: Sized,
@ -824,6 +837,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_for_each", since = "1.21.0")]
#[rustc_do_not_const_check]
fn for_each<F>(self, f: F)
where
Self: Sized,
@ -899,6 +913,7 @@ pub trait Iterator {
/// Note that `iter.filter(f).next()` is equivalent to `iter.find(f)`.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn filter<P>(self, predicate: P) -> Filter<Self, P>
where
Self: Sized,
@ -944,6 +959,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where
Self: Sized,
@ -990,6 +1006,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn enumerate(self) -> Enumerate<Self>
where
Self: Sized,
@ -1061,6 +1078,7 @@ pub trait Iterator {
/// [`next`]: Iterator::next
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn peekable(self) -> Peekable<Self>
where
Self: Sized,
@ -1126,6 +1144,7 @@ pub trait Iterator {
#[inline]
#[doc(alias = "drop_while")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where
Self: Sized,
@ -1207,6 +1226,7 @@ pub trait Iterator {
/// the iteration should stop, but wasn't placed back into the iterator.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where
Self: Sized,
@ -1295,6 +1315,7 @@ pub trait Iterator {
/// [`fuse`]: Iterator::fuse
#[inline]
#[stable(feature = "iter_map_while", since = "1.57.0")]
#[rustc_do_not_const_check]
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where
Self: Sized,
@ -1326,6 +1347,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn skip(self, n: usize) -> Skip<Self>
where
Self: Sized,
@ -1379,6 +1401,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn take(self, n: usize) -> Take<Self>
where
Self: Sized,
@ -1428,6 +1451,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where
Self: Sized,
@ -1468,6 +1492,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where
Self: Sized,
@ -1552,6 +1577,7 @@ pub trait Iterator {
/// [`flat_map()`]: Iterator::flat_map
#[inline]
#[stable(feature = "iterator_flatten", since = "1.29.0")]
#[rustc_do_not_const_check]
fn flatten(self) -> Flatten<Self>
where
Self: Sized,
@ -1620,6 +1646,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn fuse(self) -> Fuse<Self>
where
Self: Sized,
@ -1704,6 +1731,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn inspect<F>(self, f: F) -> Inspect<Self, F>
where
Self: Sized,
@ -1734,6 +1762,7 @@ pub trait Iterator {
/// assert_eq!(of_rust, vec!["of", "Rust"]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn by_ref(&mut self) -> &mut Self
where
Self: Sized,
@ -1853,6 +1882,7 @@ pub trait Iterator {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"]
#[cfg_attr(not(test), rustc_diagnostic_item = "iterator_collect_fn")]
#[rustc_do_not_const_check]
fn collect<B: FromIterator<Self::Item>>(self) -> B
where
Self: Sized,
@ -1931,6 +1961,7 @@ pub trait Iterator {
/// [`collect`]: Iterator::collect
#[inline]
#[unstable(feature = "iterator_try_collect", issue = "94047")]
#[rustc_do_not_const_check]
fn try_collect<B>(&mut self) -> ChangeOutputType<Self::Item, B>
where
Self: Sized,
@ -2004,6 +2035,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "iter_collect_into", reason = "new API", issue = "94780")]
#[rustc_do_not_const_check]
fn collect_into<E: Extend<Self::Item>>(self, collection: &mut E) -> &mut E
where
Self: Sized,
@ -2038,6 +2070,7 @@ pub trait Iterator {
/// assert_eq!(odd, vec![1, 3]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn partition<B, F>(self, f: F) -> (B, B)
where
Self: Sized,
@ -2100,6 +2133,7 @@ pub trait Iterator {
/// assert!(a[i..].iter().all(|&n| n % 2 == 1)); // odds
/// ```
#[unstable(feature = "iter_partition_in_place", reason = "new API", issue = "62543")]
#[rustc_do_not_const_check]
fn partition_in_place<'a, T: 'a, P>(mut self, ref mut predicate: P) -> usize
where
Self: Sized + DoubleEndedIterator<Item = &'a mut T>,
@ -2157,6 +2191,7 @@ pub trait Iterator {
/// assert!(!"IntoIterator".chars().is_partitioned(char::is_uppercase));
/// ```
#[unstable(feature = "iter_is_partitioned", reason = "new API", issue = "62544")]
#[rustc_do_not_const_check]
fn is_partitioned<P>(mut self, mut predicate: P) -> bool
where
Self: Sized,
@ -2251,6 +2286,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_try_fold", since = "1.27.0")]
#[rustc_do_not_const_check]
fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized,
@ -2309,6 +2345,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_try_fold", since = "1.27.0")]
#[rustc_do_not_const_check]
fn try_for_each<F, R>(&mut self, f: F) -> R
where
Self: Sized,
@ -2428,6 +2465,7 @@ pub trait Iterator {
#[doc(alias = "inject", alias = "foldl")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn fold<B, F>(mut self, init: B, mut f: F) -> B
where
Self: Sized,
@ -2465,6 +2503,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_fold_self", since = "1.51.0")]
#[rustc_do_not_const_check]
fn reduce<F>(mut self, f: F) -> Option<Self::Item>
where
Self: Sized,
@ -2536,6 +2575,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "iterator_try_reduce", reason = "new API", issue = "87053")]
#[rustc_do_not_const_check]
fn try_reduce<F, R>(&mut self, f: F) -> ChangeOutputType<R, Option<R::Output>>
where
Self: Sized,
@ -2593,6 +2633,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn all<F>(&mut self, f: F) -> bool
where
Self: Sized,
@ -2646,6 +2687,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn any<F>(&mut self, f: F) -> bool
where
Self: Sized,
@ -2709,6 +2751,7 @@ pub trait Iterator {
/// Note that `iter.find(f)` is equivalent to `iter.filter(f).next()`.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where
Self: Sized,
@ -2740,6 +2783,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iterator_find_map", since = "1.30.0")]
#[rustc_do_not_const_check]
fn find_map<B, F>(&mut self, f: F) -> Option<B>
where
Self: Sized,
@ -2796,6 +2840,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "try_find", reason = "new API", issue = "63178")]
#[rustc_do_not_const_check]
fn try_find<F, R>(&mut self, f: F) -> ChangeOutputType<R, Option<Self::Item>>
where
Self: Sized,
@ -2878,6 +2923,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn position<P>(&mut self, predicate: P) -> Option<usize>
where
Self: Sized,
@ -2935,6 +2981,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where
P: FnMut(Self::Item) -> bool,
@ -2986,6 +3033,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn max(self) -> Option<Self::Item>
where
Self: Sized,
@ -3024,6 +3072,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn min(self) -> Option<Self::Item>
where
Self: Sized,
@ -3046,6 +3095,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iter_cmp_by_key", since = "1.6.0")]
#[rustc_do_not_const_check]
fn max_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>
where
Self: Sized,
@ -3079,6 +3129,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iter_max_by", since = "1.15.0")]
#[rustc_do_not_const_check]
fn max_by<F>(self, compare: F) -> Option<Self::Item>
where
Self: Sized,
@ -3106,6 +3157,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iter_cmp_by_key", since = "1.6.0")]
#[rustc_do_not_const_check]
fn min_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>
where
Self: Sized,
@ -3139,6 +3191,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "iter_min_by", since = "1.15.0")]
#[rustc_do_not_const_check]
fn min_by<F>(self, compare: F) -> Option<Self::Item>
where
Self: Sized,
@ -3176,6 +3229,7 @@ pub trait Iterator {
#[inline]
#[doc(alias = "reverse")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn rev(self) -> Rev<Self>
where
Self: Sized + DoubleEndedIterator,
@ -3214,6 +3268,7 @@ pub trait Iterator {
/// assert_eq!(z, [3, 6]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where
FromA: Default + Extend<A>,
@ -3246,6 +3301,7 @@ pub trait Iterator {
/// assert_eq!(v_map, vec![1, 2, 3]);
/// ```
#[stable(feature = "iter_copied", since = "1.36.0")]
#[rustc_do_not_const_check]
fn copied<'a, T: 'a>(self) -> Copied<Self>
where
Self: Sized + Iterator<Item = &'a T>,
@ -3293,6 +3349,7 @@ pub trait Iterator {
/// assert_eq!(&[vec![23]], &faster[..]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_do_not_const_check]
fn cloned<'a, T: 'a>(self) -> Cloned<Self>
where
Self: Sized + Iterator<Item = &'a T>,
@ -3327,6 +3384,7 @@ pub trait Iterator {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
#[rustc_do_not_const_check]
fn cycle(self) -> Cycle<Self>
where
Self: Sized + Clone,
@ -3370,6 +3428,7 @@ pub trait Iterator {
/// ```
#[track_caller]
#[unstable(feature = "iter_array_chunks", reason = "recently added", issue = "100450")]
#[rustc_do_not_const_check]
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where
Self: Sized,
@ -3400,6 +3459,7 @@ pub trait Iterator {
/// assert_eq!(sum, 6);
/// ```
#[stable(feature = "iter_arith", since = "1.11.0")]
#[rustc_do_not_const_check]
fn sum<S>(self) -> S
where
Self: Sized,
@ -3429,6 +3489,7 @@ pub trait Iterator {
/// assert_eq!(factorial(5), 120);
/// ```
#[stable(feature = "iter_arith", since = "1.11.0")]
#[rustc_do_not_const_check]
fn product<P>(self) -> P
where
Self: Sized,
@ -3450,6 +3511,7 @@ pub trait Iterator {
/// assert_eq!([1, 2].iter().cmp([1].iter()), Ordering::Greater);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn cmp<I>(self, other: I) -> Ordering
where
I: IntoIterator<Item = Self::Item>,
@ -3479,6 +3541,7 @@ pub trait Iterator {
/// assert_eq!(xs.iter().cmp_by(&ys, |&x, &y| (2 * x).cmp(&y)), Ordering::Greater);
/// ```
#[unstable(feature = "iter_order_by", issue = "64295")]
#[rustc_do_not_const_check]
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where
Self: Sized,
@ -3535,6 +3598,7 @@ pub trait Iterator {
/// ```
///
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where
I: IntoIterator,
@ -3573,6 +3637,7 @@ pub trait Iterator {
/// );
/// ```
#[unstable(feature = "iter_order_by", issue = "64295")]
#[rustc_do_not_const_check]
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where
Self: Sized,
@ -3606,6 +3671,7 @@ pub trait Iterator {
/// assert_eq!([1].iter().eq([1, 2].iter()), false);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn eq<I>(self, other: I) -> bool
where
I: IntoIterator,
@ -3631,6 +3697,7 @@ pub trait Iterator {
/// assert!(xs.iter().eq_by(&ys, |&x, &y| x * x == y));
/// ```
#[unstable(feature = "iter_order_by", issue = "64295")]
#[rustc_do_not_const_check]
fn eq_by<I, F>(self, other: I, eq: F) -> bool
where
Self: Sized,
@ -3663,6 +3730,7 @@ pub trait Iterator {
/// assert_eq!([1].iter().ne([1, 2].iter()), true);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn ne<I>(self, other: I) -> bool
where
I: IntoIterator,
@ -3684,6 +3752,7 @@ pub trait Iterator {
/// assert_eq!([1, 2].iter().lt([1, 2].iter()), false);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn lt<I>(self, other: I) -> bool
where
I: IntoIterator,
@ -3705,6 +3774,7 @@ pub trait Iterator {
/// assert_eq!([1, 2].iter().le([1, 2].iter()), true);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn le<I>(self, other: I) -> bool
where
I: IntoIterator,
@ -3726,6 +3796,7 @@ pub trait Iterator {
/// assert_eq!([1, 2].iter().gt([1, 2].iter()), false);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn gt<I>(self, other: I) -> bool
where
I: IntoIterator,
@ -3747,6 +3818,7 @@ pub trait Iterator {
/// assert_eq!([1, 2].iter().ge([1, 2].iter()), true);
/// ```
#[stable(feature = "iter_order", since = "1.5.0")]
#[rustc_do_not_const_check]
fn ge<I>(self, other: I) -> bool
where
I: IntoIterator,
@ -3778,6 +3850,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
#[rustc_do_not_const_check]
fn is_sorted(self) -> bool
where
Self: Sized,
@ -3806,6 +3879,7 @@ pub trait Iterator {
///
/// [`is_sorted`]: Iterator::is_sorted
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
#[rustc_do_not_const_check]
fn is_sorted_by<F>(mut self, compare: F) -> bool
where
Self: Sized,
@ -3852,6 +3926,7 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
#[rustc_do_not_const_check]
fn is_sorted_by_key<F, K>(self, f: F) -> bool
where
Self: Sized,
@ -3867,6 +3942,7 @@ pub trait Iterator {
#[inline]
#[doc(hidden)]
#[unstable(feature = "trusted_random_access", issue = "none")]
#[rustc_do_not_const_check]
unsafe fn __iterator_get_unchecked(&mut self, _idx: usize) -> Self::Item
where
Self: TrustedRandomAccessNoCoerce,

View File

@ -194,6 +194,7 @@
#![feature(cfg_target_has_atomic_equal_alignment)]
#![feature(const_closures)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_for)]
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
#![feature(const_refs_to_cell)]

View File

@ -539,14 +539,6 @@ pub struct SYMBOLIC_LINK_REPARSE_BUFFER {
pub PathBuffer: WCHAR,
}
/// NB: Use carefully! In general using this as a reference is likely to get the
/// provenance wrong for the `PathBuffer` field!
#[repr(C)]
pub struct FILE_NAME_INFO {
pub FileNameLength: DWORD,
pub FileName: [WCHAR; 1],
}
#[repr(C)]
pub struct MOUNT_POINT_REPARSE_BUFFER {
pub SubstituteNameOffset: c_ushort,

View File

@ -2,8 +2,7 @@ use crate::marker::PhantomData;
use crate::mem::size_of;
use crate::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle};
use crate::slice;
use crate::sys::{c, Align8};
use core;
use crate::sys::c;
use libc;
#[derive(Copy, Clone)]
@ -125,22 +124,33 @@ unsafe fn msys_tty_on(handle: c::HANDLE) -> bool {
return false;
}
const SIZE: usize = size_of::<c::FILE_NAME_INFO>() + c::MAX_PATH * size_of::<c::WCHAR>();
let mut name_info_bytes = Align8([0u8; SIZE]);
/// Mirrors [`FILE_NAME_INFO`], giving it a fixed length that we can stack
/// allocate
///
/// [`FILE_NAME_INFO`]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_name_info
#[repr(C)]
#[allow(non_snake_case)]
struct FILE_NAME_INFO {
FileNameLength: u32,
FileName: [u16; c::MAX_PATH as usize],
}
let mut name_info = FILE_NAME_INFO { FileNameLength: 0, FileName: [0; c::MAX_PATH as usize] };
// Safety: buffer length is fixed.
let res = c::GetFileInformationByHandleEx(
handle,
c::FileNameInfo,
name_info_bytes.0.as_mut_ptr() as *mut libc::c_void,
SIZE as u32,
&mut name_info as *mut _ as *mut libc::c_void,
size_of::<FILE_NAME_INFO>() as u32,
);
if res == 0 {
return false;
}
let name_info: &c::FILE_NAME_INFO = &*(name_info_bytes.0.as_ptr() as *const c::FILE_NAME_INFO);
let name_len = name_info.FileNameLength as usize / 2;
// Offset to get the `FileName` field.
let name_ptr = name_info_bytes.0.as_ptr().offset(size_of::<c::DWORD>() as isize).cast::<u16>();
let s = core::slice::from_raw_parts(name_ptr, name_len);
// Use `get` because `FileNameLength` can be out of range.
let s = match name_info.FileName.get(..name_info.FileNameLength as usize / 2) {
None => return false,
Some(s) => s,
};
let name = String::from_utf16_lossy(s);
// Get the file name only.
let name = name.rsplit('\\').next().unwrap_or(&name);

View File

@ -352,7 +352,7 @@ impl Instant {
self.checked_duration_since(earlier).unwrap_or_default()
}
/// Returns the amount of time elapsed since this instant was created.
/// Returns the amount of time elapsed since this instant.
///
/// # Panics
///
@ -525,8 +525,8 @@ impl SystemTime {
self.0.sub_time(&earlier.0).map_err(SystemTimeError)
}
/// Returns the difference between the clock time when this
/// system time was created, and the current clock time.
/// Returns the difference from this system time to the
/// current clock time.
///
/// This function may fail as the underlying system clock is susceptible to
/// drift and updates (e.g., the system clock could go backwards), so this

View File

@ -1,4 +1,4 @@
error[E0107]: this 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
|
LL | field1: dyn Bar<'a, 'b,>,

View File

@ -1,4 +1,4 @@
error[E0107]: this function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-100154.rs:4:5
|
LL | foo::<()>(());

View File

@ -3,7 +3,7 @@
// edition:2018
async fn copy() -> Result<()>
//~^ ERROR this enum takes 2 generic arguments
//~^ ERROR enum takes 2 generic arguments
{
Ok(())
}

View File

@ -1,4 +1,4 @@
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-65159.rs:5:20
|
LL | async fn copy() -> Result<()>

View File

@ -14,8 +14,8 @@ impl MarketMultiplier {
}
async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied
LockedMarket(generator.lock().unwrap().buy())
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
@ -12,7 +12,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {

View File

@ -7,8 +7,8 @@ trait X {
const _: () = {
fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
//~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument
//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
};
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
@ -14,7 +14,7 @@ help: add missing lifetime argument
LL | fn f2<'a>(arg: Box<dyn X<Y<'_, 1> = &'a ()>>) {}
| +++
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}

View File

@ -1,4 +1,4 @@
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-76595.rs:15:5
|
LL | test::<2>();

View File

@ -1,4 +1,4 @@
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/incorrect-number-of-const-args.rs:6:5
|
LL | foo::<0>();
@ -16,7 +16,7 @@ help: add missing generic argument
LL | foo::<0, Y>();
| +++
error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied
error[E0107]: function takes 2 generic arguments but 3 generic arguments were supplied
--> $DIR/incorrect-number-of-const-args.rs:9:5
|
LL | foo::<0, 0, 0>();

View File

@ -4,11 +4,11 @@ struct S;
fn main() {
let _: u32 = 5i32.try_into::<32>().unwrap();
//~^ ERROR this method takes
//~^ ERROR method takes
S.f::<0>();
//~^ ERROR no method named `f`
S::<0>;
//~^ ERROR this struct takes 0
//~^ ERROR struct takes 0
}

View File

@ -1,4 +1,4 @@
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/invalid-const-arg-for-type-param.rs:6:23
|
LL | let _: u32 = 5i32.try_into::<32>().unwrap();
@ -23,7 +23,7 @@ LL | struct S;
LL | S.f::<0>();
| ^ method not found in `S`
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
|
LL | S::<0>;

View File

@ -2,5 +2,5 @@ use std::cell::Cell;
fn main() {
let _: Cell<&str, "a"> = Cell::new("");
//~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied
//~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/invalid-constant-in-args.rs:4:12
|
LL | let _: Cell<&str, "a"> = Cell::new("");

View File

@ -7,7 +7,7 @@ where
S: MyTrait,
T: MyTrait<Assoc == S::Assoc>,
//~^ ERROR: expected one of `,` or `>`, found `==`
//~| ERROR: this trait takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
{
}

View File

@ -9,7 +9,7 @@ help: if you meant to use an associated type binding, replace `==` with `=`
LL | T: MyTrait<Assoc = S::Assoc>,
| ~
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-87493.rs:8:8
|
LL | T: MyTrait<Assoc == S::Assoc>,

View File

@ -7,7 +7,7 @@ struct Bar;
const T: usize = 42;
impl Foo<N = 3> for Bar {
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
//~^ ERROR trait takes 1 generic argument but 0 generic arguments were supplied
//~| ERROR associated type bindings are not allowed here
//~| ERROR associated const equality is incomplete
fn do_x(&self) -> [u8; 3] {

View File

@ -7,7 +7,7 @@ LL | impl Foo<N = 3> for Bar {
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
error[E0107]: this 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/issue-89013-no-kw.rs:9:6
|
LL | impl Foo<N = 3> for Bar {

View File

@ -8,7 +8,7 @@ const T: usize = 42;
impl Foo<N = const 3> for Bar {
//~^ ERROR expected lifetime, type, or constant, found keyword `const`
//~| ERROR this trait takes 1 generic
//~| ERROR trait takes 1 generic
//~| ERROR associated type bindings are not allowed here
//~| ERROR associated const equality is incomplete
fn do_x(&self) -> [u8; 3] {

View File

@ -19,7 +19,7 @@ LL | impl Foo<N = const 3> for Bar {
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
error[E0107]: this 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/issue-89013.rs:9:6
|
LL | impl Foo<N = const 3> for Bar {

View File

@ -15,12 +15,12 @@ enum E<'a, 'b> {
fn main() {
S(&0, &0); // OK
S::<'static>(&0, &0);
//~^ ERROR this struct takes 2 lifetime arguments
//~^ ERROR struct takes 2 lifetime arguments
S::<'static, 'static, 'static>(&0, &0);
//~^ ERROR this struct takes 2 lifetime arguments
//~^ ERROR struct takes 2 lifetime arguments
E::V(&0); // OK
E::V::<'static>(&0);
//~^ ERROR this enum takes 2 lifetime arguments
//~^ ERROR enum takes 2 lifetime arguments
E::V::<'static, 'static, 'static>(&0);
//~^ ERROR this enum takes 2 lifetime arguments
//~^ ERROR enum takes 2 lifetime arguments
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/constructor-lifetime-args.rs:17:5
|
LL | S::<'static>(&0, &0);
@ -16,7 +16,7 @@ help: add missing lifetime argument
LL | S::<'static, 'static>(&0, &0);
| +++++++++
error[E0107]: this struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
--> $DIR/constructor-lifetime-args.rs:19:5
|
LL | S::<'static, 'static, 'static>(&0, &0);
@ -30,7 +30,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b`
LL | struct S<'a, 'b>(&'a u8, &'b u8);
| ^ -- --
error[E0107]: this enum takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/constructor-lifetime-args.rs:22:8
|
LL | E::V::<'static>(&0);
@ -48,7 +48,7 @@ help: add missing lifetime argument
LL | E::V::<'static, 'static>(&0);
| +++++++++
error[E0107]: this enum takes 2 lifetime arguments but 3 lifetime arguments were supplied
error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supplied
--> $DIR/constructor-lifetime-args.rs:24:8
|
LL | E::V::<'static, 'static, 'static>(&0);

View File

@ -0,0 +1,5 @@
#[rustc_do_not_const_check]
//~^ ERROR this is an internal attribute that will never be stable
const fn foo() {}
fn main() {}

View File

@ -0,0 +1,11 @@
error[E0658]: this is an internal attribute that will never be stable
--> $DIR/gate-do-not-const-check.rs:1:1
|
LL | #[rustc_do_not_const_check]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -11,39 +11,39 @@ enum Bar {
struct Baz<'a, 'b, 'c> {
buzz: Buzz<'a>,
//~^ ERROR this struct takes 2 lifetime arguments
//~^ ERROR struct takes 2 lifetime arguments
//~| HELP add missing lifetime argument
bar: Bar<'a>,
//~^ ERROR this enum takes 0 lifetime arguments
//~^ ERROR enum takes 0 lifetime arguments
//~| HELP remove these generics
foo2: Foo<'a, 'b, 'c>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
qux1: Qux<'a, 'b, i32>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
qux2: Qux<'a, i32, 'b>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
qux3: Qux<'a, 'b, 'c, i32>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
qux4: Qux<'a, i32, 'b, 'c>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
qux5: Qux<'a, 'b, i32, 'c>,
//~^ ERROR this struct takes 1 lifetime argument
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
quux: Quux<'a, i32, 'b>,
//~^ ERROR this struct takes 0 lifetime arguments
//~^ ERROR struct takes 0 lifetime arguments
//~| HELP remove this lifetime argument
}
@ -53,7 +53,7 @@ pub trait T {
}
fn trait_bound_generic<I: T<u8, u16>>(_i: I) {
//~^ ERROR this trait takes 0 generic arguments
//~^ ERROR trait takes 0 generic arguments
//~| HELP replace the generic bounds with the associated types
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/E0107.rs:13:11
|
LL | buzz: Buzz<'a>,
@ -16,7 +16,7 @@ help: add missing lifetime argument
LL | buzz: Buzz<'a, 'a>,
| ++++
error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/E0107.rs:17:10
|
LL | bar: Bar<'a>,
@ -30,7 +30,7 @@ note: enum defined here, with 0 lifetime parameters
LL | enum Bar {
| ^^^
error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:21:11
|
LL | foo2: Foo<'a, 'b, 'c>,
@ -44,7 +44,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Foo<'a>(&'a str);
| ^^^ --
error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:25:11
|
LL | qux1: Qux<'a, 'b, i32>,
@ -58,7 +58,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:29:11
|
LL | qux2: Qux<'a, i32, 'b>,
@ -72,7 +72,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:33:11
|
LL | qux3: Qux<'a, 'b, 'c, i32>,
@ -86,7 +86,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:37:11
|
LL | qux4: Qux<'a, i32, 'b, 'c>,
@ -100,7 +100,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
--> $DIR/E0107.rs:41:11
|
LL | qux5: Qux<'a, 'b, i32, 'c>,
@ -114,7 +114,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Qux<'a, T>(&'a T);
| ^^^ --
error[E0107]: this struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
--> $DIR/E0107.rs:45:11
|
LL | quux: Quux<'a, i32, 'b>,
@ -128,7 +128,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct Quux<T>(T);
| ^^^^
error[E0107]: this trait takes 0 generic arguments but 2 generic arguments were supplied
error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied
--> $DIR/E0107.rs:55:27
|
LL | fn trait_bound_generic<I: T<u8, u16>>(_i: I) {

View File

@ -4,16 +4,23 @@
// If this recovery happens, then plenty of errors are emitted. Here, we expect
// only one error.
//
// This is part of issue #88065:
// This is part of the following issues:
// https://github.com/rust-lang/rust/issues/88065
// https://github.com/rust-lang/rust/issues/107959
// run-rustfix
fn main() {
// Closure with multiple expressions delimited by semicolon.
let num = 5;
(1..num).reduce(|a, b| {
//~^ ERROR: closure bodies that contain statements must be surrounded by braces
println!("{}", a);
a * b
}).unwrap();
// Closure with a single expression ended by a semicolon.
let mut v = vec![1, 2, 3];
v.iter_mut().for_each(|x| {*x = *x+1;});
//~^ ERROR: closure bodies that contain statements must be surrounded by braces
}

View File

@ -4,16 +4,23 @@
// If this recovery happens, then plenty of errors are emitted. Here, we expect
// only one error.
//
// This is part of issue #88065:
// This is part of the following issues:
// https://github.com/rust-lang/rust/issues/88065
// https://github.com/rust-lang/rust/issues/107959
// run-rustfix
fn main() {
// Closure with multiple expressions delimited by semicolon.
let num = 5;
(1..num).reduce(|a, b|
//~^ ERROR: closure bodies that contain statements must be surrounded by braces
println!("{}", a);
a * b
).unwrap();
// Closure with a single expression ended by a semicolon.
let mut v = vec![1, 2, 3];
v.iter_mut().for_each(|x|*x = *x+1;);
//~^ ERROR: closure bodies that contain statements must be surrounded by braces
}

View File

@ -1,5 +1,5 @@
error: closure bodies that contain statements must be surrounded by braces
--> $DIR/missing_braces_around_block.rs:14:26
--> $DIR/missing_braces_around_block.rs:16:26
|
LL | (1..num).reduce(|a, b|
| ^
@ -8,14 +8,14 @@ LL | ).unwrap();
| ^
|
note: statement found outside of a block
--> $DIR/missing_braces_around_block.rs:16:26
--> $DIR/missing_braces_around_block.rs:18:26
|
LL | println!("{}", a);
| -----------------^ this `;` turns the preceding closure into a statement
| |
| this expression is a statement because of the trailing semicolon
note: the closure body may be incorrectly delimited
--> $DIR/missing_braces_around_block.rs:14:21
--> $DIR/missing_braces_around_block.rs:16:21
|
LL | (1..num).reduce(|a, b|
| _____________________^
@ -34,5 +34,30 @@ LL | a * b
LL ~ }).unwrap();
|
error: aborting due to previous error
error: closure bodies that contain statements must be surrounded by braces
--> $DIR/missing_braces_around_block.rs:24:29
|
LL | v.iter_mut().for_each(|x|*x = *x+1;);
| ^ ^
|
note: statement found outside of a block
--> $DIR/missing_braces_around_block.rs:24:39
|
LL | v.iter_mut().for_each(|x|*x = *x+1;);
| ---------^ this `;` turns the preceding closure into a statement
| |
| this expression is a statement because of the trailing semicolon
note: the closure body may be incorrectly delimited
--> $DIR/missing_braces_around_block.rs:24:27
|
LL | v.iter_mut().for_each(|x|*x = *x+1;);
| ^^^^^^^^^^^^ - ...but likely you meant the closure to end here
| |
| this is the parsed closure...
help: try adding braces
|
LL | v.iter_mut().for_each(|x| {*x = *x+1;});
| + +
error: aborting due to 2 previous errors

View File

@ -5,12 +5,12 @@ trait X {
fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
//~^ ERROR: lifetime in trait object type must be followed by `+`
//~| ERROR: parenthesized generic arguments cannot be used
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument
//~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
//~^ ERROR: parenthesized generic arguments cannot be used
//~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
fn main() {}

View File

@ -23,7 +23,7 @@ LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
| |
| help: remove these parentheses
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
@ -39,7 +39,7 @@ help: add missing lifetime argument
LL | fn foo<'a>(arg: Box<dyn X<Y('_, 'a) = &'a ()>>) {}
| +++
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
@ -53,7 +53,7 @@ note: associated type defined here, with 0 generic parameters
LL | type Y<'a>;
| ^
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:12:27
|
LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}

View File

@ -12,9 +12,9 @@ fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
//~^ ERROR missing generics for associated type
fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
//~^ ERROR this struct takes 3 lifetime arguments but 2 lifetime
//~^ ERROR struct takes 3 lifetime arguments but 2 lifetime
fn f<'a>(_arg: Foo<'a>) {}
//~^ ERROR this struct takes 3 lifetime arguments but 1 lifetime
//~^ ERROR struct takes 3 lifetime arguments but 1 lifetime
fn main() {}

View File

@ -14,7 +14,7 @@ help: add missing lifetime arguments
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'_, '_> = (&'c u32, &'d u32)>>) {}
| ++++++++
error[E0107]: this struct takes 3 lifetime arguments but 2 lifetime arguments were supplied
error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied
--> $DIR/missing_lifetime_args.rs:14:26
|
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
@ -32,7 +32,7 @@ help: add missing lifetime argument
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {}
| ++++
error[E0107]: this struct takes 3 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing_lifetime_args.rs:17:16
|
LL | fn f<'a>(_arg: Foo<'a>) {}

View File

@ -4,7 +4,7 @@ trait Foo {
fn foo<T: Foo>() {
let _: <T as Foo>::Assoc<3>;
//~^ ERROR this associated type
//~^ ERROR associated type
}
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/missing_lifetime_const.rs:6:24
|
LL | let _: <T as Foo>::Assoc<3>;

View File

@ -9,10 +9,10 @@ trait Foo {
// Test parameters in default values
type FOk<T> = Self::E<'static, T>;
type FErr1 = Self::E<'static, 'static>;
//~^ ERROR this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| ERROR this associated type takes 1
//~^ ERROR associated type takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| ERROR associated type takes 1
type FErr2<T> = Self::E<'static, T, u32>;
//~^ ERROR this associated type takes 1
//~^ ERROR associated type takes 1
}
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/parameter_number_and_kind.rs:11:24
|
LL | type FErr1 = Self::E<'static, 'static>;
@ -12,7 +12,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
LL | type E<'a, T>;
| ^ --
error[E0107]: this associated type takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/parameter_number_and_kind.rs:11:24
|
LL | type FErr1 = Self::E<'static, 'static>;
@ -28,7 +28,7 @@ help: add missing generic argument
LL | type FErr1 = Self::E<'static, 'static, T>;
| +++
error[E0107]: this associated type takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: associated type takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/parameter_number_and_kind.rs:14:27
|
LL | type FErr2<T> = Self::E<'static, T, u32>;

View File

@ -4,8 +4,8 @@ trait X {
const _: () = {
fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
//~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument
//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
};
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
@ -14,7 +14,7 @@ help: add missing lifetime argument
LL | fn f2<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
| +++
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}

View File

@ -28,17 +28,17 @@ impl Trait<isize> for S2 {
fn foo<'a>() {
let _ = S::new::<isize,f64>(1, 1.0);
//~^ ERROR this associated function takes 1
//~^ ERROR associated function takes 1
let _ = S::<'a,isize>::new::<f64>(1, 1.0);
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
let _: S2 = Trait::new::<isize,f64>(1, 1.0);
//~^ ERROR this associated function takes 1
//~^ ERROR associated function takes 1
let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this associated function takes 1
//~^ ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR associated function takes 1
}
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/bad-mid-path-type-params.rs:30:16
|
LL | let _ = S::new::<isize,f64>(1, 1.0);
@ -12,7 +12,7 @@ note: associated function defined here, with 1 generic parameter: `U`
LL | fn new<U>(x: T, _: U) -> S<T> {
| ^^^ -
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/bad-mid-path-type-params.rs:33:13
|
LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
@ -26,7 +26,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct S<T> {
| ^
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/bad-mid-path-type-params.rs:36:24
|
LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
@ -40,7 +40,7 @@ note: associated function defined here, with 1 generic parameter: `U`
LL | fn new<U>(x: T, y: U) -> Self;
| ^^^ -
error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/bad-mid-path-type-params.rs:39:17
|
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
@ -54,7 +54,7 @@ note: trait defined here, with 0 lifetime parameters
LL | trait Trait<T> {
| ^^^^^
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/bad-mid-path-type-params.rs:39:36
|
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);

View File

@ -4,9 +4,9 @@ struct Bar<'a>(&'a ());
fn main() {
Foo::<'static, 'static, ()>(&0);
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments were supplied
Bar::<'static, 'static, ()>(&());
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| ERROR this struct takes 0
//~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| ERROR struct takes 0
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/generic-arg-mismatch-recover.rs:6:5
|
LL | Foo::<'static, 'static, ()>(&0);
@ -12,7 +12,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Foo<'a, T: 'a>(&'a T);
| ^^^ --
error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
LL | Bar::<'static, 'static, ()>(&());
@ -26,7 +26,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Bar<'a>(&'a ());
| ^^^ --
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
LL | Bar::<'static, 'static, ()>(&());

View File

@ -9,5 +9,5 @@ impl<A, B, C> Foo<A, B, C> {
fn main() {
Foo::<isize>::new();
//~^ ERROR this struct takes at least 2 generic arguments but 1 generic argument
//~^ ERROR struct takes at least 2 generic arguments but 1 generic argument
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes at least 2 generic arguments but 1 generic argument was supplied
--> $DIR/generic-impl-less-params-with-defaults.rs:11:5
|
LL | Foo::<isize>::new();

View File

@ -11,5 +11,5 @@ impl<T, A> Vec<T, A> {
fn main() {
Vec::<isize, Heap, bool>::new();
//~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments were supplied
//~^ ERROR struct takes at most 2 generic arguments but 3 generic arguments were supplied
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied
error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments were supplied
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
|
LL | Vec::<isize, Heap, bool>::new();

View File

@ -7,5 +7,5 @@ struct Vec<T, A = Heap>(
fn main() {
let _: Vec<isize, Heap, bool>;
//~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments
//~^ ERROR struct takes at most 2 generic arguments but 3 generic arguments
}

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied
error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments were supplied
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
|
LL | let _: Vec<isize, Heap, bool>;

View File

@ -4,18 +4,18 @@ mod no_generics {
type A = Ty;
type B = Ty<'static>;
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| HELP remove these generics
type C = Ty<'static, usize>;
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
//~| ERROR this struct takes 0 generic arguments but 1 generic argument
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| ERROR struct takes 0 generic arguments but 1 generic argument
//~| HELP remove this lifetime argument
//~| HELP remove this generic argument
type D = Ty<'static, usize, { 0 }>;
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
//~| ERROR this struct takes 0 generic arguments but 2 generic arguments
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| ERROR struct takes 0 generic arguments but 2 generic arguments
//~| HELP remove this lifetime argument
//~| HELP remove these generic arguments
}
@ -28,17 +28,17 @@ mod type_and_type {
//~| HELP add missing
type B = Ty<usize>;
//~^ ERROR this struct takes 2 generic arguments but 1 generic argument
//~^ ERROR struct takes 2 generic arguments but 1 generic argument
//~| HELP add missing
type C = Ty<usize, String>;
type D = Ty<usize, String, char>;
//~^ ERROR this struct takes 2 generic arguments but 3 generic arguments
//~^ ERROR struct takes 2 generic arguments but 3 generic arguments
//~| HELP remove this
type E = Ty<>;
//~^ ERROR this struct takes 2 generic arguments but 0 generic arguments were supplied
//~^ ERROR struct takes 2 generic arguments but 0 generic arguments were supplied
//~| HELP add missing
}
@ -52,7 +52,7 @@ mod lifetime_and_type {
//~| HELP consider introducing
type B = Ty<'static>;
//~^ ERROR this struct takes 1 generic argument but 0 generic arguments
//~^ ERROR struct takes 1 generic argument but 0 generic arguments
//~| HELP add missing
type C = Ty<usize>;
@ -62,14 +62,14 @@ mod lifetime_and_type {
type D = Ty<'static, usize>;
type E = Ty<>;
//~^ ERROR this struct takes 1 generic argument but 0 generic arguments
//~^ ERROR struct takes 1 generic argument but 0 generic arguments
//~| ERROR missing lifetime specifier
//~| HELP consider introducing
//~| HELP add missing
type F = Ty<'static, usize, 'static, usize>;
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments
//~| ERROR this struct takes 1 generic argument but 2 generic arguments
//~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments
//~| ERROR struct takes 1 generic argument but 2 generic arguments
//~| HELP remove this lifetime argument
//~| HELP remove this generic argument
}
@ -82,7 +82,7 @@ mod type_and_type_and_type {
//~| HELP add missing
type B = Ty<usize>;
//~^ ERROR this struct takes at least 2
//~^ ERROR struct takes at least 2
//~| HELP add missing
type C = Ty<usize, String>;
@ -90,11 +90,11 @@ mod type_and_type_and_type {
type D = Ty<usize, String, char>;
type E = Ty<usize, String, char, f64>;
//~^ ERROR this struct takes at most 3
//~^ ERROR struct takes at most 3
//~| HELP remove
type F = Ty<>;
//~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
//~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments
//~| HELP add missing
}
@ -114,7 +114,7 @@ mod r#trait {
}
type A = Box<dyn NonGeneric<usize>>;
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
//~^ ERROR trait takes 0 generic arguments but 1 generic argument
//~| HELP remove
type B = Box<dyn GenericLifetime>;
@ -123,7 +123,7 @@ mod r#trait {
//~| HELP consider making the bound lifetime-generic
type C = Box<dyn GenericLifetime<'static, 'static>>;
//~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| HELP remove
type D = Box<dyn GenericType>;
@ -131,7 +131,7 @@ mod r#trait {
//~| HELP add missing
type E = Box<dyn GenericType<String, usize>>;
//~^ ERROR this trait takes 1 generic argument but 2 generic arguments
//~^ ERROR trait takes 1 generic argument but 2 generic arguments
//~| HELP remove
type F = Box<dyn GenericLifetime<>>;
@ -140,7 +140,7 @@ mod r#trait {
//~| HELP consider making the bound lifetime-generic
type G = Box<dyn GenericType<>>;
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments
//~^ ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
}
@ -151,7 +151,7 @@ mod associated_item {
}
type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
//~^ ERROR trait takes 0 generic arguments but 1 generic argument
//~| HELP remove
}
@ -166,14 +166,14 @@ mod associated_item {
//~| HELP consider making the bound lifetime-generic
type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
//~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| HELP remove
type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
//~^ ERROR missing lifetime specifier
//~| HELP consider introducing
//~| HELP consider making the bound lifetime-generic
//~| ERROR this trait takes 0 generic arguments but 1 generic argument
//~| ERROR trait takes 0 generic arguments but 1 generic argument
//~| HELP remove
}
@ -183,17 +183,17 @@ mod associated_item {
}
type A = Box<dyn GenericTypeAT<AssocTy=()>>;
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments
//~^ ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
//~^ ERROR this trait takes 1 generic argument but 2 generic arguments
//~^ ERROR trait takes 1 generic argument but 2 generic arguments
//~| HELP remove
type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments
//~^ ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
//~| ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied
//~| HELP remove
}
@ -203,20 +203,20 @@ mod associated_item {
}
type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments
//~^ ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
//~| ERROR missing lifetime specifier
//~| HELP consider introducing
//~| HELP consider making the bound lifetime-generic
type B = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
//~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied
//~^ ERROR trait takes 1 generic argument but 0 generic arguments were supplied
//~| HELP add missing
type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
//~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| HELP remove
//~| ERROR this trait takes 1 generic argument but 0 generic arguments
//~| ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
type D = Box<dyn GenericLifetimeTypeAT<(), AssocTy=()>>;
@ -228,21 +228,21 @@ mod associated_item {
//~^ ERROR missing lifetime specifier
//~| HELP consider introducing
//~| HELP consider making the bound lifetime-generic
//~| ERROR this trait takes 1 generic argument but 2 generic arguments
//~| ERROR trait takes 1 generic argument but 2 generic arguments
//~| HELP remove
type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
//~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| HELP remove
type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
//~^ ERROR this trait takes 1 generic argument but 2 generic arguments
//~^ ERROR trait takes 1 generic argument but 2 generic arguments
//~| HELP remove
type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
//~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied
//~| HELP remove
//~| ERROR this trait takes 1 generic argument but 2 generic arguments
//~| ERROR trait takes 1 generic argument but 2 generic arguments
//~| HELP remove
}
@ -252,15 +252,15 @@ mod associated_item {
}
type A = Box<dyn GenericTypeTypeAT<AssocTy=()>>;
//~^ ERROR this trait takes 2 generic arguments but 0 generic arguments
//~^ ERROR trait takes 2 generic arguments but 0 generic arguments
//~| HELP add missing
type B = Box<dyn GenericTypeTypeAT<(), AssocTy=()>>;
//~^ ERROR this trait takes 2 generic arguments but 1 generic argument
//~^ ERROR trait takes 2 generic arguments but 1 generic argument
//~| HELP add missing
type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
//~^ ERROR this trait takes 2 generic arguments but 3 generic arguments
//~^ ERROR trait takes 2 generic arguments but 3 generic arguments
//~| HELP remove
}
@ -275,7 +275,7 @@ mod associated_item {
//~| HELP consider making the bound lifetime-generic
type B = Box<dyn GenericLifetimeLifetimeAT<'static, AssocTy=()>>;
//~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| HELP add missing lifetime argument
}
@ -288,17 +288,17 @@ mod associated_item {
//~^ ERROR missing lifetime specifier
//~| HELP consider introducing
//~| HELP consider making the bound lifetime-generic
//~| ERROR this trait takes 1 generic argument but 0 generic arguments
//~| ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
//~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| HELP add missing lifetime argument
//~| ERROR this trait takes 1 generic argument but 0 generic arguments
//~| ERROR trait takes 1 generic argument but 0 generic arguments
//~| HELP add missing
type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, (), AssocTy=()>>;
//~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| HELP add missing lifetime argument
}
}
@ -312,21 +312,21 @@ mod stdlib {
//~| HELP add missing
type B = HashMap<String>;
//~^ ERROR this struct takes at least
//~^ ERROR struct takes at least
//~| HELP add missing
type C = HashMap<'static>;
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| HELP remove these generics
//~| ERROR this struct takes at least 2
//~| ERROR struct takes at least 2
//~| HELP add missing
type D = HashMap<usize, String, char, f64>;
//~^ ERROR this struct takes at most 3
//~^ ERROR struct takes at most 3
//~| HELP remove this
type E = HashMap<>;
//~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments
//~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments
//~| HELP add missing
}
@ -336,21 +336,21 @@ mod stdlib {
//~| HELP add missing
type B = Result<String>;
//~^ ERROR this enum takes 2 generic arguments but 1 generic argument
//~^ ERROR enum takes 2 generic arguments but 1 generic argument
//~| HELP add missing
type C = Result<'static>;
//~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument
//~^ ERROR enum takes 0 lifetime arguments but 1 lifetime argument
//~| HELP remove these generics
//~| ERROR this enum takes 2 generic arguments but 0 generic arguments
//~| ERROR enum takes 2 generic arguments but 0 generic arguments
//~| HELP add missing
type D = Result<usize, String, char>;
//~^ ERROR this enum takes 2 generic arguments but 3 generic arguments
//~^ ERROR enum takes 2 generic arguments but 3 generic arguments
//~| HELP remove
type E = Result<>;
//~^ ERROR this enum takes 2 generic arguments but 0 generic arguments
//~^ ERROR enum takes 2 generic arguments but 0 generic arguments
//~| HELP add missing
}
}

View File

@ -167,7 +167,7 @@ help: consider introducing a named lifetime parameter
LL | type A<'a> = Box<dyn GenericLifetimeLifetimeTypeAT<'a, 'a, AssocTy=()>>;
| ++++ +++++++
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:6:14
|
LL | type B = Ty<'static>;
@ -181,7 +181,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct Ty;
| ^^
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:10:14
|
LL | type C = Ty<'static, usize>;
@ -195,7 +195,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct Ty;
| ^^
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:10:14
|
LL | type C = Ty<'static, usize>;
@ -209,7 +209,7 @@ note: struct defined here, with 0 generic parameters
LL | struct Ty;
| ^^
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:16:14
|
LL | type D = Ty<'static, usize, { 0 }>;
@ -223,7 +223,7 @@ note: struct defined here, with 0 lifetime parameters
LL | struct Ty;
| ^^
error[E0107]: this struct takes 0 generic arguments but 2 generic arguments were supplied
error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:16:14
|
LL | type D = Ty<'static, usize, { 0 }>;
@ -253,7 +253,7 @@ help: add missing generic arguments
LL | type A = Ty<A, B>;
| ++++++
error[E0107]: this struct takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:30:14
|
LL | type B = Ty<usize>;
@ -271,7 +271,7 @@ help: add missing generic argument
LL | type B = Ty<usize, B>;
| +++
error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:36:14
|
LL | type D = Ty<usize, String, char>;
@ -285,7 +285,7 @@ note: struct defined here, with 2 generic parameters: `A`, `B`
LL | struct Ty<A, B>;
| ^^ - -
error[E0107]: this struct takes 2 generic arguments but 0 generic arguments were supplied
error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:40:14
|
LL | type E = Ty<>;
@ -317,7 +317,7 @@ help: add missing generic argument
LL | type A = Ty<T>;
| +++
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:54:14
|
LL | type B = Ty<'static>;
@ -333,7 +333,7 @@ help: add missing generic argument
LL | type B = Ty<'static, T>;
| +++
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:64:14
|
LL | type E = Ty<>;
@ -349,7 +349,7 @@ help: add missing generic argument
LL | type E = Ty<T>;
| +
error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:70:14
|
LL | type F = Ty<'static, usize, 'static, usize>;
@ -363,7 +363,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
LL | struct Ty<'a, T>;
| ^^ --
error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:70:14
|
LL | type F = Ty<'static, usize, 'static, usize>;
@ -393,7 +393,7 @@ help: add missing generic arguments
LL | type A = Ty<A, B>;
| ++++++
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes at least 2 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:84:14
|
LL | type B = Ty<usize>;
@ -411,7 +411,7 @@ help: add missing generic argument
LL | type B = Ty<usize, B>;
| +++
error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied
error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:92:14
|
LL | type E = Ty<usize, String, char, f64>;
@ -425,7 +425,7 @@ note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C`
LL | struct Ty<A, B, C = &'static str>;
| ^^ - - ----------------
error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:96:14
|
LL | type F = Ty<>;
@ -441,7 +441,7 @@ help: add missing generic arguments
LL | type F = Ty<A, B>;
| ++++
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:116:22
|
LL | type A = Box<dyn NonGeneric<usize>>;
@ -455,7 +455,7 @@ note: trait defined here, with 0 generic parameters
LL | trait NonGeneric {
| ^^^^^^^^^^
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:125:22
|
LL | type C = Box<dyn GenericLifetime<'static, 'static>>;
@ -485,7 +485,7 @@ help: add missing generic argument
LL | type D = Box<dyn GenericType<A>>;
| +++
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:133:22
|
LL | type E = Box<dyn GenericType<String, usize>>;
@ -499,7 +499,7 @@ note: trait defined here, with 1 generic parameter: `A`
LL | trait GenericType<A> {
| ^^^^^^^^^^^ -
error[E0107]: this 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/wrong-number-of-args.rs:142:22
|
LL | type G = Box<dyn GenericType<>>;
@ -515,7 +515,7 @@ help: add missing generic argument
LL | type G = Box<dyn GenericType<A>>;
| +
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:153:26
|
LL | type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
@ -529,7 +529,7 @@ note: trait defined here, with 0 generic parameters
LL | trait NonGenericAT {
| ^^^^^^^^^^^^
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:168:26
|
LL | type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
@ -543,7 +543,7 @@ note: trait defined here, with 1 lifetime parameter: `'a`
LL | trait GenericLifetimeAT<'a> {
| ^^^^^^^^^^^^^^^^^ --
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:172:26
|
LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
@ -557,7 +557,7 @@ note: trait defined here, with 0 generic parameters
LL | trait GenericLifetimeAT<'a> {
| ^^^^^^^^^^^^^^^^^
error[E0107]: this 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/wrong-number-of-args.rs:185:26
|
LL | type A = Box<dyn GenericTypeAT<AssocTy=()>>;
@ -573,7 +573,7 @@ help: add missing generic argument
LL | type A = Box<dyn GenericTypeAT<A, AssocTy=()>>;
| ++
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:189:26
|
LL | type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
@ -587,7 +587,7 @@ note: trait defined here, with 1 generic parameter: `A`
LL | trait GenericTypeAT<A> {
| ^^^^^^^^^^^^^ -
error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:193:26
|
LL | type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
@ -601,7 +601,7 @@ note: trait defined here, with 0 lifetime parameters
LL | trait GenericTypeAT<A> {
| ^^^^^^^^^^^^^
error[E0107]: this 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/wrong-number-of-args.rs:193:26
|
LL | type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
@ -617,7 +617,7 @@ help: add missing generic argument
LL | type C = Box<dyn GenericTypeAT<'static, A, AssocTy=()>>;
| +++
error[E0107]: this 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/wrong-number-of-args.rs:205:26
|
LL | type A = Box<dyn GenericLifetimeTypeAT<AssocTy=()>>;
@ -633,7 +633,7 @@ help: add missing generic argument
LL | type A = Box<dyn GenericLifetimeTypeAT<A, AssocTy=()>>;
| ++
error[E0107]: this 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/wrong-number-of-args.rs:212:26
|
LL | type B = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
@ -649,7 +649,7 @@ help: add missing generic argument
LL | type B = Box<dyn GenericLifetimeTypeAT<'static, A, AssocTy=()>>;
| +++
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:216:26
|
LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
@ -663,7 +663,7 @@ note: trait defined here, with 1 lifetime parameter: `'a`
LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ --
error[E0107]: this 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/wrong-number-of-args.rs:216:26
|
LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
@ -679,7 +679,7 @@ help: add missing generic argument
LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, A, AssocTy=()>>;
| +++
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:227:26
|
LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
@ -693,7 +693,7 @@ note: trait defined here, with 1 generic parameter: `A`
LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ -
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:234:26
|
LL | type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
@ -707,7 +707,7 @@ note: trait defined here, with 1 lifetime parameter: `'a`
LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ --
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:238:26
|
LL | type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
@ -721,7 +721,7 @@ note: trait defined here, with 1 generic parameter: `A`
LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ -
error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/wrong-number-of-args.rs:242:26
|
LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
@ -735,7 +735,7 @@ note: trait defined here, with 1 lifetime parameter: `'a`
LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ --
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:242:26
|
LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
@ -749,7 +749,7 @@ note: trait defined here, with 1 generic parameter: `A`
LL | trait GenericLifetimeTypeAT<'a, A> {
| ^^^^^^^^^^^^^^^^^^^^^ -
error[E0107]: this trait takes 2 generic arguments but 0 generic arguments were supplied
error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:254:26
|
LL | type A = Box<dyn GenericTypeTypeAT<AssocTy=()>>;
@ -765,7 +765,7 @@ help: add missing generic arguments
LL | type A = Box<dyn GenericTypeTypeAT<A, B, AssocTy=()>>;
| +++++
error[E0107]: this trait takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:258:26
|
LL | type B = Box<dyn GenericTypeTypeAT<(), AssocTy=()>>;
@ -783,7 +783,7 @@ help: add missing generic argument
LL | type B = Box<dyn GenericTypeTypeAT<(), B, AssocTy=()>>;
| +++
error[E0107]: this trait takes 2 generic arguments but 3 generic arguments were supplied
error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:262:26
|
LL | type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
@ -797,7 +797,7 @@ note: trait defined here, with 2 generic parameters: `A`, `B`
LL | trait GenericTypeTypeAT<A, B> {
| ^^^^^^^^^^^^^^^^^ - -
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:277:26
|
LL | type B = Box<dyn GenericLifetimeLifetimeAT<'static, AssocTy=()>>;
@ -815,7 +815,7 @@ help: add missing lifetime argument
LL | type B = Box<dyn GenericLifetimeLifetimeAT<'static, 'static, AssocTy=()>>;
| +++++++++
error[E0107]: this 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/wrong-number-of-args.rs:287:26
|
LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<AssocTy=()>>;
@ -831,7 +831,7 @@ help: add missing generic argument
LL | type A = Box<dyn GenericLifetimeLifetimeTypeAT<A, AssocTy=()>>;
| ++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:294:26
|
LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
@ -849,7 +849,7 @@ help: add missing lifetime argument
LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, 'static, AssocTy=()>>;
| +++++++++
error[E0107]: this 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/wrong-number-of-args.rs:294:26
|
LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, AssocTy=()>>;
@ -865,7 +865,7 @@ help: add missing generic argument
LL | type B = Box<dyn GenericLifetimeLifetimeTypeAT<'static, A, AssocTy=()>>;
| +++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:300:26
|
LL | type C = Box<dyn GenericLifetimeLifetimeTypeAT<'static, (), AssocTy=()>>;
@ -894,7 +894,7 @@ help: add missing generic arguments
LL | type A = HashMap<K, V>;
| ++++++
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes at least 2 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:314:18
|
LL | type B = HashMap<String>;
@ -907,7 +907,7 @@ help: add missing generic argument
LL | type B = HashMap<String, V>;
| +++
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:318:18
|
LL | type C = HashMap<'static>;
@ -915,7 +915,7 @@ LL | type C = HashMap<'static>;
| |
| expected 0 lifetime arguments
error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:318:18
|
LL | type C = HashMap<'static>;
@ -926,7 +926,7 @@ help: add missing generic arguments
LL | type C = HashMap<'static, K, V>;
| ++++++
error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied
error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:324:18
|
LL | type D = HashMap<usize, String, char, f64>;
@ -934,7 +934,7 @@ LL | type D = HashMap<usize, String, char, f64>;
| |
| expected at most 3 generic arguments
error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:328:18
|
LL | type E = HashMap<>;
@ -956,7 +956,7 @@ help: add missing generic arguments
LL | type A = Result<T, E>;
| ++++++
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/wrong-number-of-args.rs:338:18
|
LL | type B = Result<String>;
@ -969,7 +969,7 @@ help: add missing generic argument
LL | type B = Result<String, E>;
| +++
error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/wrong-number-of-args.rs:342:18
|
LL | type C = Result<'static>;
@ -977,7 +977,7 @@ LL | type C = Result<'static>;
| |
| expected 0 lifetime arguments
error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied
error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:342:18
|
LL | type C = Result<'static>;
@ -988,7 +988,7 @@ help: add missing generic arguments
LL | type C = Result<'static, T, E>;
| ++++++
error[E0107]: this enum takes 2 generic arguments but 3 generic arguments were supplied
error[E0107]: enum takes 2 generic arguments but 3 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:348:18
|
LL | type D = Result<usize, String, char>;
@ -996,7 +996,7 @@ LL | type D = Result<usize, String, char>;
| |
| expected 2 generic arguments
error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied
error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied
--> $DIR/wrong-number-of-args.rs:352:18
|
LL | type E = Result<>;

View File

@ -1,4 +1,4 @@
error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied
error[E0107]: function takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/explicit-generic-args-for-impl.rs:4:5
|
LL | foo::<str, String>("".to_string());

View File

@ -1,4 +1,4 @@
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/not-enough-args.rs:4:5
|
LL | f::<[u8]>("a", b"a");

View File

@ -0,0 +1,19 @@
// compile-flags:-Ztranslate-lang=en_US
#![feature(negative_impls)]
#![feature(marker_trait_attr)]
#[marker]
trait MyTrait {}
struct TestType<T>(::std::marker::PhantomData<T>);
unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR found both positive and negative implementation
unsafe impl<T: 'static> Send for TestType<T> {} //~ ERROR conflicting implementations
impl !Send for TestType<i32> {}
fn main() {}

View File

@ -0,0 +1,22 @@
error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`:
--> $DIR/issue-106755.rs:13:1
|
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
| ------------------------------------------------------ positive implementation here
LL |
LL | impl<T: MyTrait> !Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here
error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>`
--> $DIR/issue-106755.rs:15:1
|
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
| ------------------------------------------------------ first implementation here
...
LL | unsafe impl<T: 'static> Send for TestType<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0119, E0751.
For more information about an error, try `rustc --explain E0119`.

View File

@ -2,7 +2,7 @@
struct Foo<'a> {
x: Box<'a, isize>
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
}
fn main() { }

View File

@ -1,4 +1,4 @@
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/issue-18423.rs:4:8
|
LL | x: Box<'a, isize>

View File

@ -4,7 +4,7 @@ fn foo<T>() {
}
impl<T> Drop for Foo<T> {
//~^ ERROR this struct takes 0 generic arguments but 1 generic argument
//~^ ERROR struct takes 0 generic arguments but 1 generic argument
fn drop(&mut self) {}
}
}

View File

@ -8,7 +8,7 @@ LL | struct Foo {
LL | x: T,
| ^ use of generic parameter from outer function
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-3214.rs:6:22
|
LL | impl<T> Drop for Foo<T> {

View File

@ -9,8 +9,8 @@ macro_rules! impl_add {
$(
fn $n() {
S::f::<i64>();
//~^ ERROR this associated function takes 0 generic
//~| ERROR this associated function takes 0 generic
//~^ ERROR associated function takes 0 generic
//~| ERROR associated function takes 0 generic
}
)*
}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-53251.rs:11:20
|
LL | S::f::<i64>();
@ -16,7 +16,7 @@ LL | fn f() {}
| ^
= note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-53251.rs:11:20
|
LL | S::f::<i64>();

View File

@ -9,7 +9,7 @@ impl Borked {
fn run_wild<T>(b: &Borked) {
b.a::<'_, T>();
//~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
//~| ERROR this method takes 0 generic arguments but 1 generic argument
//~| ERROR method takes 0 generic arguments but 1 generic argument
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
}

View File

@ -16,7 +16,7 @@ LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(late_bound_lifetime_arguments)]` implied by `#[deny(warnings)]`
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-60622.rs:10:7
|
LL | b.a::<'_, T>();

View File

@ -7,6 +7,6 @@ trait Trait<'a> {
type Alias<'a, T> = <T as Trait<'a>>::Assoc;
fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
//~^ error: this type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
//~^ error: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0107]: this type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/mismatched_arg_count.rs:9:29
|
LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}

View File

@ -14,9 +14,9 @@ impl S {
fn method_call() {
S.early(); // OK
S.early::<'static>();
//~^ ERROR this method takes 2 lifetime arguments but 1 lifetime argument
//~^ ERROR method takes 2 lifetime arguments but 1 lifetime argument
S.early::<'static, 'static, 'static>();
//~^ ERROR this method takes 2 lifetime arguments but 3 lifetime arguments were supplied
//~^ ERROR method takes 2 lifetime arguments but 3 lifetime arguments were supplied
let _: &u8 = S.life_and_type::<'static>();
S.life_and_type::<u8>();
S.life_and_type::<'static, u8>();
@ -61,9 +61,9 @@ fn ufcs() {
S::early(S); // OK
S::early::<'static>(S);
//~^ ERROR this method takes 2 lifetime arguments but 1 lifetime argument
//~^ ERROR method takes 2 lifetime arguments but 1 lifetime argument
S::early::<'static, 'static, 'static>(S);
//~^ ERROR this method takes 2 lifetime arguments but 3 lifetime arguments were supplied
//~^ ERROR method takes 2 lifetime arguments but 3 lifetime arguments were supplied
let _: &u8 = S::life_and_type::<'static>(S);
S::life_and_type::<u8>(S);
S::life_and_type::<'static, u8>(S);

View File

@ -1,4 +1,4 @@
error[E0107]: this method takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: method takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/method-call-lifetime-args-fail.rs:16:7
|
LL | S.early::<'static>();
@ -16,7 +16,7 @@ help: add missing lifetime argument
LL | S.early::<'static, 'static>();
| +++++++++
error[E0107]: this method takes 2 lifetime arguments but 3 lifetime arguments were supplied
error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were supplied
--> $DIR/method-call-lifetime-args-fail.rs:18:7
|
LL | S.early::<'static, 'static, 'static>();
@ -198,7 +198,7 @@ note: the late bound lifetime parameter is introduced here
LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} }
| ^^
error[E0107]: this method takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: method takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/method-call-lifetime-args-fail.rs:63:8
|
LL | S::early::<'static>(S);
@ -216,7 +216,7 @@ help: add missing lifetime argument
LL | S::early::<'static, 'static>(S);
| +++++++++
error[E0107]: this method takes 2 lifetime arguments but 3 lifetime arguments were supplied
error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were supplied
--> $DIR/method-call-lifetime-args-fail.rs:65:8
|
LL | S::early::<'static, 'static, 'static>(S);

View File

@ -0,0 +1,19 @@
// check-pass
#![feature(const_trait_impl, rustc_attrs)]
#[const_trait]
trait Foo {
#[rustc_do_not_const_check]
fn into_iter(&self) { println!("FEAR ME!") }
}
impl const Foo for () {
fn into_iter(&self) {
// ^_^
}
}
const _: () = Foo::into_iter(&());
fn main() {}

View File

@ -0,0 +1,18 @@
// check-pass
#![feature(const_trait_impl, rustc_attrs)]
#[const_trait]
trait IntoIter {
fn into_iter(self);
}
#[const_trait]
trait Hmm: Sized {
#[rustc_do_not_const_check]
fn chain<U>(self, other: U) where U: IntoIter,
{
other.into_iter()
}
}
fn main() {}

View File

@ -2,12 +2,12 @@ fn main() {
trait Seq { }
impl<T> Seq<T> for Vec<T> {
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
//~^ ERROR trait takes 0 generic arguments but 1 generic argument
/* ... */
}
impl Seq<bool> for u32 {
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
//~^ ERROR trait takes 0 generic arguments but 1 generic argument
/* Treat the integer as a sequence of bits */
}
}

View File

@ -1,4 +1,4 @@
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/seq-args.rs:4:13
|
LL | impl<T> Seq<T> for Vec<T> {
@ -12,7 +12,7 @@ note: trait defined here, with 0 generic parameters
LL | trait Seq { }
| ^^^
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/seq-args.rs:9:10
|
LL | impl Seq<bool> for u32 {

View File

@ -13,7 +13,7 @@ fn f<T: Tr>() {
//~^ ERROR expected struct, variant or union type, found associated type
let z = T::A::<u8> {};
//~^ ERROR expected struct, variant or union type, found associated type
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR associated type takes 0 generic arguments but 1 generic argument was supplied
match S {
T::A {} => {}
//~^ ERROR expected struct, variant or union type, found associated type
@ -22,7 +22,7 @@ fn f<T: Tr>() {
fn g<T: Tr<A = S>>() {
let s = T::A {}; // OK
let z = T::A::<u8> {}; //~ ERROR this associated type takes 0 generic arguments but 1 generic argument was supplied
let z = T::A::<u8> {}; //~ ERROR associated type takes 0 generic arguments but 1 generic argument was supplied
match S {
T::A {} => {} // OK
}

View File

@ -4,7 +4,7 @@ error[E0071]: expected struct, variant or union type, found associated type
LL | let s = T::A {};
| ^^^^ not a struct
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/struct-path-associated-type.rs:14:16
|
LL | let z = T::A::<u8> {};
@ -30,7 +30,7 @@ error[E0071]: expected struct, variant or union type, found associated type
LL | T::A {} => {}
| ^^^^ not a struct
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/struct-path-associated-type.rs:25:16
|
LL | let z = T::A::<u8> {};

View File

@ -45,13 +45,13 @@ fn main() {
y: 8,
};
let pt3 = PointF::<i32> { //~ ERROR this type alias takes 0 generic arguments but 1 generic argument
let pt3 = PointF::<i32> { //~ ERROR type alias takes 0 generic arguments but 1 generic argument
x: 9, //~ ERROR mismatched types
y: 10, //~ ERROR mismatched types
};
match (Point { x: 1, y: 2 }) {
PointF::<u32> { .. } => {} //~ ERROR this type alias takes 0 generic arguments but 1 generic argument
PointF::<u32> { .. } => {} //~ ERROR type alias takes 0 generic arguments but 1 generic argument
//~^ ERROR mismatched types
}

View File

@ -52,7 +52,7 @@ LL | x: 7,
| expected `f32`, found integer
| help: use a float literal: `7.0`
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/structure-constructor-type-mismatch.rs:48:15
|
LL | let pt3 = PointF::<i32> {
@ -84,7 +84,7 @@ LL | y: 10,
| expected `f32`, found integer
| help: use a float literal: `10.0`
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/structure-constructor-type-mismatch.rs:54:9
|
LL | PointF::<u32> { .. } => {}

View File

@ -8,5 +8,5 @@ impl Ice for () {
fn main() {
().f::<()>(());
//~^ ERROR this method takes 0 generic arguments but 1 generic argument was supplied
//~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied
}

View File

@ -1,4 +1,4 @@
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-101421.rs:10:8
|
LL | ().f::<()>(());

View File

@ -8,6 +8,6 @@ impl S {
fn main() {
let x = S;
foo::<()>(x);
//~^ ERROR this method takes 0 generic arguments but 1 generic argument was supplied
//~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR cannot find function `foo` in this scope
}

View File

@ -1,4 +1,4 @@
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-104287.rs:10:5
|
LL | foo::<()>(x);

View File

@ -1,7 +1,7 @@
use std::ops::Deref;
trait Foo {
type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;
//~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
//~| ERROR associated type bindings are not allowed here
//~| HELP add missing
}

View File

@ -1,4 +1,4 @@
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/issue-85347.rs:3:42
|
LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>;

View File

@ -1,4 +1,4 @@
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-89064.rs:17:16
|
LL | let _ = A::foo::<S>();
@ -20,7 +20,7 @@ LL - let _ = A::foo::<S>();
LL + let _ = A::foo();
|
error[E0107]: this associated function takes 0 generic arguments but 2 generic arguments were supplied
error[E0107]: associated function takes 0 generic arguments but 2 generic arguments were supplied
--> $DIR/issue-89064.rs:22:16
|
LL | let _ = B::bar::<S, S>();
@ -42,7 +42,7 @@ LL - let _ = B::bar::<S, S>();
LL + let _ = B::bar();
|
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-89064.rs:27:21
|
LL | let _ = A::<S>::foo::<S>();
@ -56,7 +56,7 @@ note: associated function defined here, with 0 generic parameters
LL | fn foo() {}
| ^^^
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-89064.rs:31:16
|
LL | let _ = 42.into::<Option<_>>();

View File

@ -37,19 +37,19 @@ thread_local! {
thread_local! {
static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR this union takes 2 lifetime arguments but 1 lifetime argument
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR union takes 2 lifetime arguments but 1 lifetime argument
//~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied
}
thread_local! {
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR missing lifetime
//~| ERROR missing lifetime
}

View File

@ -133,7 +133,7 @@ LL | | }
|
= help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:39:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -151,7 +151,7 @@ help: add missing lifetime argument
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:39:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -169,7 +169,7 @@ help: add missing lifetime argument
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:39:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -187,7 +187,7 @@ help: add missing lifetime argument
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:39:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -205,7 +205,7 @@ help: add missing lifetime argument
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:39:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -223,7 +223,7 @@ help: add missing lifetime argument
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:47:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -241,7 +241,7 @@ help: add missing lifetime argument
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:47:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -259,7 +259,7 @@ help: add missing lifetime argument
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:47:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -277,7 +277,7 @@ help: add missing lifetime argument
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:47:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
@ -295,7 +295,7 @@ help: add missing lifetime argument
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:47:45
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());

Some files were not shown because too many files have changed in this diff Show More