Auto merge of #121561 - jieyouxu:compiletest-directive-typo-check, r=onur-ozkan
Detect typos for compiletest test directives Checks directives against a known list of compiletest directives collected during migration from legacy-style compiletest directives. A suggestion for the best matching known directive will be made if an invalid directive is found. This PR does not attempt to implement checks for Makefile directives because they still have the problem of regular comments and directives sharing the same comment prefix `#`. Closes #83551.
This commit is contained in:
commit
af69f4c48c
@ -680,7 +680,8 @@ pub fn line_directive<'line>(
|
|||||||
/// This is generated by collecting directives from ui tests and then extracting their directive
|
/// This is generated by collecting directives from ui tests and then extracting their directive
|
||||||
/// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
|
/// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
|
||||||
/// best-effort approximation for diagnostics.
|
/// best-effort approximation for diagnostics.
|
||||||
const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[
|
const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
||||||
|
// tidy-alphabetical-start
|
||||||
"assembly-output",
|
"assembly-output",
|
||||||
"aux-build",
|
"aux-build",
|
||||||
"aux-crate",
|
"aux-crate",
|
||||||
@ -693,6 +694,7 @@ pub fn line_directive<'line>(
|
|||||||
"check-stdout",
|
"check-stdout",
|
||||||
"check-test-line-numbers-match",
|
"check-test-line-numbers-match",
|
||||||
"compile-flags",
|
"compile-flags",
|
||||||
|
"count",
|
||||||
"dont-check-compiler-stderr",
|
"dont-check-compiler-stderr",
|
||||||
"dont-check-compiler-stdout",
|
"dont-check-compiler-stdout",
|
||||||
"dont-check-failure-status",
|
"dont-check-failure-status",
|
||||||
@ -700,6 +702,7 @@ pub fn line_directive<'line>(
|
|||||||
"error-pattern",
|
"error-pattern",
|
||||||
"exec-env",
|
"exec-env",
|
||||||
"failure-status",
|
"failure-status",
|
||||||
|
"filecheck-flags",
|
||||||
"forbid-output",
|
"forbid-output",
|
||||||
"force-host",
|
"force-host",
|
||||||
"ignore-16bit",
|
"ignore-16bit",
|
||||||
@ -716,6 +719,7 @@ pub fn line_directive<'line>(
|
|||||||
"ignore-compare-mode-polonius",
|
"ignore-compare-mode-polonius",
|
||||||
"ignore-cross-compile",
|
"ignore-cross-compile",
|
||||||
"ignore-debug",
|
"ignore-debug",
|
||||||
|
"ignore-eabi",
|
||||||
"ignore-emscripten",
|
"ignore-emscripten",
|
||||||
"ignore-endian-big",
|
"ignore-endian-big",
|
||||||
"ignore-freebsd",
|
"ignore-freebsd",
|
||||||
@ -731,14 +735,30 @@ pub fn line_directive<'line>(
|
|||||||
"ignore-lldb",
|
"ignore-lldb",
|
||||||
"ignore-llvm-version",
|
"ignore-llvm-version",
|
||||||
"ignore-loongarch64",
|
"ignore-loongarch64",
|
||||||
|
"ignore-macabi",
|
||||||
"ignore-macos",
|
"ignore-macos",
|
||||||
|
"ignore-mode-assembly",
|
||||||
|
"ignore-mode-codegen",
|
||||||
|
"ignore-mode-codegen-units",
|
||||||
"ignore-mode-coverage-map",
|
"ignore-mode-coverage-map",
|
||||||
"ignore-mode-coverage-run",
|
"ignore-mode-coverage-run",
|
||||||
|
"ignore-mode-debuginfo",
|
||||||
|
"ignore-mode-incremental",
|
||||||
|
"ignore-mode-js-doc-test",
|
||||||
|
"ignore-mode-mir-opt",
|
||||||
|
"ignore-mode-pretty",
|
||||||
|
"ignore-mode-run-make",
|
||||||
|
"ignore-mode-run-pass-valgrind",
|
||||||
|
"ignore-mode-rustdoc",
|
||||||
|
"ignore-mode-rustdoc-json",
|
||||||
|
"ignore-mode-ui",
|
||||||
|
"ignore-mode-ui-fulldeps",
|
||||||
"ignore-msp430",
|
"ignore-msp430",
|
||||||
"ignore-msvc",
|
"ignore-msvc",
|
||||||
"ignore-musl",
|
"ignore-musl",
|
||||||
"ignore-netbsd",
|
"ignore-netbsd",
|
||||||
"ignore-nightly",
|
"ignore-nightly",
|
||||||
|
"ignore-none",
|
||||||
"ignore-nto",
|
"ignore-nto",
|
||||||
"ignore-nvptx64",
|
"ignore-nvptx64",
|
||||||
"ignore-openbsd",
|
"ignore-openbsd",
|
||||||
@ -750,18 +770,27 @@ pub fn line_directive<'line>(
|
|||||||
"ignore-spirv",
|
"ignore-spirv",
|
||||||
"ignore-stable",
|
"ignore-stable",
|
||||||
"ignore-stage1",
|
"ignore-stage1",
|
||||||
|
"ignore-stage2",
|
||||||
"ignore-test",
|
"ignore-test",
|
||||||
|
"ignore-thumb",
|
||||||
"ignore-thumbv8m.base-none-eabi",
|
"ignore-thumbv8m.base-none-eabi",
|
||||||
"ignore-thumbv8m.main-none-eabi",
|
"ignore-thumbv8m.main-none-eabi",
|
||||||
|
"ignore-unix",
|
||||||
|
"ignore-unknown",
|
||||||
"ignore-uwp",
|
"ignore-uwp",
|
||||||
"ignore-vxworks",
|
"ignore-vxworks",
|
||||||
|
"ignore-wasi",
|
||||||
"ignore-wasm",
|
"ignore-wasm",
|
||||||
"ignore-wasm32",
|
"ignore-wasm32",
|
||||||
"ignore-wasm32-bare",
|
"ignore-wasm32-bare",
|
||||||
|
"ignore-wasm64",
|
||||||
"ignore-windows",
|
"ignore-windows",
|
||||||
"ignore-windows-gnu",
|
"ignore-windows-gnu",
|
||||||
|
"ignore-x32",
|
||||||
"ignore-x86",
|
"ignore-x86",
|
||||||
|
"ignore-x86_64",
|
||||||
"ignore-x86_64-apple-darwin",
|
"ignore-x86_64-apple-darwin",
|
||||||
|
"ignore-x86_64-unknown-linux-gnu",
|
||||||
"incremental",
|
"incremental",
|
||||||
"known-bug",
|
"known-bug",
|
||||||
"llvm-cov-flags",
|
"llvm-cov-flags",
|
||||||
@ -769,9 +798,11 @@ pub fn line_directive<'line>(
|
|||||||
"min-gdb-version",
|
"min-gdb-version",
|
||||||
"min-lldb-version",
|
"min-lldb-version",
|
||||||
"min-llvm-version",
|
"min-llvm-version",
|
||||||
|
"min-system-llvm-version",
|
||||||
"needs-asm-support",
|
"needs-asm-support",
|
||||||
"needs-dlltool",
|
"needs-dlltool",
|
||||||
"needs-dynamic-linking",
|
"needs-dynamic-linking",
|
||||||
|
"needs-git-hash",
|
||||||
"needs-llvm-components",
|
"needs-llvm-components",
|
||||||
"needs-profiler-support",
|
"needs-profiler-support",
|
||||||
"needs-relocation-model-pic",
|
"needs-relocation-model-pic",
|
||||||
@ -779,6 +810,7 @@ pub fn line_directive<'line>(
|
|||||||
"needs-rust-lldb",
|
"needs-rust-lldb",
|
||||||
"needs-sanitizer-address",
|
"needs-sanitizer-address",
|
||||||
"needs-sanitizer-cfi",
|
"needs-sanitizer-cfi",
|
||||||
|
"needs-sanitizer-dataflow",
|
||||||
"needs-sanitizer-hwaddress",
|
"needs-sanitizer-hwaddress",
|
||||||
"needs-sanitizer-leak",
|
"needs-sanitizer-leak",
|
||||||
"needs-sanitizer-memory",
|
"needs-sanitizer-memory",
|
||||||
@ -801,6 +833,7 @@ pub fn line_directive<'line>(
|
|||||||
"only-aarch64",
|
"only-aarch64",
|
||||||
"only-arm",
|
"only-arm",
|
||||||
"only-avr",
|
"only-avr",
|
||||||
|
"only-beta",
|
||||||
"only-bpf",
|
"only-bpf",
|
||||||
"only-cdb",
|
"only-cdb",
|
||||||
"only-gnu",
|
"only-gnu",
|
||||||
@ -818,6 +851,7 @@ pub fn line_directive<'line>(
|
|||||||
"only-riscv64",
|
"only-riscv64",
|
||||||
"only-sparc",
|
"only-sparc",
|
||||||
"only-sparc64",
|
"only-sparc64",
|
||||||
|
"only-stable",
|
||||||
"only-thumb",
|
"only-thumb",
|
||||||
"only-wasm32",
|
"only-wasm32",
|
||||||
"only-wasm32-bare",
|
"only-wasm32-bare",
|
||||||
@ -825,6 +859,7 @@ pub fn line_directive<'line>(
|
|||||||
"only-x86",
|
"only-x86",
|
||||||
"only-x86_64",
|
"only-x86_64",
|
||||||
"only-x86_64-fortanix-unknown-sgx",
|
"only-x86_64-fortanix-unknown-sgx",
|
||||||
|
"only-x86_64-pc-windows-gnu",
|
||||||
"only-x86_64-pc-windows-msvc",
|
"only-x86_64-pc-windows-msvc",
|
||||||
"only-x86_64-unknown-linux-gnu",
|
"only-x86_64-unknown-linux-gnu",
|
||||||
"pp-exact",
|
"pp-exact",
|
||||||
@ -846,6 +881,7 @@ pub fn line_directive<'line>(
|
|||||||
"unit-test",
|
"unit-test",
|
||||||
"unset-exec-env",
|
"unset-exec-env",
|
||||||
"unset-rustc-env",
|
"unset-rustc-env",
|
||||||
|
// tidy-alphabetical-end
|
||||||
];
|
];
|
||||||
|
|
||||||
/// The broken-down contents of a line containing a test header directive,
|
/// The broken-down contents of a line containing a test header directive,
|
||||||
@ -876,6 +912,22 @@ struct HeaderLine<'ln> {
|
|||||||
directive: &'ln str,
|
directive: &'ln str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) struct CheckDirectiveResult<'ln> {
|
||||||
|
is_known_directive: bool,
|
||||||
|
directive_name: &'ln str,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns `(is_known_directive, directive_name)`.
|
||||||
|
pub(crate) fn check_directive(directive_ln: &str) -> CheckDirectiveResult<'_> {
|
||||||
|
let directive_name =
|
||||||
|
directive_ln.split_once([':', ' ']).map(|(pre, _)| pre).unwrap_or(directive_ln);
|
||||||
|
|
||||||
|
CheckDirectiveResult {
|
||||||
|
is_known_directive: KNOWN_DIRECTIVE_NAMES.contains(&directive_name),
|
||||||
|
directive_name: directive_ln,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn iter_header(
|
fn iter_header(
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
_suite: &str,
|
_suite: &str,
|
||||||
@ -915,6 +967,7 @@ fn iter_header(
|
|||||||
let mut ln = String::new();
|
let mut ln = String::new();
|
||||||
let mut line_number = 0;
|
let mut line_number = 0;
|
||||||
|
|
||||||
|
// Match on error annotations like `//~ERROR`.
|
||||||
static REVISION_MAGIC_COMMENT_RE: Lazy<Regex> =
|
static REVISION_MAGIC_COMMENT_RE: Lazy<Regex> =
|
||||||
Lazy::new(|| Regex::new("//(\\[.*\\])?~.*").unwrap());
|
Lazy::new(|| Regex::new("//(\\[.*\\])?~.*").unwrap());
|
||||||
|
|
||||||
@ -933,9 +986,38 @@ fn iter_header(
|
|||||||
if ln.starts_with("fn") || ln.starts_with("mod") {
|
if ln.starts_with("fn") || ln.starts_with("mod") {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// First try to accept `ui_test` style comments
|
// First try to accept `ui_test` style comments (`//@`)
|
||||||
} else if let Some((header_revision, directive)) = line_directive(comment, ln) {
|
} else if let Some((header_revision, non_revisioned_directive_line)) =
|
||||||
it(HeaderLine { line_number, original_line, header_revision, directive });
|
line_directive(comment, ln)
|
||||||
|
{
|
||||||
|
// Perform unknown directive check on Rust files.
|
||||||
|
if testfile.extension().map(|e| e == "rs").unwrap_or(false) {
|
||||||
|
let directive_ln = non_revisioned_directive_line.trim();
|
||||||
|
|
||||||
|
let CheckDirectiveResult { is_known_directive, .. } = check_directive(directive_ln);
|
||||||
|
|
||||||
|
if !is_known_directive {
|
||||||
|
*poisoned = true;
|
||||||
|
|
||||||
|
eprintln!(
|
||||||
|
"error: detected unknown compiletest test directive `{}` in {}:{}",
|
||||||
|
directive_ln,
|
||||||
|
testfile.display(),
|
||||||
|
line_number,
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
it(HeaderLine {
|
||||||
|
line_number,
|
||||||
|
original_line,
|
||||||
|
header_revision,
|
||||||
|
directive: non_revisioned_directive_line,
|
||||||
|
});
|
||||||
|
// Then we try to check for legacy-style candidates, which are not the magic ~ERROR family
|
||||||
|
// error annotations.
|
||||||
} else if !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
|
} else if !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
|
||||||
let Some((_, rest)) = line_directive("//", ln) else {
|
let Some((_, rest)) = line_directive("//", ln) else {
|
||||||
continue;
|
continue;
|
||||||
@ -949,27 +1031,13 @@ fn iter_header(
|
|||||||
|
|
||||||
let rest = rest.trim_start();
|
let rest = rest.trim_start();
|
||||||
|
|
||||||
for candidate in DIAGNOSTICS_DIRECTIVE_NAMES.iter() {
|
let CheckDirectiveResult { is_known_directive, directive_name } = check_directive(rest);
|
||||||
if rest.starts_with(candidate) {
|
|
||||||
let Some(prefix_removed) = rest.strip_prefix(candidate) else {
|
|
||||||
// We have a comment that's *successfully* parsed as an legacy-style
|
|
||||||
// directive. We emit an error here to warn the user.
|
|
||||||
*poisoned = true;
|
|
||||||
eprintln!(
|
|
||||||
"error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
|
|
||||||
testfile.display(),
|
|
||||||
line_number,
|
|
||||||
line_directive("//", ln),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
if prefix_removed.starts_with([' ', ':']) {
|
if is_known_directive {
|
||||||
// We have a comment that's *successfully* parsed as an legacy-style
|
|
||||||
// directive. We emit an error here to warn the user.
|
|
||||||
*poisoned = true;
|
*poisoned = true;
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
|
"error: detected legacy-style directive {} in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead: {:#?}",
|
||||||
|
directive_name,
|
||||||
testfile.display(),
|
testfile.display(),
|
||||||
line_number,
|
line_number,
|
||||||
line_directive("//", ln),
|
line_directive("//", ln),
|
||||||
@ -979,8 +1047,6 @@ fn iter_header(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
fn parse_aux_crate(r: String) -> (String, String) {
|
fn parse_aux_crate(r: String) -> (String, String) {
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
//~ HELP
|
||||||
|
fn main() {} //~ERROR
|
||||||
|
//~^ ERROR
|
||||||
|
//~| ERROR
|
@ -0,0 +1,4 @@
|
|||||||
|
//! ignore-wasm
|
||||||
|
//@ ignore-wasm
|
||||||
|
//@ check-pass
|
||||||
|
// regular comment
|
@ -0,0 +1 @@
|
|||||||
|
// ignore-wasm
|
@ -0,0 +1 @@
|
|||||||
|
# ignore-owo
|
@ -0,0 +1 @@
|
|||||||
|
//@ needs-headpat
|
@ -5,6 +5,8 @@
|
|||||||
use crate::common::{Config, Debugger, Mode};
|
use crate::common::{Config, Debugger, Mode};
|
||||||
use crate::header::{parse_normalization_string, EarlyProps, HeadersCache};
|
use crate::header::{parse_normalization_string, EarlyProps, HeadersCache};
|
||||||
|
|
||||||
|
use super::iter_header;
|
||||||
|
|
||||||
fn make_test_description<R: Read>(
|
fn make_test_description<R: Read>(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
name: test::TestName,
|
name: test::TestName,
|
||||||
@ -612,3 +614,63 @@ fn threads_support() {
|
|||||||
assert_eq!(check_ignore(&config, "//@ needs-threads"), !has_threads)
|
assert_eq!(check_ignore(&config, "//@ needs-threads"), !has_threads)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn run_path(poisoned: &mut bool, path: &Path, buf: &[u8]) {
|
||||||
|
let rdr = std::io::Cursor::new(&buf);
|
||||||
|
iter_header(Mode::Ui, "ui", poisoned, path, rdr, &mut |_| {});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_unknown_directive_check() {
|
||||||
|
let mut poisoned = false;
|
||||||
|
run_path(
|
||||||
|
&mut poisoned,
|
||||||
|
Path::new("a.rs"),
|
||||||
|
include_bytes!("./test-auxillary/unknown_directive.rs"),
|
||||||
|
);
|
||||||
|
assert!(poisoned);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_known_legacy_directive_check() {
|
||||||
|
let mut poisoned = false;
|
||||||
|
run_path(
|
||||||
|
&mut poisoned,
|
||||||
|
Path::new("a.rs"),
|
||||||
|
include_bytes!("./test-auxillary/known_legacy_directive.rs"),
|
||||||
|
);
|
||||||
|
assert!(poisoned);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_known_directive_check_no_error() {
|
||||||
|
let mut poisoned = false;
|
||||||
|
run_path(
|
||||||
|
&mut poisoned,
|
||||||
|
Path::new("a.rs"),
|
||||||
|
include_bytes!("./test-auxillary/known_directive.rs"),
|
||||||
|
);
|
||||||
|
assert!(!poisoned);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_error_annotation_no_error() {
|
||||||
|
let mut poisoned = false;
|
||||||
|
run_path(
|
||||||
|
&mut poisoned,
|
||||||
|
Path::new("a.rs"),
|
||||||
|
include_bytes!("./test-auxillary/error_annotation.rs"),
|
||||||
|
);
|
||||||
|
assert!(!poisoned);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_non_rs_unknown_directive_not_checked() {
|
||||||
|
let mut poisoned = false;
|
||||||
|
run_path(
|
||||||
|
&mut poisoned,
|
||||||
|
Path::new("a.Makefile"),
|
||||||
|
include_bytes!("./test-auxillary/not_rs.Makefile"),
|
||||||
|
);
|
||||||
|
assert!(!poisoned);
|
||||||
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// The nll_beyond revision is disabled due to missing support from two-phase beyond autorefs
|
// The nll_beyond revision is disabled due to missing support from two-phase beyond autorefs
|
||||||
//@[nll_beyond]compile-flags: -Z two-phase-beyond-autoref
|
//@[nll_beyond]compile-flags: -Z two-phase-beyond-autoref
|
||||||
//[nll_beyond]should-fail
|
//@[nll_beyond]should-fail
|
||||||
|
|
||||||
// This is a corner case that the current implementation is (probably)
|
// This is a corner case that the current implementation is (probably)
|
||||||
// treating more conservatively than is necessary. But it also does
|
// treating more conservatively than is necessary. But it also does
|
||||||
|
@ -5,25 +5,25 @@ LL | fn define() -> Opaque {
|
|||||||
| ^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
|
| ^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
|
||||||
|
|
|
|
||||||
note: previous use here
|
note: previous use here
|
||||||
--> $DIR/normalize-hidden-types.rs:27:9
|
--> $DIR/normalize-hidden-types.rs:26:9
|
||||||
|
|
|
|
||||||
LL | dyn_hoops::<_>(0)
|
LL | dyn_hoops::<_>(0)
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/normalize-hidden-types.rs:34:22
|
--> $DIR/normalize-hidden-types.rs:33:22
|
||||||
|
|
|
|
||||||
LL | fn define_1() -> Opaque { dyn_hoops::<_>(0) }
|
LL | fn define_1() -> Opaque { dyn_hoops::<_>(0) }
|
||||||
| ^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
|
| ^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
|
||||||
|
|
|
|
||||||
note: previous use here
|
note: previous use here
|
||||||
--> $DIR/normalize-hidden-types.rs:34:31
|
--> $DIR/normalize-hidden-types.rs:33:31
|
||||||
|
|
|
|
||||||
LL | fn define_1() -> Opaque { dyn_hoops::<_>(0) }
|
LL | fn define_1() -> Opaque { dyn_hoops::<_>(0) }
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/normalize-hidden-types.rs:44:25
|
--> $DIR/normalize-hidden-types.rs:42:25
|
||||||
|
|
|
|
||||||
LL | type Opaque = impl Sized;
|
LL | type Opaque = impl Sized;
|
||||||
| ---------- the expected opaque type
|
| ---------- the expected opaque type
|
||||||
@ -39,13 +39,13 @@ LL | let _: Opaque = dyn_hoops::<u8>(0);
|
|||||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||||
|
|
||||||
error: concrete type differs from previous defining opaque type use
|
error: concrete type differs from previous defining opaque type use
|
||||||
--> $DIR/normalize-hidden-types.rs:54:25
|
--> $DIR/normalize-hidden-types.rs:51:25
|
||||||
|
|
|
|
||||||
LL | let _: Opaque = dyn_hoops::<_>(0);
|
LL | let _: Opaque = dyn_hoops::<_>(0);
|
||||||
| ^^^^^^^^^^^^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
|
| ^^^^^^^^^^^^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
|
||||||
|
|
|
|
||||||
note: previous use here
|
note: previous use here
|
||||||
--> $DIR/normalize-hidden-types.rs:56:9
|
--> $DIR/normalize-hidden-types.rs:52:9
|
||||||
|
|
|
|
||||||
LL | None
|
LL | None
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//@ revisions: current next
|
//@ revisions: current next
|
||||||
//@ [next] compile-flags: -Znext-solver
|
//@ [next] compile-flags: -Znext-solver
|
||||||
//@ [next] check-pass
|
//@ [next] check-pass
|
||||||
//@ [current]: known-bug: #112691
|
//@ [current] known-bug: #112691
|
||||||
|
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
@ -23,7 +23,6 @@ mod typeof_1 {
|
|||||||
use super::*;
|
use super::*;
|
||||||
type Opaque = impl Sized;
|
type Opaque = impl Sized;
|
||||||
fn define() -> Opaque {
|
fn define() -> Opaque {
|
||||||
//[current]~^ ERROR concrete type differs
|
|
||||||
dyn_hoops::<_>(0)
|
dyn_hoops::<_>(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,7 +31,6 @@ mod typeof_2 {
|
|||||||
use super::*;
|
use super::*;
|
||||||
type Opaque = impl Sized;
|
type Opaque = impl Sized;
|
||||||
fn define_1() -> Opaque { dyn_hoops::<_>(0) }
|
fn define_1() -> Opaque { dyn_hoops::<_>(0) }
|
||||||
//[current]~^ ERROR concrete type differs
|
|
||||||
fn define_2() -> Opaque { dyn_hoops::<u8>(0) }
|
fn define_2() -> Opaque { dyn_hoops::<u8>(0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +40,6 @@ mod typeck {
|
|||||||
fn define() -> Option<Opaque> {
|
fn define() -> Option<Opaque> {
|
||||||
let _: Opaque = dyn_hoops::<_>(0);
|
let _: Opaque = dyn_hoops::<_>(0);
|
||||||
let _: Opaque = dyn_hoops::<u8>(0);
|
let _: Opaque = dyn_hoops::<u8>(0);
|
||||||
//[current]~^ ERROR mismatched types
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +49,6 @@ mod borrowck {
|
|||||||
type Opaque = impl Sized;
|
type Opaque = impl Sized;
|
||||||
fn define() -> Option<Opaque> {
|
fn define() -> Option<Opaque> {
|
||||||
let _: Opaque = dyn_hoops::<_>(0);
|
let _: Opaque = dyn_hoops::<_>(0);
|
||||||
//[current]~^ ERROR concrete type differs
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user