about summary refs log tree commit diff
path: root/tests/ui/feature-gates
AgeCommit message (Collapse)AuthorLines
2023-12-13Tweak `short_ty_string` to reduce number of filesEsteban Küber-1/+1
When shortening types and writing them to disk, make `short_ty_string` capable of reusing the same file, instead of writing a file per shortened type.
2023-12-12Rollup merge of #118891 - compiler-errors:async-gen-blocks, r=eholkJubilee-6/+55
Actually parse async gen blocks correctly 1. I got the control flow in `parse_expr_bottom` messed up, and obviously forgot a test for `async gen`, so we weren't actually ever parsing it correctly. 2. I forgot to gate the span for `async gen {}`, so even if we did parse it, we wouldn't have correctly denied it in `cfg(FALSE)`. r? eholk
2023-12-12Actually parse async gen blocks correctlyMichael Goulet-6/+55
2023-12-12Don't gate the feature twiceNadrieril-50/+14
2023-12-12Correctly gate the parsing of match arms without bodyNadrieril-9/+170
2023-12-10Auto merge of #118368 - GuillaumeGomez:env-flag, r=Nilstriebbors-0/+5
Implement `--env` compiler flag (without `tracked_env` support) Part of https://github.com/rust-lang/rust/issues/80792. Implementation of https://github.com/rust-lang/compiler-team/issues/653. Not an implementation of https://github.com/rust-lang/rfcs/pull/2794. It adds the `--env` compiler flag option which allows to set environment values used by `env!` and `option_env!`. Important to note: When trying to retrieve an environment variable value, it will first look into the ones defined with `--env`, and if there isn't one, then only it will look into the environment variables. So if you use `--env PATH=a`, then `env!("PATH")` will return `"a"` and not the actual `PATH` value. As mentioned in the title, `tracked_env` support is not added here. I'll do it in a follow-up PR. r? rust-lang/compiler
2023-12-10Auto merge of #116952 - compiler-errors:lifetime_capture_rules_2024, r=TaKO8Kibors-0/+24
Implement 2024-edition lifetime capture rules RFC Implements rust-lang/rfcs#3498.
2023-12-10Add feature gate test for `--env` flagGuillaume Gomez-0/+5
2023-12-08Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errorsbors-2/+2
never_patterns: Parse match arms with no body Never patterns are meant to signal unreachable cases, and thus don't take bodies: ```rust let ptr: *const Option<!> = ...; match *ptr { None => { foo(); } Some(!), } ``` This PR makes rustc accept the above, and enforces that an arm has a body xor is a never pattern. This affects parsing of match arms even with the feature off, so this is delicate. (Plus this is my first non-trivial change to the parser). ~~The last commit is optional; it introduces a bit of churn to allow the new suggestions to be machine-applicable. There may be a better solution? I'm not sure.~~ EDIT: I removed that commit r? `@compiler-errors`
2023-12-08Auto merge of #118668 - fmease:resolve-assoc-item-bindings-by-namespace, ↵bors-5/+10
r=compiler-errors Resolve associated item bindings by namespace This is the 3rd commit split off from #118360 with tests reblessed (they no longer contain duplicated diags which were caused by 4c0addc80af4666f26d7ad51fe34a0e2dd0b8b74) & slightly adapted (removed supertraits from a UI test, cc #118040). > * Resolve all assoc item bindings (type, const, fn (feature `return_type_notation`)) by namespace instead of trying to resolve a type first (in the non-RTN case) and falling back to consts afterwards. This is consistent with RTN. E.g., for `Tr<K = {…}>` we now always try to look up assoc consts (this extends to supertrait bounds). This gets rid of assoc tys shadowing assoc consts in assoc item bindings which is undesirable & inconsistent (types and consts live in different namespaces after all) > * Consolidate the resolution of assoc {ty, const} bindings and RTN (dedup, better diags for RTN) > * Fix assoc consts being labeled as assoc *types* in several diagnostics > * Make a bunch of diagnostics translatable Fixes #112560 (error → pass). As discussed r? `@compiler-errors` --- **Addendum**: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.
2023-12-07Resolve assoc item bindings by namespaceLeón Orell Valerian Liehr-5/+10
If a const is expected, resolve a const. If a type is expected, resolve a type. Don't try to resolve a type first falling back to consts.
2023-12-06Rollup merge of #117981 - Urgau:check-cfg-remove-deprecated-syntax, r=b-naberMatthias Krüger-1/+1
Remove deprecated `--check-cfg` syntax This PR removes the deprecated `--check-cfg` `names(...)` and `values(...)` syntax. Follow up to https://github.com/rust-lang/rust/pull/111072 Part of https://github.com/rust-lang/compiler-team/issues/636 r? compiler
2023-12-05Add lifetime_capture_rules_2024Michael Goulet-0/+24
2023-12-05Remove deprecated --check-cfg names() and values() syntaxUrgau-1/+1
2023-12-04Remove the `precise_pointer_size_matching` feature gateNadrieril-2/+0
2023-12-03Disallow arm bodies on never patternsNadrieril-2/+2
2023-11-30Enable link-arg link kind inside of #[link] attributezetanumbers-0/+17
- Implement link-arg as an attribute - Apply suggestions from review - Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> - Add unstable book entry
2023-11-29Add `never_patterns` feature gateNadrieril-0/+66
2023-11-24Show number in error message even for one errorNilstrieb-90/+90
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-23Add an experimental feature gate for function delegationVadim Petrochenkov-0/+16
In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md). Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530.
2023-11-23Auto merge of #118065 - estebank:core-not-found-404, r=TaKO8Kibors-4/+8
When failing to import `core`, suggest `std`
2023-11-22When failing to import `core`, suggest `std`Esteban Küber-4/+8
2023-11-22Stabilize RFC3324 dyn upcasting coercionUrgau-26/+0
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-05Auto merge of #117537 - GKFX:offset-of-enum-feature, r=cjgillotbors-0/+52
Feature gate enums in offset_of As requested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790815262, put enums in offset_of behind their own feature gate. `@rustbot` label F-offset_of
2023-11-03Tweak spans for "adt defined here" noteNadrieril-3/+3
2023-11-03Feature gate enums in offset_ofGeorge Bateman-0/+52
2023-11-01Auto merge of #116692 - Nadrieril:half-open-ranges, r=cjgillotbors-14/+14
Match usize/isize exhaustively with half-open ranges The long-awaited finale to the saga of [exhaustiveness checking for integers](https://github.com/rust-lang/rust/pull/50912)! ```rust match 0usize { 0.. => {} // exhaustive! } match 0usize { 0..usize::MAX => {} // helpful error message! } ``` Features: - Half-open ranges behave as expected for `usize`/`isize`; - Trying to use `0..usize::MAX` will tell you that `usize::MAX..` is missing and explain why. No more unhelpful "`_` is missing"; - Everything else stays the same. This should unblock https://github.com/rust-lang/rust/issues/37854. Review-wise: - I recommend looking commit-by-commit; - This regresses perf because of the added complexity in `IntRange`; hopefully not too much; - I measured each `#[inline]`, they all help a bit with the perf regression (tho I don't get why); - I did not touch MIR building; I expect there's an easy PR there that would skip unnecessary comparisons when the range is half-open.
2023-10-29On object safety error, mention new enum as alternativeEsteban Küber-0/+2
When we encounter a `dyn Trait` that isn't object safe, look for its implementors. If there's one, mention using it directly If there are less than 9, mention the possibility of creating a new enum and using that instead. Account for object unsafe `impl Trait on dyn Trait {}`. Make a distinction between public and sealed traits. Fix #80194.
2023-10-29Auto merge of #116447 - oli-obk:gen_fn, r=compiler-errorsbors-17/+134
Implement `gen` blocks in the 2024 edition Coroutines tracking issue https://github.com/rust-lang/rust/issues/43122 `gen` block tracking issue https://github.com/rust-lang/rust/issues/117078 This PR implements `gen` blocks that implement `Iterator`. Most of the logic with `async` blocks is shared, and thus I renamed various types that were referring to `async` specifically. An example usage of `gen` blocks is ```rust fn foo() -> impl Iterator<Item = i32> { gen { yield 42; for i in 5..18 { if i.is_even() { continue } yield i * 2; } } } ``` The limitations (to be resolved) of the implementation are listed in the tracking issue
2023-10-27Match usize/isize exhaustivelyNadrieril-14/+14
2023-10-27Feature gate coroutine `yield` usageOli Scherer-8/+49
2023-10-27Feature gate `gen` blocks, even in 2024 editionOli Scherer-8/+84
2023-10-26Tweak suggestion spans for invalid crate-level inner attributeEsteban Küber-38/+76
CC #89566.
2023-10-23Update `since` stability attributes in testsDavid Tolnay-6/+6
2023-10-21Auto merge of #116734 - Nadrieril:lint-per-column, r=cjgillotbors-22/+97
Lint `non_exhaustive_omitted_patterns` by columns This is a rework of the `non_exhaustive_omitted_patterns` lint to make it more consistent. The intent of the lint is to help consumers of `non_exhaustive` enums ensure they stay up-to-date with all upstream variants. This rewrite fixes two cases we didn't handle well before: First, because of details of exhaustiveness checking, the following wouldn't lint `Enum::C` as missing: ```rust match Some(x) { Some(Enum::A) => {} Some(Enum::B) => {} _ => {} } ``` Second, because of the fundamental workings of exhaustiveness checking, the following would treat the `true` and `false` cases separately and thus lint about missing variants: ```rust match (true, x) { (true, Enum::A) => {} (true, Enum::B) => {} (false, Enum::C) => {} _ => {} } ``` Moreover, it would correctly not lint in the case where the pair is flipped, because of asymmetry in how exhaustiveness checking proceeds. A drawback is that it no longer makes sense to set the lint level per-arm. This will silently break the lint for current users of it (but it's behind a feature gate so that's ok). The new approach is now independent of the exhaustiveness algorithm; it's a separate pass that looks at patterns column by column. This is another of the motivations for this: I'm glad to move it out of the algorithm, it was akward there. This PR is almost identical to https://github.com/rust-lang/rust/pull/111651. cc `@eholk` who reviewed it at the time. Compared to then, I'm more confident this is the right approach.
2023-10-20s/generator/coroutine/Oli Scherer-12/+12
2023-10-14Lint `non_exhaustive_omitted_patterns` per columnNadrieril-14/+62
2023-10-14Add and prepare testsNadrieril-19/+46
2023-10-13Stabilize AFIT and RPITITMichael Goulet-53/+4
2023-10-08rustdoc: remove rust logo from non-Rust cratesMichael Howell-0/+17
2023-10-05Rollup merge of #116428 - Alexendoo:note-duplicate-diagnostics, ↵Matthias Krüger-0/+25
r=compiler-errors,estebank Add a note to duplicate diagnostics Helps explain why there may be a difference between manual testing and the test suite output and highlights them as something to potentially look into For existing duplicate diagnostics I just blessed them other than a few files that had other `NOTE` annotations in
2023-10-05Rollup merge of #116431 - estebank:issue-80476, r=compiler-errorsJubilee-16/+16
Tweak wording of E0562 Fix #80476.
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+25
2023-10-04Tweak wording of E0562Esteban Küber-16/+16
Fix #80476.
2023-10-03Bless testsMichael Goulet-4/+5
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-1/+1
only suggest it when the type can probably work
2023-09-23implement Literal::byte_characterEmil Gardström-0/+22
without this, the only way to create a `LitKind::Byte` is by doing `"b'a'".parse::<Literal>()`, this solves that by enabling `Literal::byte_character(b'a')`
2023-09-14Fix the error message for `#![feature(no_coverage)]`Zalathar-1/+1
2023-09-08Rename the feature, but not the attribute, to `coverage_attribute`Andy Caldwell-3/+3
2023-09-08Add `no_coverage` to the 'removed features' listAndy Caldwell-4/+14