about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-10-03Rollup merge of #102613 - TaKO8Ki:fix-part-of-101739, r=compiler-errorsMatthias Krüger-0/+94
Fix ICE #101739 Fixes a part of #101739 This cannot cover the following case. It causes `too many args provided` error and obligation does not have references error. I want your advice to solve the following cases as well in this pull request or a follow-up. ```rust #![crate_type = "lib"] #![feature(transmutability)] #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { use std::mem::BikeshedIntrinsicFrom; pub fn is_transmutable< Src, Dst, Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, >() where Dst: BikeshedIntrinsicFrom< Src, Context, ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_VALIDITY, ASSUME_VISIBILITY, >, {} } fn via_const() { struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst; const FALSE: bool = false; assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>(); } ```
2022-10-03Rollup merge of #102597 - compiler-errors:issue-102571, r=davidtwcoMatthias Krüger-0/+38
Avoid ICE in printing RPITIT type Fixes #102571
2022-10-03check if const is ADT or notTakayuki Maeda-2/+59
2022-10-03add a ui test for #101739Takayuki Maeda-0/+37
2022-10-03Rollup merge of #102591 - JarvisCraft:fix-double-a-article, r=compiler-errorsMatthias Krüger-12/+12
Fix duplicate usage of `a` article. This fixes a typo first appearing in #94624 in which test-macro diagnostic uses "a" article twice. Since I searched the sources for " a a " sequences, I also fixed the same issue in a few files where I found it.
2022-10-03Add some more operator cases to `dump-debug-span-debug.rs`.Nicholas Nethercote-32/+102
2022-10-02Auto merge of #102305 - flba-eb:remove_exclude_list, r=Mark-Simulacrumbors-30/+8
Get rid of exclude-list for Windows-only tests Main purpose of this change is to get rid of a quite long (and growing) list of excluded targets, while this test should only be useful on Windows (as far as I understand it). The `// only-windows` header seams to implement exactly what we need here. I don't know why there are some whitespace changes, but `x.py fmt` and `.git/hooks/pre-push` are happy.
2022-10-02Avoid ICE in printing RPITIT typeMichael Goulet-0/+38
2022-10-02Make it a lint for all opaque typesMichael Goulet-0/+108
2022-10-02Don't ICE when trying to copy unsized value in const propMichael Goulet-0/+24
2022-10-02Fix duplicate usage of `a` article.Petr Portnov-12/+12
This fixes a typo first appearing in #94624 in which test-macro diagnostic uses "a" article twice. Since I searched sources for " a a " sequences, I also fixed the same issue in a few source files where I found it. Signed-off-by: Petr Portnov <gh@progrm-jarvis.ru>
2022-10-02Rollup merge of #102566 - compiler-errors:test-102498, r=Mark-SimulacrumDylan DPC-0/+39
Add a known-bug test for #102498 Self-explanatory
2022-10-02Rollup merge of #100451 - hovinen:no-panic-on-result-err-in-test, ↵Dylan DPC-1/+1
r=Mark-Simulacrum Do not panic when a test function returns Result::Err. Rust's test library allows test functions to return a `Result`, so that the test is deemed to have failed if the function returns a `Result::Err` variant. Currently, this works by having `Result` implement the `Termination` trait and asserting in assert_test_result that `Termination::report()` indicates successful completion. This turns a `Result::Err` into a panic, which is caught and unwound in the test library. This approach is problematic in certain environments where one wishes to save on both binary size and compute resources when running tests by: * Compiling all code with `--panic=abort` to avoid having to generate unwinding tables, and * Running most tests in-process to avoid the overhead of spawning new processes. This change removes the intermediate panic step and passes a `Result::Err` directly through to the test runner. To do this, it modifies `assert_test_result` to return a `Result<(), String>` where the `Err` variant holds what was previously the panic message. It changes the types in the `TestFn` enum to return `Result<(), String>`. This tries to minimise the changes to benchmark tests, so it calls `unwrap()` on the `Result` returned by `assert_test_result`, effectively keeping the same behaviour as before. Some questions for reviewers: * Does the change to the return types in the enum `TestFn` constitute a breaking change for the library API? Namely, the enum definition is public but the test library indicates that "Currently, not much of this is meant for users" and most of the library API appears to be marked unstable. * Is there a way to test this change, i.e., to test that no panic occurs if a test returns `Result::Err`? * Is there a shorter, more idiomatic way to fold `Result<Result<T,E>,E>` into a `Result<T,E>` than the `fold_err` function I added?
2022-10-02fix #102320, suggest unwrap_or_else when a closure is passed to unwrap_or ↵yukang-0/+39
instead of suggesting calling it
2022-10-02Delay evaluating lint primary message until after it would be suppressedMichael Goulet-0/+19
2022-10-02Add a known-bug test for #102498Michael Goulet-0/+39
2022-10-01Auto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obkbors-8/+8
Compute lint levels by definition Second attempt to https://github.com/rust-lang/rust/pull/101620. I think that I have removed the perf regression.
2022-10-01Auto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-sebors-14/+108
Fix `format_args` capture for macro expanded format strings Since #100996 `format_args` capture for macro expanded strings aren't prevented when the span of the expansion points to a string literal, e.g. ```rust // not a terribly realistic example, but also happens for proc_macros that set // the span of the output to an input str literal, such as indoc macro_rules! x { ($e:expr) => { $e } } fn main() { let a = 1; println!(x!("{a}")); } ``` The tests didn't catch it as the span of `concat!()` points to the macro invocation r? `@m-ou-se`
2022-10-01Compute `lint_levels` by definitionDeadbeef-8/+8
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-1194/+1194
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01Recover wrong cased keywords starting functionsMaybe Waffle-3/+129
2022-10-01recover wrong-cased `use`s (`Use`, `USE`, etc)Maybe Waffle-0/+28
2022-10-01bless ui testsMaybe Waffle-1194/+1194
2022-09-30Rollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillotMatthias Krüger-0/+50
Generate synthetic region from `impl` even in closure body within an associated fn Fixes #102209
2022-09-30Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillotMatthias Krüger-8/+8
create def ids for impl traits during ast lowering r? `@cjgillot`
2022-09-30Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholkMatthias Krüger-0/+34
Fix ICE in const_trait check code This fixes #102156.
2022-09-30create def ids for impl traits during ast loweringSantiago Pastorino-8/+8
2022-09-30Rollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqdMatthias Krüger-1/+0
Reinstate `hir-stats.rs` test for stage 1. It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2. r? ```@lqd```
2022-09-30Rollup merge of #102421 - lyming2007:issue-101866, r=lcnrMatthias Krüger-0/+33
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-30blessBoxy-2/+2
2022-09-30make `compare_const_impl` a query and use it in `instance.rs`Boxy-0/+40
2022-09-30Fix format_args capture for macro expanded format stringsAlex Macleod-14/+108
2022-09-30bless testsb-naber-7/+27
2022-09-30use build-pass for the testX-1/+1
2022-09-30Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, ↵Matthias Krüger-5/+27
r=fee1-dead Improve errors for incomplete functions in struct definitions Given the following code: ```rust fn main() {} struct Foo { fn } ``` [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345) The current output is: ``` Compiling playground v0.0.1 (/playground) error: functions are not allowed in struct definitions --> src/main.rs:4:5 | 4 | fn | ^^ | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information error: could not compile `playground` due to previous error ``` In this case, rustc should suggest escaping `fn` to use it as an identifier.
2022-09-30Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Kibors-0/+20
Serialize return-position `impl Trait` in trait hidden values in foreign libraries Fixes #101630
2022-09-30Reinstate `hir-stats.rs` test for stage 1.Nicholas Nethercote-1/+0
It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2.
2022-09-29Auto merge of #101887 - nnethercote:shrink-Res, r=spastorinobors-46/+46
Shrink `hir::def::Res` r? `@spastorino`
2022-09-29Generate synthetic impl region even in closure body in associated fnMichael Goulet-0/+50
2022-09-29remove the unused :: between trait and type to give user correct diagnostic ↵Yiming Lei-0/+33
information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-29Check generic argument compatibility when projecting assoc tyMichael Goulet-0/+28
2022-09-29Rollup merge of #102214 - cassaundra:fix-format-args-span, r=cjgillotMichael Howell-0/+64
Fix span of byte-escaped left format args brace Fix #102057 (see issue for example). Previously, the use of escaped left braces (`\x7B`) in format args resulted in an incorrectly offset span. This patch fixes that by considering any escaped characters within the string instead of using a constant offset.
2022-09-29Rollup merge of #102336 - compiler-errors:issue-102333, r=jackh726Dylan DPC-0/+15
Fix associated type bindings with anon const in GAT position The first commit formats `type_of.rs`, which is really hard to maintain since it uses a bunch of features like `let`-chains and `if let` match arm bindings. Best if you just review the second two diffs. Fixes #102333
2022-09-29Stabilize the `instruction_set` featureYuki Okushi-45/+6
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-09-29Auto merge of #102328 - cuviper:ibm-stack-probes, r=nagisabors-8/+23
Enable inline stack probes on PowerPC and SystemZ The LLVM PowerPC and SystemZ targets have both supported `"probe-stack"="inline-asm"` for longer than our current minimum LLVM 13 requirement, so we can turn this on for all `powerpc`, `powerpc64`, `powerpc64le`, and `s390x` targets in Rust. These are all tier-2 or lower, so CI does not run their tests, but I have confirmed that their `linux-gnu` variants do pass on RHEL. cc #43241
2022-09-29Rollup merge of #102399 - b-naber:binder-print-ice, r=lcnrYuki Okushi-0/+34
Account for use of index-based lifetime names in print of binder Fixes https://github.com/rust-lang/rust/issues/102374 r? ```@lcnr``` cc ```@steffahn```
2022-09-29Rollup merge of #102393 - Rageking8:add-regression-test-for-issue-94923, ↵Yuki Okushi-0/+49
r=JohnTitor Add regression test for issue 94923 Fixes #94923
2022-09-29Rollup merge of #102351 - Rageking8:improve-E0585, r=wesleywiserYuki Okushi-19/+19
Improve E0585 help
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-46/+46
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-28Fix missing explanation of where borrowed reference is used when the borrow ↵Yan Chen-8/+18
occurs in loop iteration