Rollup merge of #121475 - jieyouxu:tidy-stderr-check, r=the8472,compiler-errors

Add tidy check for .stderr/.stdout files for non-existent test revisions

Closes #77498.
This commit is contained in:
Matthias Krüger 2024-03-01 17:51:29 +01:00 committed by GitHub
commit dcde08f21c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 202 additions and 619 deletions

View File

@ -0,0 +1,32 @@
const COMMENT: &str = "//@";
/// A header line, like `//@name: value` consists of the prefix `//@` and the directive
/// `name: value`. It is also possibly revisioned, e.g. `//@[revision] name: value`.
pub(crate) struct HeaderLine<'ln> {
pub(crate) revision: Option<&'ln str>,
pub(crate) directive: &'ln str,
}
/// Iterate through compiletest headers in a test contents.
///
/// Adjusted from compiletest/src/header.rs.
pub(crate) fn iter_header<'ln>(contents: &'ln str, it: &mut dyn FnMut(HeaderLine<'ln>)) {
for ln in contents.lines() {
let ln = ln.trim();
// We're left with potentially `[rev]name: value`.
let Some(remainder) = ln.strip_prefix(COMMENT) else {
continue;
};
if let Some(remainder) = remainder.trim_start().strip_prefix('[') {
let Some((revision, remainder)) = remainder.split_once(']') else {
panic!("malformed revision directive: expected `//@[rev]`, found `{ln}`");
};
// We trimmed off the `[rev]` portion, left with `name: value`.
it(HeaderLine { revision: Some(revision), directive: remainder.trim() });
} else {
it(HeaderLine { revision: None, directive: remainder.trim() });
}
}
}

View File

@ -65,6 +65,7 @@ pub mod ext_tool_checks;
pub mod extdeps;
pub mod features;
pub mod fluent_alphabetical;
pub(crate) mod iter_header;
pub mod mir_opt_tests;
pub mod pal;
pub mod rustdoc_css_themes;
@ -73,6 +74,7 @@ pub mod style;
pub mod target_policy;
pub mod target_specific_tests;
pub mod tests_placement;
pub mod tests_revision_unpaired_stdout_stderr;
pub mod ui_tests;
pub mod unit_tests;
pub mod unstable_book;

View File

@ -100,6 +100,7 @@ fn main() {
// Checks over tests.
check!(tests_placement, &root_path);
check!(tests_revision_unpaired_stdout_stderr, &tests_path);
check!(debug_artifacts, &tests_path);
check!(ui_tests, &tests_path, bless);
check!(mir_opt_tests, &tests_path, bless);

View File

@ -4,32 +4,12 @@
use std::collections::BTreeMap;
use std::path::Path;
use crate::iter_header::{iter_header, HeaderLine};
use crate::walk::filter_not_rust;
const COMMENT: &str = "//@";
const LLVM_COMPONENTS_HEADER: &str = "needs-llvm-components:";
const COMPILE_FLAGS_HEADER: &str = "compile-flags:";
/// Iterate through compiletest headers in a test contents.
///
/// Adjusted from compiletest/src/header.rs.
fn iter_header<'a>(contents: &'a str, it: &mut dyn FnMut(Option<&'a str>, &'a str)) {
for ln in contents.lines() {
let ln = ln.trim();
if ln.starts_with(COMMENT) && ln[COMMENT.len()..].trim_start().starts_with('[') {
if let Some(close_brace) = ln.find(']') {
let open_brace = ln.find('[').unwrap();
let lncfg = &ln[open_brace + 1..close_brace];
it(Some(lncfg), ln[(close_brace + 1)..].trim_start());
} else {
panic!("malformed condition directive: expected `//[foo]`, found `{ln}`")
}
} else if ln.starts_with(COMMENT) {
it(None, ln[COMMENT.len()..].trim_start());
}
}
}
#[derive(Default, Debug)]
struct RevisionInfo<'a> {
target_arch: Option<&'a str>,
@ -40,9 +20,9 @@ pub fn check(path: &Path, bad: &mut bool) {
crate::walk::walk(path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| {
let file = entry.path().display();
let mut header_map = BTreeMap::new();
iter_header(content, &mut |cfg, directive| {
iter_header(content, &mut |HeaderLine { revision, directive }| {
if let Some(value) = directive.strip_prefix(LLVM_COMPONENTS_HEADER) {
let info = header_map.entry(cfg).or_insert(RevisionInfo::default());
let info = header_map.entry(revision).or_insert(RevisionInfo::default());
let comp_vec = info.llvm_components.get_or_insert(Vec::new());
for component in value.split(' ') {
let component = component.trim();
@ -56,7 +36,7 @@ pub fn check(path: &Path, bad: &mut bool) {
if let Some((arch, _)) =
v.trim_start_matches(|c| c == ' ' || c == '=').split_once("-")
{
let info = header_map.entry(cfg).or_insert(RevisionInfo::default());
let info = header_map.entry(revision).or_insert(RevisionInfo::default());
info.target_arch.replace(arch);
} else {
eprintln!("{file}: seems to have a malformed --target value");

View File

@ -0,0 +1,146 @@
//! Checks that there are no unpaired `.stderr` or `.stdout` for a test with and without revisions.
use std::collections::{BTreeMap, BTreeSet};
use std::ffi::OsStr;
use std::path::Path;
use crate::iter_header::*;
use crate::walk::*;
// Should be kept in sync with `CompareMode` in `src/tools/compiletest/src/common.rs`,
// as well as `run`.
const IGNORES: &[&str] = &[
"polonius",
"chalk",
"split-dwarf",
"split-dwarf-single",
"next-solver-coherence",
"next-solver",
"run",
];
const EXTENSIONS: &[&str] = &["stdout", "stderr"];
const SPECIAL_TEST: &str = "tests/ui/command/need-crate-arg-ignore-tidy.x.rs";
pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
// Recurse over subdirectories under `tests/`
walk_dir(tests_path.as_ref(), filter, &mut |entry| {
// We are inspecting a folder. Collect the paths to interesting files `.rs`, `.stderr`,
// `.stdout` under the current folder (shallow).
let mut files_under_inspection = BTreeSet::new();
for sibling in std::fs::read_dir(entry.path()).unwrap() {
let Ok(sibling) = sibling else {
continue;
};
if sibling.path().is_dir() {
continue;
}
let sibling_path = sibling.path();
let Some(ext) = sibling_path.extension().map(OsStr::to_str).flatten() else {
continue;
};
if ext == "rs" || EXTENSIONS.contains(&ext) {
files_under_inspection.insert(sibling_path);
}
}
let mut test_info = BTreeMap::new();
for test in
files_under_inspection.iter().filter(|f| f.extension().is_some_and(|ext| ext == "rs"))
{
if test.ends_with(SPECIAL_TEST) {
continue;
}
let mut expected_revisions = BTreeSet::new();
let contents = std::fs::read_to_string(test).unwrap();
// Collect directives.
iter_header(&contents, &mut |HeaderLine { revision, directive }| {
// We're trying to *find* `//@ revision: xxx` directives themselves, not revisioned
// directives.
if revision.is_some() {
return;
}
let directive = directive.trim();
if directive.starts_with("revisions") {
let Some((name, value)) = directive.split_once([':', ' ']) else {
return;
};
if name == "revisions" {
let revs = value.split(' ');
for rev in revs {
expected_revisions.insert(rev.to_owned());
}
}
}
});
let Some((test_name, _)) = test.to_str().map(|s| s.split_once('.')).flatten() else {
continue;
};
test_info.insert(test_name.to_string(), (test, expected_revisions));
}
// Our test file `foo.rs` has specified no revisions. There should not be any
// `foo.rev{.stderr,.stdout}` files. rustc-dev-guide says test output files can have names
// of the form: `test-name.revision.compare_mode.extension`, but our only concern is
// `test-name.revision` and `extension`.
for sibling in files_under_inspection.iter().filter(|f| {
f.extension().map(OsStr::to_str).flatten().is_some_and(|ext| EXTENSIONS.contains(&ext))
}) {
let filename_components = sibling.to_str().unwrap().split('.').collect::<Vec<_>>();
let file_prefix = filename_components[0];
let Some((test_path, expected_revisions)) = test_info.get(file_prefix) else {
continue;
};
match filename_components[..] {
// Cannot have a revision component, skip.
[] | [_] => return,
[_, _] if !expected_revisions.is_empty() => {
// Found unrevisioned output files for a revisioned test.
tidy_error!(
bad,
"found unrevisioned output file `{}` for a revisioned test `{}`",
sibling.display(),
test_path.display(),
);
}
[_, _] => return,
[_, found_revision, .., extension] => {
if !IGNORES.contains(&found_revision)
&& !expected_revisions.contains(found_revision)
// This is from `//@ stderr-per-bitwidth`
&& !(extension == "stderr" && ["32bit", "64bit"].contains(&found_revision))
{
// Found some unexpected revision-esque component that is not a known
// compare-mode or expected revision.
tidy_error!(
bad,
"found output file `{}` for unexpected revision `{}` of test `{}`",
sibling.display(),
found_revision,
test_path.display()
);
}
}
}
}
});
}
fn filter(path: &Path) -> bool {
filter_dirs(path) // ignore certain dirs
|| (path.file_name().is_some_and(|name| name == "auxiliary")) // ignore auxiliary folder
}

View File

@ -86,3 +86,20 @@ pub(crate) fn walk_no_read(
}
}
}
// Walk through directories and skip symlinks.
pub(crate) fn walk_dir(
path: &Path,
skip: impl Send + Sync + 'static + Fn(&Path) -> bool,
f: &mut dyn FnMut(&DirEntry),
) {
let mut walker = ignore::WalkBuilder::new(path);
let walker = walker.filter_entry(move |e| !skip(e.path()));
for entry in walker.build() {
if let Ok(entry) = entry {
if entry.path().is_dir() {
f(&entry);
}
}
}
}

View File

@ -1,48 +0,0 @@
error: return type notation uses `()` instead of `(..)` for elided arguments
--> $DIR/bad-inputs-and-output.rs:20:24
|
LL | fn baz<T: Trait<method(..): Send>>() {}
| ^^ help: remove the `..`
error[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:12:17
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:16:17
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: argument types not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:12:23
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^ help: remove the input types: `()`
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:16:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^ help: remove the return type
error: aborting due to 5 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,48 +0,0 @@
error: return type notation uses `()` instead of `(..)` for elided arguments
--> $DIR/bad-inputs-and-output.rs:20:24
|
LL | fn baz<T: Trait<method(..): Send>>() {}
| ^^ help: remove the `..`
error[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:12:17
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:16:17
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: argument types not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:12:23
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^ help: remove the input types: `()`
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:16:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^ help: remove the return type
error: aborting due to 5 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,29 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: future cannot be sent between threads safely
--> $DIR/basic.rs:26:13
|
LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:16:5
|
LL | T::method().await?;
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
note: required by a bound in `is_send`
--> $DIR/basic.rs:20:20
|
LL | fn is_send(_: impl Send) {}
| ^^^^ required by this bound in `is_send`
error: aborting due to 1 previous error; 1 warning emitted

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,29 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: future cannot be sent between threads safely
--> $DIR/basic.rs:26:13
|
LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:16:5
|
LL | T::method().await?;
| ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
note: required by a bound in `is_send`
--> $DIR/basic.rs:20:20
|
LL | fn is_send(_: impl Send) {}
| ^^^^ required by this bound in `is_send`
error: aborting due to 1 previous error; 1 warning emitted

View File

@ -1,50 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-110963-early.rs:6:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
| |______^ one type is more general than the other
|
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
--> $DIR/issue-110963-early.rs:37:17
|
LL | F: Future + Send + 'static,
| ^^^^
error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
| |______^ one type is more general than the other
|
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
--> $DIR/issue-110963-early.rs:37:17
|
LL | F: Future + Send + 'static,
| ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,50 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-110963-early.rs:6:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
| |______^ one type is more general than the other
|
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
--> $DIR/issue-110963-early.rs:37:17
|
LL | F: Future + Send + 'static,
| ^^^^
error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
| |______^ one type is more general than the other
|
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
--> $DIR/issue-110963-early.rs:37:17
|
LL | F: Future + Send + 'static,
| ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-110963-late.rs:6:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,10 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,28 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed for functions that have type parameters
--> $DIR/ty-or-ct-params.rs:16:12
|
LL | async fn bar<T>() {}
| - type parameter declared here
...
LL | T: Foo<bar(): Send, baz(): Send>,
| ^^^^^^^^^^^
error: return type notation is not allowed for functions that have const parameters
--> $DIR/ty-or-ct-params.rs:16:25
|
LL | async fn baz<const N: usize>() {}
| -------------- const parameter declared here
...
LL | T: Foo<bar(): Send, baz(): Send>,
| ^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -1,28 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed for functions that have type parameters
--> $DIR/ty-or-ct-params.rs:16:12
|
LL | async fn bar<T>() {}
| - type parameter declared here
...
LL | T: Foo<bar(): Send, baz(): Send>,
| ^^^^^^^^^^^
error: return type notation is not allowed for functions that have const parameters
--> $DIR/ty-or-ct-params.rs:16:25
|
LL | async fn baz<const N: usize>() {}
| -------------- const parameter declared here
...
LL | T: Foo<bar(): Send, baz(): Send>,
| ^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -1,27 +0,0 @@
error[E0658]: return type notation is experimental
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
error: parenthesized generic arguments cannot be used in associated type constraints
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^--
| |
| help: remove these parentheses
error[E0220]: associated type `m` not found for `Trait`
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^ associated type `m` not found
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0220, E0658.
For more information about an error, try `rustc --explain E0220`.

View File

@ -1,27 +0,0 @@
error[E0658]: return type notation is experimental
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
error: parenthesized generic arguments cannot be used in associated type constraints
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^--
| |
| help: remove these parentheses
error[E0220]: associated type `m` not found for `Trait`
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^ associated type `m` not found
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0220, E0658.
For more information about an error, try `rustc --explain E0220`.

View File

@ -1,13 +0,0 @@
warning: return type notation is experimental
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
warning: 1 warning emitted

View File

@ -1,13 +0,0 @@
warning: return type notation is experimental
--> $DIR/feature-gate-return_type_notation.rs:17:17
|
LL | fn foo<T: Trait<m(): Send>>() {}
| ^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= help: add `#![feature(return_type_notation)]` to the crate attributes to enable
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
warning: 1 warning emitted

View File

@ -1,79 +0,0 @@
error[E0308]: mismatched types
--> $DIR/issue-71955.rs:54:5
|
LL | foo(bar, "string", |s| s.len() == 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>`
found type `for<'r> FnOnce<(&'r &str,)>`
note: this closure does not fulfill the lifetime requirements
--> $DIR/issue-71955.rs:54:24
|
LL | foo(bar, "string", |s| s.len() == 5);
| ^^^^^^^^^^^^^^^^
note: the lifetime requirement is introduced here
--> $DIR/issue-71955.rs:34:9
|
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/issue-71955.rs:54:5
|
LL | foo(bar, "string", |s| s.len() == 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `FnOnce<(&&str,)>`
found type `for<'r> FnOnce<(&'r &str,)>`
note: this closure does not fulfill the lifetime requirements
--> $DIR/issue-71955.rs:54:24
|
LL | foo(bar, "string", |s| s.len() == 5);
| ^^^^^^^^^^^^^^^^
note: the lifetime requirement is introduced here
--> $DIR/issue-71955.rs:34:44
|
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
| ^^^^
error[E0308]: mismatched types
--> $DIR/issue-71955.rs:58:5
|
LL | foo(baz, "string", |s| s.0.len() == 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>`
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
note: this closure does not fulfill the lifetime requirements
--> $DIR/issue-71955.rs:58:24
|
LL | foo(baz, "string", |s| s.0.len() == 5);
| ^^^^^^^^^^^^^^^^^^
note: the lifetime requirement is introduced here
--> $DIR/issue-71955.rs:34:9
|
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/issue-71955.rs:58:5
|
LL | foo(baz, "string", |s| s.0.len() == 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `FnOnce<(&Wrapper<'_>,)>`
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
note: this closure does not fulfill the lifetime requirements
--> $DIR/issue-71955.rs:58:24
|
LL | foo(baz, "string", |s| s.0.len() == 5);
| ^^^^^^^^^^^^^^^^^^
note: the lifetime requirement is introduced here
--> $DIR/issue-71955.rs:34:44
|
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
| ^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,13 +0,0 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-1.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | &mut x
| ^^^^^^ returns a reference to a captured variable which escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to 1 previous error

View File

@ -1,15 +0,0 @@
error: captured variable cannot escape `FnMut` closure body
--> $DIR/issue-40510-3.rs:11:9
|
LL | || {
| - inferred to be a `FnMut` closure
LL | / || {
LL | | x.push(())
LL | | }
| |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: aborting due to 1 previous error

View File

@ -1,21 +0,0 @@
error[E0308]: `match` arms have incompatible types
--> $DIR/old-lub-glb-hr-noteq1.rs:17:14
|
LL | let z = match 22 {
| _____________-
LL | | 0 => x,
| | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
LL | | _ => y,
| | ^ one type is more general than the other
LL | |
... |
LL | |
LL | | };
| |_____- `match` arms have incompatible types
|
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,12 +0,0 @@
error[E0308]: mismatched types
--> $DIR/old-lub-glb-hr-noteq1.rs:17:14
|
LL | _ => y,
| ^ one type is more general than the other
|
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.