summary refs log tree commit diff
path: root/tests/ui/rfcs
AgeCommit message (Collapse)AuthorLines
2024-10-10Rollup merge of #131475 - fmease:compiler-mv-obj-safe-dyn-compat-2, r=jieyouxuMatthias Krüger-5/+5
Compiler & its UI tests: Rename remaining occurrences of "object safe" to "dyn compatible" Follow-up to #130826. Part of #130852. 1. 1st commit: Fix stupid oversights. Should've been part of #130826. 2. 2nd commit: Rename the unstable feature `object_safe_for_dispatch` to `dyn_compatible_for_dispatch`. Might not be worth the churn, you decide. 3. 3rd commit: Apply the renaming to all UI tests (contents and paths).
2024-10-10UI tests: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-2/+2
2024-10-10Rename feature object_safe_for_dispatch to dyn_compatible_for_dispatchLeón Orell Valerian Liehr-3/+3
2024-10-06more `asm!` -> `naked_asm!` in testsFolkert de Vries-3/+3
2024-10-04Bless ui tests.Camille GILLOT-28/+28
2024-10-02Improve const traits diagnostics for new desugaringDeadbeef-137/+114
2024-09-30Rollup merge of #131038 - onkoe:fix/adt_const_params_leak_118179, ↵Matthias Krüger-3/+3
r=compiler-errors Fix `adt_const_params` leaking `{type error}` in error msg Fixes the confusing diagnostic described in #118179. (users would see `{type error}` in some situations, which is pretty weird) `adt_const_params` tracking issue: #95174
2024-09-29fix(hir_analysis/wfcheck): don't leak {type error}Barrett Ray-3/+3
avoid `{type error}` being leaked in user-facing messages, particularly when using the `adt_const_params` feature
2024-09-27properly elaborate effects implied bounds for super traitsDeadbeef-53/+21
2024-09-24Ban combination of GCE and new solverMichael Goulet-8/+23
2024-09-21Don't elaborate effects predicates into bounds list unless we're actually ↵Michael Goulet-14/+1
collecting implied bounds, not super bounds
2024-09-18Never patterns constitute a read for unsafetyMichael Goulet-0/+36
2024-09-15stabilize const_mut_refsRalf Jung-37/+34
2024-09-13Add a machine-applicable suggestion to "unreachable pattern"Nadrieril-5/+20
2024-09-11Revert warning empty patterns as unreachableNadrieril-31/+26
2024-09-02Non-exhaustive structs may be emptyNadrieril-196/+134
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-6/+6
closures
2024-08-24remove invalid `TyCompat` relation for effectsDeadbeef-2/+13
2024-08-21Rollup merge of #129281 - Nadrieril:tweak-unreachable-lint-wording, r=estebankMatthias Krüger-28/+28
Tweak unreachable lint wording Some tweaks to the notes added in https://github.com/rust-lang/rust/pull/128034. r? `@estebank`
2024-08-20Move the "matches no value" note to be a span labelNadrieril-24/+12
2024-08-19Add a note with a link to explain empty typesNadrieril-0/+12
2024-08-19Reword the "unreachable pattern" explanationsNadrieril-16/+16
2024-08-16Simplify cleaning foreign fns in rustdocMichael Goulet-2/+2
2024-08-10Auto merge of #128927 - GuillaumeGomez:rollup-ei2lr0f, r=GuillaumeGomezbors-22/+22
Rollup of 8 pull requests Successful merges: - #128273 (Improve `Ord` violation help) - #128807 (run-make: explaing why fmt-write-bloat is ignore-windows) - #128903 (rustdoc-json-types `Discriminant`: fix typo) - #128905 (gitignore: Add Zed and Helix editors) - #128908 (diagnostics: do not warn when a lifetime bound infers itself) - #128909 (Fix dump-ice-to-disk for RUSTC_ICE=0 users) - #128910 (Differentiate between methods and associated functions in diagnostics) - #128923 ([rustdoc] Stop showing impl items for negative impls) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-10Update testsNadrieril-209/+159
2024-08-10Differentiate between methods and associated functionsEsteban Küber-22/+22
Accurately refer to assoc fn without receiver as assoc fn instead of methods. Add `AssocItem::descr` method to centralize where we call methods and associated functions.
2024-08-07Hide implicit target features from diagnostics when possibleCaleb Zulawski-14/+12
2024-08-07Add test to ensure implied target features work with asm, and fix failing testsCaleb Zulawski-42/+25
2024-07-28Rollup merge of #127853 - folkertdev:naked-function-error-messages, r=bjorn3Matthias Krüger-6/+12
`#[naked]`: report incompatible attributes tracking issue: https://github.com/rust-lang/rust/issues/90957 this is a re-implementation of https://github.com/rust-lang/rust/pull/93809 by ``@bstrie`` which was closed 2 years ago due to inactivity. This PR takes some of the final comments into account, specifically providing a little more context in error messages, and using an allow list to determine which attributes are compatible with `#[naked]`. Notable attributes that are incompatible with `#[naked]` are: * `#[inline]` * `#[track_caller]` * ~~`#[target_feature]`~~ (this is now allowed, see PR discussion) * `#[test]`, `#[ignore]`, `#[should_panic]` These attributes just directly conflict with what `#[naked]` should do. Naked functions are still important for systems programming, embedded, and operating systems, so I'd like to move them forward.
2024-07-27switch to an allowlist approachFolkert-4/+4
- merge error codes - use attribute name that is incompatible in error message - add test for conditional incompatible attribute - add `linkage` to the allowlist
2024-07-26Auto merge of #128034 - Nadrieril:explain-unreachable, r=compiler-errorsbors-2/+27
exhaustiveness: Explain why a given pattern is considered unreachable This PR tells the user why a given pattern is considered unreachable. I reused the intersection information we were already computing; even though it's incomplete I convinced myself that it is sufficient to always get a set of patterns that cover the unreachable one. I'm not a fan of the diagnostic messages I came up with, I'm open to suggestions. Fixes https://github.com/rust-lang/rust/issues/127870. This is also the other one of the two diagnostic improvements I wanted to do before https://github.com/rust-lang/rust/pull/122792. Note: the first commit is an unrelated drive-by tweak. r? `@compiler-errors`
2024-07-25Rollup merge of #128171 - compiler-errors:arg-compat, r=oli-obkMatthias Krüger-0/+53
Make sure that args are compatible in `resolve_associated_item` Implements a similar check to the one that we have in projection for GATs (#102488, #123240), where we check that the args of an impl item are compatible before returning it. This is done in `resolve_assoc_item`, which is backing `Instance::resolve`, so this is conceptually generalizing the check from GATs to methods/assoc consts. This is important to make sure that the inliner will only visit and substitute MIR bodies that are compatible w/ their trait definitions. This shouldn't happen in codegen, but there are a few ways to get the inliner to be invoked (via calls to `optimized_mir`) before codegen, namely polymorphization and CTFE. Fixes #121957 Fixes #120792 Fixes #120793 Fixes #121063
2024-07-24Make sure that args are compatible in resolve_associated_itemMichael Goulet-0/+53
2024-07-25Rollup merge of #128111 - estebank:no-question, r=fmeaseMatthias Krüger-4/+4
Do not use question as label We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
2024-07-25Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obkMatthias Krüger-1/+1
Replace ASCII control chars with Unicode Control Pictures Replace ASCII control chars like `CR` with Unicode Control Pictures like `␍`: ``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ``` Centralize the checking of unicode char width for the purposes of CLI display in one place. Account for the new replacements. Remove unneeded tracking of "zero-width" unicode chars, as we calculate these in the `SourceMap` as needed now.
2024-07-25Rollup merge of #127054 - compiler-errors:bound-ordering, r=fmeaseMatthias Krüger-18/+26
Reorder trait bound modifiers *after* `for<...>` binder in trait bounds This PR suggests changing the grammar of trait bounds from: ``` [CONSTNESS] [ASYNCNESS] [?] [BINDER] [TRAIT_PATH] const async ? for<'a> Sized ``` to ``` ([BINDER] [CONSTNESS] [ASYNCNESS] | [?]) [TRAIT_PATH] ``` i.e., either ``` ? Sized ``` or ``` for<'a> const async Sized ``` (but not both) ### Why? I think it's strange that the binder applies "more tightly" than the `?` trait polarity. This becomes even weirder when considering that we (or at least, I) want to have `async` trait bounds expressed like: ``` where T: for<'a> async Fn(&'a ()) -> i32, ``` and not: ``` where T: async for<'a> Fn(&'a ()) -> i32, ``` ### Fallout No crates on crater use this syntax, presumably because it's literally useless. This will require modifying the reference grammar, though. ### Alternatives If this is not desirable, then we can alternatively keep parsing `for<'a>` after the `?` but deprecate it with either an FCW (or an immediate hard error), and begin parsing `for<'a>` *before* the `?`.
2024-07-24Fix ddltool-failed testEsteban Küber-1/+1
2024-07-24Do not use question as labelEsteban Küber-4/+4
We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might": ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ you might be missing crate `spam` | = help: consider adding `extern crate spam` to use the `spam` crate ```
2024-07-24Rollup merge of #122192 - oli-obk:type_of_opaque_for_const_checks, r=lcnrMatthias Krüger-35/+3
Do not try to reveal hidden types when trying to prove auto-traits in the defining scope fixes #99793 this avoids the cycle error by just causing a selection error, which is not fatal. We pessimistically assume that freeze does not hold, which is always a safe assumption.
2024-07-24Do not try to reveal hidden types when trying to prove Freeze in the ↵Oli Scherer-35/+3
defining scope
2024-07-24Explain why a given pattern is considered unreachableNadrieril-2/+27
2024-07-22Revert suggestion verbosity changeEsteban Küber-24/+12
2024-07-22Change suggestion message wordingEsteban Küber-4/+4
2024-07-22Use verbose suggestion for "wrong # of generics"Esteban Küber-12/+24
2024-07-19Auto merge of #125915 - camelid:const-arg-refactor, r=BoxyUwUbors-13/+4
Represent type-level consts with new-and-improved `hir::ConstArg` ### Summary This is a step toward `min_generic_const_exprs`. We now represent all const generic arguments using an enum that differentiates between const *paths* (temporarily just bare const params) and arbitrary anon consts that may perform computations. This will enable us to cleanly implement the `min_generic_const_args` plan of allowing the use of generics in paths used as const args, while disallowing their use in arbitrary anon consts. Here is a summary of the salient aspects of this change: - Add `current_def_id_parent` to `LoweringContext` This is needed to track anon const parents properly once we implement `ConstArgKind::Path` (which requires moving anon const def-creation outside of `DefCollector`). - Create `hir::ConstArgKind` enum with `Path` and `Anon` variants. Use it in the existing `hir::ConstArg` struct, replacing the previous `hir::AnonConst` field. - Use `ConstArg` for all instances of const args. Specifically, use it instead of `AnonConst` for assoc item constraints, array lengths, and const param defaults. - Some `ast::AnonConst`s now have their `DefId`s created in rustc_ast_lowering rather than `DefCollector`. This is because in some cases they will end up becoming a `ConstArgKind::Path` instead, which has no `DefId`. We have to solve this in a hacky way where we guess whether the `AnonConst` could end up as a path const since we can't know for sure until after name resolution (`N` could refer to a free const or a nullary struct). If it has no chance as being a const param, then we create a `DefId` in `DefCollector` -- otherwise we decide during ast_lowering. This will have to be updated once all path consts use `ConstArgKind::Path`. - We explicitly use `ConstArgHasType` for array lengths, rather than implicitly relying on anon const type feeding -- this is due to the addition of `ConstArgKind::Path`. - Some tests have their outputs changed, but the changes are for the most part minor (including removing duplicate or almost-duplicate errors). One test now ICEs, but it is for an incomplete, unstable feature and is now tracked at https://github.com/rust-lang/rust/issues/127009. ### Followup items post-merge - Use `ConstArgKind::Path` for all const paths, not just const params. - Fix (no github dont close this issue) #127009 - If a path in generic args doesn't resolve as a type, try to resolve as a const instead (do this in rustc_resolve). Then remove the special-casing from `rustc_ast_lowering`, so that all params will automatically be lowered as `ConstArgKind::Path`. - (?) Consider making `const_evaluatable_unchecked` a hard error, or at least trying it in crater r? `@BoxyUwU`
2024-07-18Replace ASCII control chars with Unicode Control PicturesEsteban Küber-0/+0
``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ```
2024-07-18const_to_pat: cleanup leftovers from when we had to deal with non-structural ↵Ralf Jung-39/+6
constants
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-13/+4
This is a very large commit since a lot needs to be changed in order to make the tests pass. The salient changes are: - `ConstArgKind` gets a new `Path` variant, and all const params are now represented using it. Non-param paths still use `ConstArgKind::Anon` to prevent this change from getting too large, but they will soon use the `Path` variant too. - `ConstArg` gets a distinct `hir_id` field and its own variant in `hir::Node`. This affected many parts of the compiler that expected the parent of an `AnonConst` to be the containing context (e.g., an array repeat expression). They have been changed to check the "grandparent" where necessary. - Some `ast::AnonConst`s now have their `DefId`s created in rustc_ast_lowering rather than `DefCollector`. This is because in some cases they will end up becoming a `ConstArgKind::Path` instead, which has no `DefId`. We have to solve this in a hacky way where we guess whether the `AnonConst` could end up as a path const since we can't know for sure until after name resolution (`N` could refer to a free const or a nullary struct). If it has no chance as being a const param, then we create a `DefId` in `DefCollector` -- otherwise we decide during ast_lowering. This will have to be updated once all path consts use `ConstArgKind::Path`. - We explicitly use `ConstArgHasType` for array lengths, rather than implicitly relying on anon const type feeding -- this is due to the addition of `ConstArgKind::Path`. - Some tests have their outputs changed, but the changes are for the most part minor (including removing duplicate or almost-duplicate errors). One test now ICEs, but it is for an incomplete, unstable feature and is now tracked at #127009.
2024-07-16improve error message when `#[naked]` is used with `#[track-caller] and ↵Folkert-6/+12
`#[target-feature]``
2024-07-16Rollup merge of #120990 - chenyukang:yukang-fix-120327-dbg, r=oli-obkTrevor Gross-0/+4
Suggest a borrow when using dbg Fixes #120327 r? ````@estebank````