Merge from rustc
This commit is contained in:
commit
6c2fa0bce7
221 changed files with 3217 additions and 2142 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Tests behavior of rustdoc `--runtool`.
|
||||
// Tests behavior of rustdoc `--test-runtool`.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ fn mkdir(name: &str) -> PathBuf {
|
|||
dir
|
||||
}
|
||||
|
||||
// Behavior with --runtool with relative paths and --test-run-directory.
|
||||
// Behavior with --test-runtool with relative paths and --test-run-directory.
|
||||
fn main() {
|
||||
let run_dir_name = "rundir";
|
||||
let run_dir = mkdir(run_dir_name);
|
||||
|
|
@ -27,7 +27,7 @@ fn main() {
|
|||
.arg("--test")
|
||||
.arg("--test-run-directory")
|
||||
.arg(run_dir_name)
|
||||
.arg("--runtool")
|
||||
.arg("--test-runtool")
|
||||
.arg(&run_tool_binary)
|
||||
.extern_("t", "libt.rlib")
|
||||
.run();
|
||||
|
|
|
|||
|
|
@ -138,12 +138,9 @@ Options:
|
|||
--show-coverage
|
||||
calculate percentage of public items with
|
||||
documentation
|
||||
--enable-per-target-ignores
|
||||
parse ignore-foo for ignoring doctests on a per-target
|
||||
basis
|
||||
--runtool The tool to run tests with when building for a different target than host
|
||||
--test-runtool The tool to run tests with when building for a different target than host
|
||||
|
||||
--runtool-arg One (of possibly many) arguments to pass to the runtool
|
||||
--test-runtool-arg One argument (of possibly many) to pass to the runtool
|
||||
|
||||
--test-builder PATH
|
||||
The rustc-like binary to use as the test builder
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ assert-property: (".top-doc .docblock table", {"scrollWidth": "1572"})
|
|||
// Checking it works on other doc blocks as well...
|
||||
|
||||
// Logically, the ".docblock" and the "<p>" should have the same scroll width (if we exclude the margin).
|
||||
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": 816})
|
||||
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": 835})
|
||||
assert-property: ("#implementations-list > details .docblock > p", {"scrollWidth": 835})
|
||||
// However, since there is overflow in the <table>, its scroll width is bigger.
|
||||
assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1572"})
|
||||
|
|
|
|||
16
tests/rustdoc-gui/impl-doc-indent.goml
Normal file
16
tests/rustdoc-gui/impl-doc-indent.goml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Checks the impl block docs have the correct indent.
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/impls_indent/struct.Context.html"
|
||||
|
||||
// First we ensure that the impl items are indent (more on the right of the screen) than the
|
||||
// impl itself.
|
||||
store-position: ("#impl-Context", {"x": impl_x})
|
||||
store-position: ("#impl-Context > .item-info", {"x": impl_item_x})
|
||||
assert: |impl_x| < |impl_item_x|
|
||||
|
||||
// And we ensure that all impl items have the same indent.
|
||||
assert-position: ("#impl-Context > .docblock", {"x": |impl_item_x|})
|
||||
assert-position: ("#impl-Context + .docblock", {"x": |impl_item_x|})
|
||||
|
||||
// Same with the collapsible impl block.
|
||||
assert-position: ("#impl-Context-1 > .docblock", {"x": |impl_item_x|})
|
||||
assert-position: (".implementors-toggle > summary + .docblock", {"x": |impl_item_x|})
|
||||
|
|
@ -21,7 +21,7 @@ compare-elements-property: (
|
|||
)
|
||||
assert-property: (
|
||||
"#impl-SimpleTrait-for-LongItemInfo2 .item-info",
|
||||
{"scrollWidth": "916"},
|
||||
{"scrollWidth": "935"},
|
||||
)
|
||||
// Just to be sure we're comparing the correct "item-info":
|
||||
assert-text: (
|
||||
|
|
|
|||
|
|
@ -740,3 +740,29 @@ pub mod SidebarSort {
|
|||
impl Sort for Cell<u8> {}
|
||||
impl<'a> Sort for &'a str {}
|
||||
}
|
||||
|
||||
pub mod impls_indent {
|
||||
pub struct Context;
|
||||
|
||||
/// Working with objects.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Functions that take indices of locals do not check bounds on these indices;
|
||||
/// the caller must ensure that the indices are less than the number of locals
|
||||
/// in the current stack frame.
|
||||
impl Context {
|
||||
}
|
||||
|
||||
/// Working with objects.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Functions that take indices of locals do not check bounds on these indices;
|
||||
/// the caller must ensure that the indices are less than the number of locals
|
||||
/// in the current stack frame.
|
||||
impl Context {
|
||||
/// bla
|
||||
pub fn bar() {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
21
tests/rustdoc/doctest/auxiliary/doctest-runtool.rs
Normal file
21
tests/rustdoc/doctest/auxiliary/doctest-runtool.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// For some reason on Windows, the PATH to the libstd dylib doesn't seem to
|
||||
// carry over to running the runtool.
|
||||
//@ no-prefer-dynamic
|
||||
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<_> = std::env::args().collect();
|
||||
eprintln!("{args:#?}");
|
||||
assert_eq!(args.len(), 4);
|
||||
assert_eq!(args[1], "arg1");
|
||||
assert_eq!(args[2], "arg2 with space");
|
||||
let path = Path::new(&args[3]);
|
||||
let output = Command::new(path).output().unwrap();
|
||||
// Should fail without env var.
|
||||
assert!(!output.status.success());
|
||||
let output = Command::new(path).env("DOCTEST_RUNTOOL_CHECK", "xyz").output().unwrap();
|
||||
// Should pass with env var.
|
||||
assert!(output.status.success());
|
||||
}
|
||||
13
tests/rustdoc/doctest/doctest-runtool.rs
Normal file
13
tests/rustdoc/doctest/doctest-runtool.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Tests that the --test-runtool argument works.
|
||||
|
||||
//@ ignore-cross-compile
|
||||
//@ aux-bin: doctest-runtool.rs
|
||||
//@ compile-flags: --test
|
||||
//@ compile-flags: --test-runtool=auxiliary/bin/doctest-runtool
|
||||
//@ compile-flags: --test-runtool-arg=arg1 --test-runtool-arg
|
||||
//@ compile-flags: 'arg2 with space'
|
||||
|
||||
/// ```
|
||||
/// assert_eq!(std::env::var("DOCTEST_RUNTOOL_CHECK"), Ok("xyz".to_string()));
|
||||
/// ```
|
||||
pub fn main() {}
|
||||
|
|
@ -51,3 +51,12 @@ fn main() {
|
|||
#[unsafe(naked)] //~ ERROR should be applied to a function definition
|
||||
|| {};
|
||||
}
|
||||
|
||||
// Check that the path of an attribute without a name is printed correctly (issue #140082)
|
||||
#[::a]
|
||||
//~^ ERROR attribute incompatible with `#[unsafe(naked)]`
|
||||
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `a`
|
||||
#[unsafe(naked)]
|
||||
extern "C" fn issue_140082() {
|
||||
naked_asm!("")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
|
||||
--> $DIR/naked-invalid-attr.rs:56:5
|
||||
|
|
||||
LL | #[::a]
|
||||
| ^ use of unresolved module or unlinked crate `a`
|
||||
|
||||
error: attribute should be applied to a function definition
|
||||
--> $DIR/naked-invalid-attr.rs:13:1
|
||||
|
|
||||
|
|
@ -27,6 +33,15 @@ LL | #[unsafe(naked)]
|
|||
LL | || {};
|
||||
| ----- not a function definition
|
||||
|
||||
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
|
||||
--> $DIR/naked-invalid-attr.rs:56:1
|
||||
|
|
||||
LL | #[::a]
|
||||
| ^^^^^^ the `{{root}}::a` attribute is incompatible with `#[unsafe(naked)]`
|
||||
...
|
||||
LL | #[unsafe(naked)]
|
||||
| ---------------- function marked with `#[unsafe(naked)]` here
|
||||
|
||||
error: attribute should be applied to a function definition
|
||||
--> $DIR/naked-invalid-attr.rs:22:5
|
||||
|
|
||||
|
|
@ -49,5 +64,7 @@ error: attribute should be applied to a function definition
|
|||
LL | #![unsafe(naked)]
|
||||
| ^^^^^^^^^^^^^^^^^ cannot be applied to crates
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0433, E0736.
|
||||
For more information about an error, try `rustc --explain E0433`.
|
||||
|
|
|
|||
8
tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_.stderr
Normal file
8
tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: unexpected `--cfg target_has_reliable_f128` flag
|
||||
|
|
||||
= note: config `target_has_reliable_f128` is only supposed to be controlled by `--target`
|
||||
= note: manually setting a built-in cfg can and does create incoherent behaviors
|
||||
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
error: unexpected `--cfg target_has_reliable_f128_math` flag
|
||||
|
|
||||
= note: config `target_has_reliable_f128_math` is only supposed to be controlled by `--target`
|
||||
= note: manually setting a built-in cfg can and does create incoherent behaviors
|
||||
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
8
tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_.stderr
Normal file
8
tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: unexpected `--cfg target_has_reliable_f16` flag
|
||||
|
|
||||
= note: config `target_has_reliable_f16` is only supposed to be controlled by `--target`
|
||||
= note: manually setting a built-in cfg can and does create incoherent behaviors
|
||||
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
error: unexpected `--cfg target_has_reliable_f16_math` flag
|
||||
|
|
||||
= note: config `target_has_reliable_f16_math` is only supposed to be controlled by `--target`
|
||||
= note: manually setting a built-in cfg can and does create incoherent behaviors
|
||||
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
//@ revisions: target_thread_local_ relocation_model_
|
||||
//@ revisions: fmt_debug_
|
||||
//@ revisions: emscripten_wasm_eh_
|
||||
//@ revisions: reliable_f16_ reliable_f16_math_ reliable_f128_ reliable_f128_math_
|
||||
|
||||
//@ [overflow_checks_]compile-flags: --cfg overflow_checks
|
||||
//@ [debug_assertions_]compile-flags: --cfg debug_assertions
|
||||
|
|
@ -35,6 +36,10 @@
|
|||
//@ [relocation_model_]compile-flags: --cfg relocation_model="a"
|
||||
//@ [fmt_debug_]compile-flags: --cfg fmt_debug="shallow"
|
||||
//@ [emscripten_wasm_eh_]compile-flags: --cfg emscripten_wasm_eh
|
||||
//@ [reliable_f16_]compile-flags: --cfg target_has_reliable_f16
|
||||
//@ [reliable_f16_math_]compile-flags: --cfg target_has_reliable_f16_math
|
||||
//@ [reliable_f128_]compile-flags: --cfg target_has_reliable_f128
|
||||
//@ [reliable_f128_math_]compile-flags: --cfg target_has_reliable_f128_math
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,14 @@ error[E0605]: non-primitive cast: `u32` as `Option<_>`
|
|||
--> $DIR/issue-73886.rs:4:13
|
||||
|
|
||||
LL | let _ = 7u32 as Option<_>;
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using the `From` trait instead: `Option<_>::from(7u32)`
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
help: consider using the `From` trait instead
|
||||
|
|
||||
LL - let _ = 7u32 as Option<_>;
|
||||
LL + let _ = Option::<_>::from(7u32);
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
10
tests/ui/coercion/non-primitive-cast-135412.fixed
Normal file
10
tests/ui/coercion/non-primitive-cast-135412.fixed
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//@ run-rustfix
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
fn main() {
|
||||
let _ = Option::<_>::from(7u32);
|
||||
//~^ ERROR non-primitive cast: `u32` as `Option<_>`
|
||||
let _ = Arc::<str>::from("String");
|
||||
//~^ ERROR non-primitive cast: `&'static str` as `Arc<str>`
|
||||
}
|
||||
10
tests/ui/coercion/non-primitive-cast-135412.rs
Normal file
10
tests/ui/coercion/non-primitive-cast-135412.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//@ run-rustfix
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
fn main() {
|
||||
let _ = 7u32 as Option<_>;
|
||||
//~^ ERROR non-primitive cast: `u32` as `Option<_>`
|
||||
let _ = "String" as Arc<str>;
|
||||
//~^ ERROR non-primitive cast: `&'static str` as `Arc<str>`
|
||||
}
|
||||
29
tests/ui/coercion/non-primitive-cast-135412.stderr
Normal file
29
tests/ui/coercion/non-primitive-cast-135412.stderr
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
error[E0605]: non-primitive cast: `u32` as `Option<_>`
|
||||
--> $DIR/non-primitive-cast-135412.rs:6:13
|
||||
|
|
||||
LL | let _ = 7u32 as Option<_>;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
help: consider using the `From` trait instead
|
||||
|
|
||||
LL - let _ = 7u32 as Option<_>;
|
||||
LL + let _ = Option::<_>::from(7u32);
|
||||
|
|
||||
|
||||
error[E0605]: non-primitive cast: `&'static str` as `Arc<str>`
|
||||
--> $DIR/non-primitive-cast-135412.rs:8:13
|
||||
|
|
||||
LL | let _ = "String" as Arc<str>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
help: consider using the `From` trait instead
|
||||
|
|
||||
LL - let _ = "String" as Arc<str>;
|
||||
LL + let _ = Arc::<str>::from("String");
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0605`.
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#[derive(Debug)]
|
||||
struct Foo {
|
||||
i: isize,
|
||||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn foo(i:isize) -> Foo {
|
||||
Foo {
|
||||
i: i
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = foo(10);
|
||||
let _y = x.clone();
|
||||
//~^ ERROR no method named `clone` found
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
|
@ -18,13 +18,16 @@ LL | where
|
|||
LL | T: AsExpression<Self::SqlType>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check`
|
||||
|
||||
error[E0271]: type mismatch resolving `Integer == Text`
|
||||
error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
|
||||
--> $DIR/as_expression.rs:56:5
|
||||
|
|
||||
LL | SelectInt.check("bar");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ types differ
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
|
|
||||
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
= help: for that trait implementation, expected `Text`, found `Integer`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0271, E0277.
|
||||
For more information about an error, try `rustc --explain E0271`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -55,5 +55,5 @@ impl<T> Foo for T where T: Expression {}
|
|||
fn main() {
|
||||
SelectInt.check("bar");
|
||||
//~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied
|
||||
//[next]~| ERROR type mismatch
|
||||
//[next]~| ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
//@ compile-flags: --check-cfg=cfg(target_has_reliable_f16,target_has_reliable_f16_math,target_has_reliable_f128,target_has_reliable_f128_math)
|
||||
|
||||
fn main() {
|
||||
cfg!(target_has_reliable_f16);
|
||||
//~^ ERROR `cfg(target_has_reliable_f16)` is experimental and subject to change
|
||||
cfg!(target_has_reliable_f16_math);
|
||||
//~^ ERROR `cfg(target_has_reliable_f16_math)` is experimental and subject to change
|
||||
cfg!(target_has_reliable_f128);
|
||||
//~^ ERROR `cfg(target_has_reliable_f128)` is experimental and subject to change
|
||||
cfg!(target_has_reliable_f128_math);
|
||||
//~^ ERROR `cfg(target_has_reliable_f128_math)` is experimental and subject to change
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
error[E0658]: `cfg(target_has_reliable_f16)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:4:10
|
||||
|
|
||||
LL | cfg!(target_has_reliable_f16);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(target_has_reliable_f16_math)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:6:10
|
||||
|
|
||||
LL | cfg!(target_has_reliable_f16_math);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(target_has_reliable_f128)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:8:10
|
||||
|
|
||||
LL | cfg!(target_has_reliable_f128);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(target_has_reliable_f128_math)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:10:10
|
||||
|
|
||||
LL | cfg!(target_has_reliable_f128_math);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
const XY_1: i32 = 10;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
|
||||
--> $DIR/feature-gate-concat_idents.rs:5:13
|
||||
--> $DIR/feature-gate-concat_idents.rs:7:13
|
||||
|
|
||||
LL | let a = concat_idents!(X, Y_1);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
@ -9,7 +9,7 @@ LL | let a = concat_idents!(X, Y_1);
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
|
||||
--> $DIR/feature-gate-concat_idents.rs:6:13
|
||||
--> $DIR/feature-gate-concat_idents.rs:8:13
|
||||
|
|
||||
LL | let b = concat_idents!(X, Y_2);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
fn main() {
|
||||
concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
|
||||
//~| ERROR cannot find value `ab` in this scope
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
|
||||
--> $DIR/feature-gate-concat_idents2.rs:2:5
|
||||
--> $DIR/feature-gate-concat_idents2.rs:4:5
|
||||
|
|
||||
LL | concat_idents!(a, b);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
@ -9,7 +9,7 @@ LL | concat_idents!(a, b);
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0425]: cannot find value `ab` in this scope
|
||||
--> $DIR/feature-gate-concat_idents2.rs:2:5
|
||||
--> $DIR/feature-gate-concat_idents2.rs:4:5
|
||||
|
|
||||
LL | concat_idents!(a, b);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
const XY_1: i32 = 10;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
|
||||
--> $DIR/feature-gate-concat_idents3.rs:5:20
|
||||
--> $DIR/feature-gate-concat_idents3.rs:7:20
|
||||
|
|
||||
LL | assert_eq!(10, concat_idents!(X, Y_1));
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
@ -9,7 +9,7 @@ LL | assert_eq!(10, concat_idents!(X, Y_1));
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
|
||||
--> $DIR/feature-gate-concat_idents3.rs:6:20
|
||||
--> $DIR/feature-gate-concat_idents3.rs:8:20
|
||||
|
|
||||
LL | assert_eq!(20, concat_idents!(X, Y_2));
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
|
|||
31
tests/ui/float/target-has-reliable-nightly-float.rs
Normal file
31
tests/ui/float/target-has-reliable-nightly-float.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//@ run-pass
|
||||
//@ compile-flags: --check-cfg=cfg(target_has_reliable_f16,target_has_reliable_f16_math,target_has_reliable_f128,target_has_reliable_f128_math)
|
||||
// Verify that the feature gates and config work and are registered as known config
|
||||
// options.
|
||||
|
||||
#![deny(unexpected_cfgs)]
|
||||
#![feature(cfg_target_has_reliable_f16_f128)]
|
||||
|
||||
#[cfg(target_has_reliable_f16)]
|
||||
pub fn has_f16() {}
|
||||
|
||||
#[cfg(target_has_reliable_f16_math)]
|
||||
pub fn has_f16_math() {}
|
||||
|
||||
#[cfg(target_has_reliable_f128 )]
|
||||
pub fn has_f128() {}
|
||||
|
||||
#[cfg(target_has_reliable_f128_math)]
|
||||
pub fn has_f128_math() {}
|
||||
|
||||
fn main() {
|
||||
if cfg!(target_arch = "aarch64") && cfg!(target_os = "linux") {
|
||||
// Aarch64+Linux is one target that has support for all features, so use it to spot
|
||||
// check that the compiler does indeed enable these gates.
|
||||
|
||||
assert!(cfg!(target_has_reliable_f16));
|
||||
assert!(cfg!(target_has_reliable_f16_math));
|
||||
assert!(cfg!(target_has_reliable_f128));
|
||||
assert!(cfg!(target_has_reliable_f128_math));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
trait ServerFn {
|
||||
type Output;
|
||||
fn run_body() -> impl Sized;
|
||||
}
|
||||
struct MyServerFn {}
|
||||
|
||||
macro_rules! f {
|
||||
() => {
|
||||
impl ServerFn for MyServerFn {
|
||||
type Output = ();
|
||||
fn run_body() -> impl Sized {}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
f! {}
|
||||
|
||||
fn problem<T: ServerFn<Output = i64>>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
problem(MyServerFn {});
|
||||
//~^ ERROR type mismatch resolving `<MyServerFn as ServerFn>::Output == i64`
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
error[E0271]: type mismatch resolving `<MyServerFn as ServerFn>::Output == i64`
|
||||
--> $DIR/dont-probe-missing-item-name-4.rs:21:13
|
||||
|
|
||||
LL | problem(MyServerFn {});
|
||||
| ------- ^^^^^^^^^^^^^ type mismatch resolving `<MyServerFn as ServerFn>::Output == i64`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: expected this to be `i64`
|
||||
--> $DIR/dont-probe-missing-item-name-4.rs:10:27
|
||||
|
|
||||
LL | type Output = ();
|
||||
| ^^
|
||||
...
|
||||
LL | f! {}
|
||||
| ----- in this macro invocation
|
||||
note: required by a bound in `problem`
|
||||
--> $DIR/dont-probe-missing-item-name-4.rs:18:24
|
||||
|
|
||||
LL | fn problem<T: ServerFn<Output = i64>>(_: T) {}
|
||||
| ^^^^^^^^^^^^ required by this bound in `problem`
|
||||
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#![feature(concat_idents)]
|
||||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Baz<T>(
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: `derive` cannot be used on items with type macros
|
||||
--> $DIR/issue-32950.rs:5:5
|
||||
--> $DIR/issue-32950.rs:6:5
|
||||
|
|
||||
LL | concat_idents!(Foo, Bar)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0412]: cannot find type `FooBar` in this scope
|
||||
--> $DIR/issue-32950.rs:5:5
|
||||
--> $DIR/issue-32950.rs:6:5
|
||||
|
|
||||
LL | concat_idents!(Foo, Bar)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#![feature(concat_idents)]
|
||||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
fn main() {
|
||||
let x = concat_idents!(); //~ ERROR `concat_idents!()` takes 1 or more arguments
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: `concat_idents!()` takes 1 or more arguments
|
||||
--> $DIR/issue-50403.rs:4:13
|
||||
--> $DIR/issue-50403.rs:5:13
|
||||
|
|
||||
LL | let x = concat_idents!();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#![feature(trace_macros, concat_idents)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:13:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:14:5
|
||||
|
|
||||
LL | #[default]
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -7,7 +7,7 @@ LL | #[default]
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:18:36
|
||||
--> $DIR/macros-nonfatal-errors.rs:19:36
|
||||
|
|
||||
LL | struct DefaultInnerAttrTupleStruct(#[default] ());
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -15,7 +15,7 @@ LL | struct DefaultInnerAttrTupleStruct(#[default] ());
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:22:1
|
||||
--> $DIR/macros-nonfatal-errors.rs:23:1
|
||||
|
|
||||
LL | #[default]
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -23,7 +23,7 @@ LL | #[default]
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:26:1
|
||||
--> $DIR/macros-nonfatal-errors.rs:27:1
|
||||
|
|
||||
LL | #[default]
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -31,7 +31,7 @@ LL | #[default]
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:36:11
|
||||
--> $DIR/macros-nonfatal-errors.rs:37:11
|
||||
|
|
||||
LL | Foo = #[default] 0,
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -39,7 +39,7 @@ LL | Foo = #[default] 0,
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:37:14
|
||||
--> $DIR/macros-nonfatal-errors.rs:38:14
|
||||
|
|
||||
LL | Bar([u8; #[default] 1]),
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -47,7 +47,7 @@ LL | Bar([u8; #[default] 1]),
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error[E0665]: `#[derive(Default)]` on enum with no `#[default]`
|
||||
--> $DIR/macros-nonfatal-errors.rs:42:10
|
||||
--> $DIR/macros-nonfatal-errors.rs:43:10
|
||||
|
|
||||
LL | #[derive(Default)]
|
||||
| ^^^^^^^
|
||||
|
|
@ -67,7 +67,7 @@ LL | #[default] Bar,
|
|||
| ++++++++++
|
||||
|
||||
error[E0665]: `#[derive(Default)]` on enum with no `#[default]`
|
||||
--> $DIR/macros-nonfatal-errors.rs:48:10
|
||||
--> $DIR/macros-nonfatal-errors.rs:49:10
|
||||
|
|
||||
LL | #[derive(Default)]
|
||||
| ^^^^^^^
|
||||
|
|
@ -78,7 +78,7 @@ LL | | }
|
|||
| |_- this enum needs a unit variant marked with `#[default]`
|
||||
|
||||
error: multiple declared defaults
|
||||
--> $DIR/macros-nonfatal-errors.rs:54:10
|
||||
--> $DIR/macros-nonfatal-errors.rs:55:10
|
||||
|
|
||||
LL | #[derive(Default)]
|
||||
| ^^^^^^^
|
||||
|
|
@ -95,7 +95,7 @@ LL | Baz,
|
|||
= note: only one variant can be default
|
||||
|
||||
error: `#[default]` attribute does not accept a value
|
||||
--> $DIR/macros-nonfatal-errors.rs:66:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:67:5
|
||||
|
|
||||
LL | #[default = 1]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
@ -103,7 +103,7 @@ LL | #[default = 1]
|
|||
= help: try using `#[default]`
|
||||
|
||||
error: multiple `#[default]` attributes
|
||||
--> $DIR/macros-nonfatal-errors.rs:74:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:75:5
|
||||
|
|
||||
LL | #[default]
|
||||
| ---------- `#[default]` used here
|
||||
|
|
@ -114,13 +114,13 @@ LL | Foo,
|
|||
|
|
||||
= note: only one `#[default]` attribute is needed
|
||||
help: try removing this
|
||||
--> $DIR/macros-nonfatal-errors.rs:73:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:74:5
|
||||
|
|
||||
LL | #[default]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: multiple `#[default]` attributes
|
||||
--> $DIR/macros-nonfatal-errors.rs:84:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:85:5
|
||||
|
|
||||
LL | #[default]
|
||||
| ---------- `#[default]` used here
|
||||
|
|
@ -132,7 +132,7 @@ LL | Foo,
|
|||
|
|
||||
= note: only one `#[default]` attribute is needed
|
||||
help: try removing these
|
||||
--> $DIR/macros-nonfatal-errors.rs:81:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:82:5
|
||||
|
|
||||
LL | #[default]
|
||||
| ^^^^^^^^^^
|
||||
|
|
@ -142,7 +142,7 @@ LL | #[default]
|
|||
| ^^^^^^^^^^
|
||||
|
||||
error: the `#[default]` attribute may only be used on unit enum variants
|
||||
--> $DIR/macros-nonfatal-errors.rs:91:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:92:5
|
||||
|
|
||||
LL | Foo {},
|
||||
| ^^^
|
||||
|
|
@ -150,7 +150,7 @@ LL | Foo {},
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: default variant must be exhaustive
|
||||
--> $DIR/macros-nonfatal-errors.rs:99:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:100:5
|
||||
|
|
||||
LL | #[non_exhaustive]
|
||||
| ----------------- declared `#[non_exhaustive]` here
|
||||
|
|
@ -160,37 +160,37 @@ LL | Foo,
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: asm template must be a string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:104:10
|
||||
--> $DIR/macros-nonfatal-errors.rs:105:10
|
||||
|
|
||||
LL | asm!(invalid);
|
||||
| ^^^^^^^
|
||||
|
||||
error: `concat_idents!()` requires ident args
|
||||
--> $DIR/macros-nonfatal-errors.rs:107:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:108:5
|
||||
|
|
||||
LL | concat_idents!("not", "idents");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: argument must be a string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:109:17
|
||||
--> $DIR/macros-nonfatal-errors.rs:110:17
|
||||
|
|
||||
LL | option_env!(invalid);
|
||||
| ^^^^^^^
|
||||
|
||||
error: expected string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:110:10
|
||||
--> $DIR/macros-nonfatal-errors.rs:111:10
|
||||
|
|
||||
LL | env!(invalid);
|
||||
| ^^^^^^^
|
||||
|
||||
error: `env!()` takes 1 or 2 arguments
|
||||
--> $DIR/macros-nonfatal-errors.rs:111:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:112:5
|
||||
|
|
||||
LL | env!(foo, abr, baz);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined at compile time
|
||||
--> $DIR/macros-nonfatal-errors.rs:112:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:113:5
|
||||
|
|
||||
LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -198,7 +198,7 @@ LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
|
|||
= help: use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` to read the variable at run time
|
||||
|
||||
error: format argument must be a string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:114:13
|
||||
--> $DIR/macros-nonfatal-errors.rs:115:13
|
||||
|
|
||||
LL | format!(invalid);
|
||||
| ^^^^^^^
|
||||
|
|
@ -209,43 +209,43 @@ LL | format!("{}", invalid);
|
|||
| +++++
|
||||
|
||||
error: argument must be a string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:116:14
|
||||
--> $DIR/macros-nonfatal-errors.rs:117:14
|
||||
|
|
||||
LL | include!(invalid);
|
||||
| ^^^^^^^
|
||||
|
||||
error: argument must be a string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:118:18
|
||||
--> $DIR/macros-nonfatal-errors.rs:119:18
|
||||
|
|
||||
LL | include_str!(invalid);
|
||||
| ^^^^^^^
|
||||
|
||||
error: couldn't read `$DIR/i'd be quite surprised if a file with this name existed`: $FILE_NOT_FOUND_MSG
|
||||
--> $DIR/macros-nonfatal-errors.rs:119:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:120:5
|
||||
|
|
||||
LL | include_str!("i'd be quite surprised if a file with this name existed");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: argument must be a string literal
|
||||
--> $DIR/macros-nonfatal-errors.rs:120:20
|
||||
--> $DIR/macros-nonfatal-errors.rs:121:20
|
||||
|
|
||||
LL | include_bytes!(invalid);
|
||||
| ^^^^^^^
|
||||
|
||||
error: couldn't read `$DIR/i'd be quite surprised if a file with this name existed`: $FILE_NOT_FOUND_MSG
|
||||
--> $DIR/macros-nonfatal-errors.rs:121:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:122:5
|
||||
|
|
||||
LL | include_bytes!("i'd be quite surprised if a file with this name existed");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: trace_macros! accepts only `true` or `false`
|
||||
--> $DIR/macros-nonfatal-errors.rs:123:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:124:5
|
||||
|
|
||||
LL | trace_macros!(invalid);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: default variant must be exhaustive
|
||||
--> $DIR/macros-nonfatal-errors.rs:133:9
|
||||
--> $DIR/macros-nonfatal-errors.rs:134:9
|
||||
|
|
||||
LL | #[non_exhaustive]
|
||||
| ----------------- declared `#[non_exhaustive]` here
|
||||
|
|
@ -255,7 +255,7 @@ LL | Foo,
|
|||
= help: consider a manual implementation of `Default`
|
||||
|
||||
error: cannot find macro `llvm_asm` in this scope
|
||||
--> $DIR/macros-nonfatal-errors.rs:105:5
|
||||
--> $DIR/macros-nonfatal-errors.rs:106:5
|
||||
|
|
||||
LL | llvm_asm!(invalid);
|
||||
| ^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: no rules expected `@`
|
||||
--> $DIR/fail-simple.rs:2:12
|
||||
--> $DIR/no-matching-rule.rs:2:12
|
||||
|
|
||||
LL | panic!(@);
|
||||
| ^ no rules expected this token in macro call
|
||||
19
tests/ui/methods/clone-missing.rs
Normal file
19
tests/ui/methods/clone-missing.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
|
||||
// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
|
||||
// so attempting to clone it should fail.
|
||||
|
||||
struct Foo {
|
||||
i: isize,
|
||||
}
|
||||
|
||||
fn foo(i:isize) -> Foo {
|
||||
Foo {
|
||||
i: i
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = foo(10);
|
||||
let _y = x.clone();
|
||||
//~^ ERROR no method named `clone` found
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
|
||||
--> $DIR/copy-a-resource.rs:18:16
|
||||
--> $DIR/clone-missing.rs:17:16
|
||||
|
|
||||
LL | struct Foo {
|
||||
| ---------- method `clone` not found for this struct
|
||||
11
tests/ui/modules/mod-pub-access.rs
Normal file
11
tests/ui/modules/mod-pub-access.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//@ run-pass
|
||||
// This is a name resolution smoke test that ensures paths with more than one
|
||||
// segment (e.g., `foo::bar`) resolve correctly.
|
||||
// It also serves as a basic visibility test — confirming that a `pub` item
|
||||
// inside a private module can still be accessed from outside that module.
|
||||
|
||||
mod foo {
|
||||
pub fn bar(_offset: usize) {}
|
||||
}
|
||||
|
||||
fn main() { foo::bar(0); }
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
mod foo {
|
||||
pub fn bar(_offset: usize) { }
|
||||
}
|
||||
|
||||
pub fn main() { foo::bar(0); }
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0434]: can't capture dynamic environment in a fn item
|
||||
--> $DIR/capture1.rs:3:32
|
||||
--> $DIR/fn-item-cant-capture-dynamic-env.rs:3:32
|
||||
|
|
||||
LL | fn foo() -> isize { return bar; }
|
||||
| ^^^
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//@ run-pass
|
||||
|
||||
#![feature(repr_simd, core_intrinsics, concat_idents)]
|
||||
#![feature(repr_simd, core_intrinsics, macro_metavar_expr_concat)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use std::intrinsics::simd::{simd_eq, simd_ge, simd_gt, simd_le, simd_lt, simd_ne};
|
||||
|
|
@ -19,7 +19,7 @@ macro_rules! cmp {
|
|||
($method: ident($lhs: expr, $rhs: expr)) => {{
|
||||
let lhs = $lhs;
|
||||
let rhs = $rhs;
|
||||
let e: u32x4 = concat_idents!(simd_, $method)($lhs, $rhs);
|
||||
let e: u32x4 = ${concat(simd_, $method)}($lhs, $rhs);
|
||||
// assume the scalar version is correct/the behaviour we want.
|
||||
assert!((e.0[0] != 0) == lhs.0[0].$method(&rhs.0[0]));
|
||||
assert!((e.0[1] != 0) == lhs.0[1].$method(&rhs.0[1]));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
//@ run-pass
|
||||
|
||||
#![feature(concat_idents)]
|
||||
#![expect(deprecated)] // concat_idents is deprecated
|
||||
|
||||
pub fn main() {
|
||||
struct Foo;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags: -Znext-solver
|
||||
|
||||
// A regression test for trait-system-refactor-initiative#184.
|
||||
//
|
||||
// When adding nested goals we replace aliases with infer vars
|
||||
// and add `AliasRelate` goals to constrain them. When doing this
|
||||
// for `NormalizesTo` goals, we then first tries to prove the
|
||||
// `NormalizesTo` goal and then normalized the nested aliases.
|
||||
|
||||
trait Trait<T> {
|
||||
type Assoc;
|
||||
}
|
||||
impl<T, U> Trait<U> for T {
|
||||
type Assoc = ();
|
||||
}
|
||||
|
||||
trait Id {
|
||||
type This;
|
||||
}
|
||||
impl<T> Id for T {
|
||||
type This = T;
|
||||
}
|
||||
trait Relate<T> {
|
||||
type Alias;
|
||||
}
|
||||
impl<T, U> Relate<U> for T {
|
||||
type Alias = <T as Trait<<U as Id>::This>>::Assoc;
|
||||
}
|
||||
|
||||
|
||||
fn guide_me<T: Trait<u32>>() {
|
||||
// Normalizing `<T as Relate<i32>>::Alias` relates the associated type with an unconstrained
|
||||
// term. This resulted in a `NormalizesTo(<T as Trait<<U as Id>::This>>::Assoc, ?x)` goal.
|
||||
// We replace `<i32 as Id>::This` with an infer var `?y`, resulting in the following goals:
|
||||
// - `NormalizesTo(<T as Trait<?y>::Assoc, ?x)`
|
||||
// - `AliasRelate(<i32 as Id>::This, ?y)`
|
||||
//
|
||||
// When proving the `NormalizesTo` goal first, we incompletely constrain `?y` to `u32`,
|
||||
// causing an unexpected type mismatch.
|
||||
let _: <T as Relate<i32>>::Alias;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags: -Znext-solver
|
||||
|
||||
// When canonicalizing a response in the trait solver, we bail with overflow
|
||||
// if there are too many non-region inference variables. Doing so in normalizes-to
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
//@ compile-flags: --remap-path-prefix=/=/non-existent
|
||||
// helper for ../unnecessary-transmute-path-remap-ice-140277.rs
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! transmute {
|
||||
($e:expr) => {{
|
||||
let e = $e;
|
||||
std::mem::transmute(e)
|
||||
}};
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
//@ aux-crate: zerocopy=unnecessary-transmute-path-remap-ice-140277-trans.rs
|
||||
//@ check-pass
|
||||
// tests for a regression in linting for unnecessary transmutes
|
||||
// where a span was inacessible for snippet procuring,
|
||||
// when remap-path-prefix was set, causing a panic.
|
||||
|
||||
fn bytes_at_home(x: [u8; 4]) -> u32 {
|
||||
unsafe { zerocopy::transmute!(x) }
|
||||
}
|
||||
fn main() {}
|
||||
|
|
@ -22,7 +22,7 @@ impl<In, Out> Trait<Bar, In> for Out {
|
|||
type Out = Out;
|
||||
#[define_opaque(Bar)]
|
||||
fn convert(_i: In) -> Self::Out {
|
||||
//[next]~^ ERROR: cannot satisfy `Bar == _`
|
||||
//[next]~^ ERROR: type annotations needed: cannot satisfy `Bar == _`
|
||||
//[current]~^^ ERROR: item does not constrain `Bar::{opaque#0}`
|
||||
unreachable!();
|
||||
}
|
||||
|
|
|
|||
11
tests/ui/type-alias/type-param.rs
Normal file
11
tests/ui/type-alias/type-param.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//@ run-pass
|
||||
// This is a smoke test to ensure that type aliases with type parameters
|
||||
// are accepted by the compiler and that the parameters are correctly
|
||||
// resolved in the aliased item type.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
type Foo<T> = extern "C" fn(T) -> bool;
|
||||
type Bar<T> = fn(T) -> bool;
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
||||
|
||||
type lteq<T> = extern "C" fn(T) -> bool;
|
||||
|
||||
pub fn main() { }
|
||||
|
|
@ -839,6 +839,7 @@ mod types {
|
|||
}
|
||||
|
||||
/// TyKind::MacCall
|
||||
#[expect(deprecated)] // concat_idents is deprecated
|
||||
fn ty_mac_call() {
|
||||
let _: concat_idents!(T);
|
||||
let _: concat_idents![T];
|
||||
|
|
|
|||
|
|
@ -359,6 +359,7 @@ mod expressions {
|
|||
|
||||
|
||||
|
||||
// concat_idents is deprecated
|
||||
|
||||
|
||||
|
||||
|
|
@ -674,6 +675,7 @@ mod types {
|
|||
/*! there is no syntax for this */
|
||||
}
|
||||
/// TyKind::MacCall
|
||||
#[expect(deprecated)]
|
||||
fn ty_mac_call() { let _: T; let _: T; let _: T; }
|
||||
/// TyKind::CVarArgs
|
||||
fn ty_c_var_args() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue