diff options
| author | bors <bors@rust-lang.org> | 2023-11-28 02:05:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-28 02:05:26 +0000 |
| commit | c2ec90854a0d3a3e1570cf7acfdd2c9e50aa3b2a (patch) | |
| tree | 5fc9b9c573cad226f388cefb957c03983923675d /tests | |
| parent | 49b3924bd4a34d3cf9c37b74120fba78d9712ab8 (diff) | |
| parent | 2aca7247a7c63d43510ac136c5e26c8ddfd40180 (diff) | |
| download | rust-c2ec90854a0d3a3e1570cf7acfdd2c9e50aa3b2a.tar.gz rust-c2ec90854a0d3a3e1570cf7acfdd2c9e50aa3b2a.zip | |
Auto merge of #118395 - compiler-errors:rollup-c8yqlmw, r=compiler-errors
Rollup of 9 pull requests Successful merges: - #111133 (Detect Python-like slicing and suggest how to fix) - #114708 (Allow setting `rla` labels via `rustbot`) - #117526 (Account for `!` arm in tail `match` expr) - #118172 (Add `pretty_terminator` to pretty stable-mir) - #118202 (Added linker_arg(s) Linker trait methods for link-arg to be prefixed "-Wl," for cc-like linker args and not verbatim) - #118374 (QueryContext: rename try_collect_active_jobs -> collect_active_jobs, change return type from Option<QueryMap> to QueryMap) - #118381 (rustc_span: Use correct edit distance start length for suggestions) - #118382 (Address unused tuple struct fields in the compiler) - #118384 (Address unused tuple struct fields in rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run-make/pass-linker-flags-flavor/Makefile | 8 | ||||
| -rw-r--r-- | tests/run-make/pass-linker-flags-flavor/rs.rs | 1 | ||||
| -rw-r--r-- | tests/ui/match/match-tail-expr-never-type-error.rs | 16 | ||||
| -rw-r--r-- | tests/ui/match/match-tail-expr-never-type-error.stderr | 21 | ||||
| -rw-r--r-- | tests/ui/suggestions/non_ascii_ident.rs | 4 | ||||
| -rw-r--r-- | tests/ui/suggestions/non_ascii_ident.stderr | 9 | ||||
| -rw-r--r-- | tests/ui/suggestions/range-index-instead-of-colon.rs | 7 | ||||
| -rw-r--r-- | tests/ui/suggestions/range-index-instead-of-colon.stderr | 13 |
8 files changed, 79 insertions, 0 deletions
diff --git a/tests/run-make/pass-linker-flags-flavor/Makefile b/tests/run-make/pass-linker-flags-flavor/Makefile new file mode 100644 index 00000000000..bd3d3ed882f --- /dev/null +++ b/tests/run-make/pass-linker-flags-flavor/Makefile @@ -0,0 +1,8 @@ +# only-linux + +include ../tools.mk + +all: + $(RUSTC) rs.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3' + $(RUSTC) rs.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg:+verbatim=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3' + $(RUSTC) rs.rs -Z unstable-options -C linker-flavor=ld -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"' diff --git a/tests/run-make/pass-linker-flags-flavor/rs.rs b/tests/run-make/pass-linker-flags-flavor/rs.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/pass-linker-flags-flavor/rs.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/ui/match/match-tail-expr-never-type-error.rs b/tests/ui/match/match-tail-expr-never-type-error.rs new file mode 100644 index 00000000000..786ed3fa904 --- /dev/null +++ b/tests/ui/match/match-tail-expr-never-type-error.rs @@ -0,0 +1,16 @@ +fn never() -> ! { + loop {} +} + +fn bar(a: bool) { + match a { + true => 1, + false => { + never() //~ ERROR `match` arms have incompatible types + } + } +} +fn main() { + bar(true); + bar(false); +} diff --git a/tests/ui/match/match-tail-expr-never-type-error.stderr b/tests/ui/match/match-tail-expr-never-type-error.stderr new file mode 100644 index 00000000000..226d33daeb2 --- /dev/null +++ b/tests/ui/match/match-tail-expr-never-type-error.stderr @@ -0,0 +1,21 @@ +error[E0308]: `match` arms have incompatible types + --> $DIR/match-tail-expr-never-type-error.rs:9:13 + | +LL | fn bar(a: bool) { + | - help: try adding a return type: `-> i32` +LL | / match a { +LL | | true => 1, + | | - this is found to be of type `{integer}` +LL | | false => { +LL | | never() + | | ^^^^^^^ + | | | + | | expected integer, found `()` + | | this expression is of type `!`, but it is coerced to `()` due to its surrounding expression +LL | | } +LL | | } + | |_____- `match` arms have incompatible types + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/non_ascii_ident.rs b/tests/ui/suggestions/non_ascii_ident.rs new file mode 100644 index 00000000000..679ac4bcb6e --- /dev/null +++ b/tests/ui/suggestions/non_ascii_ident.rs @@ -0,0 +1,4 @@ +fn main() { + // There shall be no suggestions here. In particular not `Ok`. + let _ = 读文; //~ ERROR cannot find value `读文` in this scope +} diff --git a/tests/ui/suggestions/non_ascii_ident.stderr b/tests/ui/suggestions/non_ascii_ident.stderr new file mode 100644 index 00000000000..79fca3e1f61 --- /dev/null +++ b/tests/ui/suggestions/non_ascii_ident.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `读文` in this scope + --> $DIR/non_ascii_ident.rs:3:13 + | +LL | let _ = 读文; + | ^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/suggestions/range-index-instead-of-colon.rs b/tests/ui/suggestions/range-index-instead-of-colon.rs new file mode 100644 index 00000000000..3267527ecf2 --- /dev/null +++ b/tests/ui/suggestions/range-index-instead-of-colon.rs @@ -0,0 +1,7 @@ +// edition:2021 + +fn main() { + &[1, 2, 3][1:2]; + //~^ ERROR: expected one of + //~| HELP: you might have meant a range expression +} diff --git a/tests/ui/suggestions/range-index-instead-of-colon.stderr b/tests/ui/suggestions/range-index-instead-of-colon.stderr new file mode 100644 index 00000000000..df29356cc16 --- /dev/null +++ b/tests/ui/suggestions/range-index-instead-of-colon.stderr @@ -0,0 +1,13 @@ +error: expected one of `.`, `?`, `]`, or an operator, found `:` + --> $DIR/range-index-instead-of-colon.rs:4:17 + | +LL | &[1, 2, 3][1:2]; + | ^ expected one of `.`, `?`, `]`, or an operator + | +help: you might have meant a range expression + | +LL | &[1, 2, 3][1..2]; + | ~~ + +error: aborting due to 1 previous error + |
