summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2024-04-29Don't trigger `unused_qualifications` on global paths许杰友 Jieyou Xu (Joe)-25/+23
2024-04-22Stop using HirId for fn-like parentsMichael Goulet-0/+63
(cherry picked from commit 68d7c837fc377ac4145d931171fa2b1d1bd1670f)
2024-04-18Silence unused_imports lint for redundant importsMichael Goulet-238/+36
(cherry picked from commit 0db2a4010a5a7a57372e9135d327da8c7d92c8ab)
2024-04-11add non-regression test for issue 123275Rémy Rakic-0/+244
(cherry picked from commit 54f8db84329116889fce5d58292b5cc6b83642e6)
2024-04-11Check def id before calling match_projection_projectionsMichael Goulet-0/+38
(cherry picked from commit 43dae6934153693be62902fcefed0f97b4ca892f)
2024-04-11Only inspect user-written predicates for privacy concernsOli Scherer-11/+6
(cherry picked from commit 83bd12c70fd34dece71bcc632ee3df64036ca1d8)
2024-04-11Add regression testOli Scherer-0/+43
(cherry picked from commit 769ab55558488d1ff786fa13e8ba1fb071a9791b)
2024-04-11fix attribute validation on associated items in traitsgvozdvmozgu-0/+15
(cherry picked from commit 8b576d553678688ece127b6f6a25b611e8726c05)
2024-04-09Use new-style directives in ui testChris Denton-3/+3
2024-04-09Disallow or quote all specials in bat argsChris Denton-0/+93
2024-04-04Make sure to insert Sized bound first into clauses listMichael Goulet-0/+30
(cherry picked from commit f2fd2d8c7080f7a7d770b3e3d27e525250c182dc)
2024-04-04Don't inherit codegen attrs from parent staticMichael Goulet-0/+11
(cherry picked from commit 4ff8a9bd6b64e32703603cf8bc8cb5cb221d4889)
2024-04-04Fix f16 and f128 feature gates in editions other than 2015Trevor Gross-20/+20
Fixes https://github.com/rust-lang/rust/issues/123282 Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> (cherry picked from commit 5afe072ead1154f9817ee610e3e60345507c7625)
2024-04-04Update f16 and f128 tests to run on both 2015 and 2018 editionsTrevor Gross-10/+146
Reproduce the bug from <https://github.com/rust-lang/rust/issues/123282> that indicates this feature gate hits edition-dependent resolution paths. Resolution changed in edition 2018, so test that as well. (cherry picked from commit 9a7b1762279eaa95d0289760d3b859fbbc9221f1)
2024-03-28Make `#[diagnostic::on_unimplemented]` format string parsing more robustGeorg Semmler-0/+238
This commit fixes several issues with the format string parsing of the `#[diagnostic::on_unimplemented]` attribute that were pointed out by @ehuss. In detail it fixes: * Appearing format specifiers (display, etc). For these we generate a warning that the specifier is unsupported. Otherwise we ignore them * Positional arguments. For these we generate a warning that positional arguments are unsupported in that location and replace them with the format string equivalent (so `{}` or `{n}` where n is the index of the positional argument) * Broken format strings with enclosed }. For these we generate a warning about the broken format string and set the emitted message literally to the provided unformatted string * Unknown format specifiers. For these we generate an additional warning about the unknown specifier. Otherwise we emit the literal string as message. This essentially makes those strings behave like `format!` with the minor difference that we do not generate hard errors but only warnings. After that we continue trying to do something unsuprising (mostly either ignoring the broken parts or falling back to just giving back the literal string as provided). Fix #122391 (cherry picked from commit 5568c569c03c8c22ce81185b9e49efcaa6866050)
2024-03-28add non-regression test for issue 122674Rémy Rakic-0/+22
(cherry picked from commit f3e9dfaed6c4d44fc0a5182221c31e5b0ff038fd)
2024-03-18Explicitly pass RUSTC_BOOTSTRAP to running wasmtimeMark Rousskov-0/+1
This ensures that tests are permitted to use nightly features, which is currently required for them to run at all. Also ignore a test that relies on running with RUSTC_BOOTSTRAP *not* set.
2024-03-16Auto merge of #122371 - oli-obk:visit_nested_body, r=tmiaskobors-0/+25
Stop walking the bodies of statics for reachability, and evaluate them instead cc `@saethlin` `@RalfJung` cc #119214 This reuses the `DefIdVisitor` from `rustc_privacy`, because they basically try to do the same thing. This PR's changes can probably be extended to constants, too, but let's tackle that separately, it's likely more involved.
2024-03-16Auto merge of #121926 - tgross35:f16-f128-step3-feature-gate, ↵bors-104/+239
r=compiler-errors,petrochenkov `f16` and `f128` step 3: compiler support & feature gate Continuation of https://github.com/rust-lang/rust/pull/121841, another portion of https://github.com/rust-lang/rust/pull/114607 This PR exposes the new types to the world and adds a feature gate. Marking this as a draft because I need some feedback on where I did the feature gate check. It also does not yet catch type via suffixed literals (so the feature gate test will fail, probably some others too because I haven't belssed). If there is a better place to check all types after resolution, I can do that. If not, I figure maybe I can add a second gate location in AST when it checks numeric suffixes. Unfortunately I still don't think there is much testing to be done for correctness (codegen tests or parsed value checks) until we have basic library support. I think that will be the next step. Tracking issue: https://github.com/rust-lang/rust/issues/116909 r? `@compiler-errors` cc `@Nilstrieb` `@rustbot` label +F-f16_and_f128
2024-03-15Auto merge of #122571 - matthiaskrgr:rollup-36wwovk, r=matthiaskrgrbors-216/+343
Rollup of 6 pull requests Successful merges: - #122254 (Detect calls to .clone() on T: !Clone types on borrowck errors) - #122495 (Visually mark 👻hidden👻 items with document-hidden-items) - #122543 (Add `#![rustc_never_type_mode = "..."]` crate-level attribute to allow experimenting) - #122560 (Safe Transmute: Use 'not yet supported', not 'unspecified' in errors) - #122562 (Mention labelled blocks in `break` docs) - #122563 (CI: cache PR CI Docker builds) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-15Rollup merge of #122560 - jswrenn:not-yet-supported, r=compiler-errorsMatthias Krüger-179/+179
Safe Transmute: Use 'not yet supported', not 'unspecified' in errors We can (and will) support analyzing the transmutability of types whose layouts aren't completely specified by its repr. This change ensures that the error messages remain sensible after this support lands. r? ``@compiler-errors``
2024-03-15Rollup merge of #122254 - estebank:issue-48677, r=oli-obkMatthias Krüger-37/+164
Detect calls to .clone() on T: !Clone types on borrowck errors When encountering a lifetime error on a type that *holds* a type that doesn't implement `Clone`, explore the item's body for potential calls to `.clone()` that are only cloning the reference `&T` instead of `T` because `T: !Clone`. If we find this, suggest `T: Clone`. ``` error[E0502]: cannot borrow `*list` as mutable because it is also borrowed as immutable --> $DIR/clone-on-ref.rs:7:5 | LL | for v in list.iter() { | ---- immutable borrow occurs here LL | cloned_items.push(v.clone()) | ------- this call doesn't do anything, the result is still `&T` because `T` doesn't implement `Clone` LL | } LL | list.push(T::default()); | ^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | LL | drop(cloned_items); | ------------ immutable borrow later used here | help: consider further restricting this bound | LL | fn foo<T: Default + Clone>(list: &mut Vec<T>) { | +++++++ ``` ``` error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/clone-on-ref.rs:23:10 | LL | fn qux(x: A) { | - binding `x` declared here LL | let a = &x; | -- borrow of `x` occurs here LL | let b = a.clone(); | ------- this call doesn't do anything, the result is still `&A` because `A` doesn't implement `Clone` LL | drop(x); | ^ move out of `x` occurs here LL | LL | println!("{b:?}"); | ----- borrow later used here | help: consider annotating `A` with `#[derive(Clone)]` | LL + #[derive(Clone)] LL | struct A; | ``` Fix #48677.
2024-03-15Auto merge of #122341 - compiler-errors:alias-wfness, r=lcnrbors-6/+60
Consolidate WF for aliases Make RPITs/TAITs/weak (type) aliases/projections all enforce: 1. their nominal predicates 2. their args are WF This possibly does extra work, but is also nice for consistency sake. r? lcnr
2024-03-15Safe Transmute: lowercase diagnosticsJack Wrenn-153/+153
2024-03-15Safe Transmute: Use 'not yet supported', not 'unspecified' in errorsJack Wrenn-26/+26
We can (and will) support analyzing the transmutability of types whose layouts aren't completely specified by its repr. This change ensures that the error messages remain sensible after this support lands.
2024-03-15Rollup merge of #122523 - compiler-errors:ensure-associated-types, r=oli-obkMatthias Krüger-0/+22
Ensure RPITITs are created before def-id freezing From the test: ```rust // `ty::Error` in a trait ref will silence any missing item errors, but will also // prevent the `associated_items` query from being called before def ids are frozen. ``` Essentially, the code that checks that `impl`s have all their items (`check_impl_items_against_trait`) is also (implicitly) responsible for fetching the `associated_items` query before, but since we early return here: https://github.com/rust-lang/rust/blob/c2901f543577af99b9cb708f5c0d28525eb7f08f/compiler/rustc_hir_analysis/src/check/check.rs#L732-L737 ...that means that this never happens for trait refs that reference errors. Fixes #122518 r? oli-obk
2024-03-15Rollup merge of #122515 - jieyouxu:ice-self-ty-mismatch, r=compiler-errorsMatthias Krüger-0/+62
Pass the correct DefId when suggesting writing the aliased Self type out Fixes #122467.
2024-03-15Rollup merge of #122471 - RalfJung:const-eval-span, r=oli-obkMatthias Krüger-2/+181
preserve span when evaluating mir::ConstOperand This lets us show to the user where they were using the faulty const (which can be quite relevant when generics are involved). I wonder if we should change "erroneous constant encountered" to something like "the above error was encountered while evaluating this constant" or so, to make this more similar to what the collector emits when showing a "backtrace" of where things get monomorphized? It seems a bit strange to rely on the order of emitted diagnostics for that but it seems the collector already [does that](https://github.com/rust-lang/rust/blob/da8a8c9223722e17cc0173ce9490076b4a6d263d/compiler/rustc_monomorphize/src/collector.rs#L472-L475).
2024-03-15Rollup merge of #122174 - notriddle:master, r=TaKO8KiMatthias Krüger-0/+38
diagnostics: suggest `Clone` bounds when noop `clone()` Fixes #121524
2024-03-15Auto merge of #122517 - petrochenkov:bodihash, r=oli-obkbors-0/+11
Fill in HIR hash for associated opaque types Fixes https://github.com/rust-lang/rust/issues/122508
2024-03-14Ensure RPITITs are created before def-id freezingMichael Goulet-0/+22
2024-03-15Auto merge of #122511 - matthiaskrgr:rollup-swzilin, r=matthiaskrgrbors-23/+186
Rollup of 10 pull requests Successful merges: - #117118 ([AIX] Remove AixLinker's debuginfo() implementation) - #121650 (change std::process to drop supplementary groups based on CAP_SETGID) - #121764 (Make incremental sessions identity no longer depend on the crate names provided by source code) - #122212 (Copy byval argument to alloca if alignment is insufficient) - #122322 (coverage: Initial support for branch coverage instrumentation) - #122373 (Fix the conflict problem between the diagnostics fixes of lint `unnecessary_qualification` and `unused_imports`) - #122479 (Implement `Duration::as_millis_{f64,f32}`) - #122487 (Rename `StmtKind::Local` variant into `StmtKind::Let`) - #122498 (Update version of cc crate) - #122503 (Make `SubdiagMessageOp` well-formed) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-14preserve span when evaluating mir::ConstOperandRalf Jung-2/+181
2024-03-14Fill in HIR hash for associated opaque typesVadim Petrochenkov-0/+11
2024-03-14Pass the correct DefId when suggesting writing the aliased Self type out许杰友 Jieyou Xu (Joe)-0/+62
2024-03-14Rollup merge of #122487 - GuillaumeGomez:rename-stmtkind-local, r=oli-obkMatthias Krüger-3/+3
Rename `StmtKind::Local` variant into `StmtKind::Let` It comes from this [discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F). Starting point was: > I often end up looking at [ExprKind::Let](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.ExprKind.html#variant.Let) instead of Local because of the name. I think renaming it (both the `ExprKind` variant and the Let struct) to `LetPattern` or LetPat could improve the situation as I'm not sure I'm not the only one encountering this issue. And then it evolved into: > It's already `Expr::Let` instead of `StmtKind::Local`. Counterproposal: rename `StmtKind::Local` to `StmtKind::Let`. The goal here is to clear this confusion. r? `@oli-obk`
2024-03-14Rollup merge of #122373 - surechen:fix_121331, r=petrochenkovMatthias Krüger-20/+183
Fix the conflict problem between the diagnostics fixes of lint `unnecessary_qualification` and `unused_imports` fixes #121331 For an `item` that triggers lint unnecessary_qualification, if the `use item` which imports this item is also trigger unused import, fixing the two lints at the same time may lead to the problem that the `item` cannot be found. This PR will avoid reporting lint unnecessary_qualification when conflict occurs. r? ``@petrochenkov``
2024-03-14Auto merge of #119849 - lcnr:eagerly-instantiate-binders, r=compiler-errorsbors-373/+463
more eagerly instantiate binders The old solver sometimes incorrectly used `sub`, change it to explicitly instantiate binders and use `eq` instead. While doing so I also moved the instantiation before the normalize calls. This caused some observable changes, will explain these inline. This PR therefore requires a crater run and an FCP. r? types
2024-03-14Add UI tests related to feature-gated primitivesTrevor Gross-0/+72
Add a test that `f16` and `f128` are usable with the feature gate enabled, as well as a test that user types with the same name as primitives are not improperly gated.
2024-03-14Remove unneeded `f16` and `f128` parser testsTrevor Gross-104/+0
Superceded by feature gate tests.
2024-03-14Add feature gates for `f16` and `f128`Trevor Gross-0/+167
Includes related tests and documentation pages. Michael Goulet: Don't issue feature error in resolver for f16/f128 unless finalize Co-authored-by: Michael Goulet <michael@errs.io>
2024-03-14add testslcnr-0/+128
2024-03-14rebaselcnr-5/+0
2024-03-14one must imagine tidy happylcnr-10/+10
2024-03-14eagerly instantiate binders to avoid relying on `sub`lcnr-373/+340
2024-03-14Consolidate WF for aliasesMichael Goulet-6/+60
2024-03-14Rollup merge of #122482 - weiznich:fix/122446, r=compiler-errorsMatthias Krüger-0/+21
Ungate the `UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES` lint This was missed during stablisation of the `#[diagnostic]` attribute namespace. Fixes #122446
2024-03-14Rollup merge of #122368 - pavedroad:master, r=oli-obkMatthias Krüger-1/+1
chore: remove repetitive words
2024-03-14Rollup merge of #122287 - RalfJung:simd-static-assert, r=pnkfelixMatthias Krüger-0/+41
add test ensuring simd codegen checks don't run when a static assertion failed stdarch relies on this to ensure that SIMD indices are in bounds. I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
2024-03-14Test and implement reachability for trait objects and generic parameters of ↵Oli Scherer-0/+25
functions