summary refs log tree commit diff
path: root/compiler/rustc_feature/src
AgeCommit message (Collapse)AuthorLines
2024-03-17branch 1.78: replace-version-placeholderMark Rousskov-11/+11
2024-03-16Auto merge of #121926 - tgross35:f16-f128-step3-feature-gate, ↵bors-0/+4
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-15Add `rustc_never_type_mode = "no_fallback"`Maybe Waffle-1/+1
2024-03-15Add `rustc_never_type_mode` crate-level attribute to allow experimentingMaybe Waffle-0/+7
2024-03-14Add feature gates for `f16` and `f128`Trevor Gross-0/+4
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-14change some attribute to only_localsurechen-18/+55
2024-03-11Rollup merge of #121840 - oli-obk:freeze, r=dtolnayJacob Pratt-0/+2
Expose the Freeze trait again (unstably) and forbid implementing it manually non-emoji version of https://github.com/rust-lang/rust/pull/121501 cc #60715 This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue. It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: https://github.com/google/zerocopy/issues/941 cc ```@RalfJung``` T-lang signed off on reexposing this unstably: https://github.com/rust-lang/rust/pull/121501#issuecomment-1969827742
2024-03-10diagnostics: Do not suggest using `#[unix_sigpipe]` without a valueMartin Nordholts-1/+1
Remove `Word` from the `unix_sigpipe` attribute template so that plain `#[unix_sigpipe]` is not included in suggestions of valid forms of the attribute. Also re-arrange diagnostics code slightly to avoid duplicate diagnostics.
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-0/+2
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-07Rollup merge of #119888 - weiznich:stablize_diagnostic_namespace, ↵Guillaume Gomez-2/+2
r=compiler-errors Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute. The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working. The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented: * `message` which provides the text for the top level error message * `label` which provides the text for the label shown inline in the broken code in the error message * `note` which provides additional notes. The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated. All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated. This allows to have a trait definition like: ```rust #[diagnostic::on_unimplemented( message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`", label = "My Label", note = "Note 1", note = "Note 2" )] trait ImportantTrait<A> {} ``` which then generates for the following code ```rust fn use_my_trait(_: impl ImportantTrait<i32>) {} fn main() { use_my_trait(String::new()); } ``` this error message: ``` error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String` --> src/main.rs:14:18 | 14 | use_my_trait(String::new()); | ------------ ^^^^^^^^^^^^^ My Label | | | required by a bound introduced by this call | = help: the trait `ImportantTrait<i32>` is not implemented for `String` = note: Note 1 = note: Note 2 ``` [Playground with the unstable feature](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=05133acce8e1d163d481e97631f17536) Fixes #111996
2024-03-06Rollup merge of #121382 - nnethercote:rework-untranslatable_diagnostic-lint, ↵Matthias Krüger-2/+2
r=davidtwco Rework `untranslatable_diagnostic` lint Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This PR changes it to check calls to any function with an `impl Into<{D,Subd}iagnosticMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. It also lets us add `#[rustc_lint_diagnostics]` to a number of functions that don't have an `impl Into<{D,Subd}iagnosticMessage>`, such as `Diag::span`. r? ``@davidtwco``
2024-03-06Rewrite the `untranslatable_diagnostic` lint.Nicholas Nethercote-2/+2
Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This commit changes it to check calls to any function with an `impl Into<{D,Subd}iagMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. The commit also adds `#[allow(rustc::untranslatable_diagnostic)`] attributes to places that need it that are caught by the improved lint. These places that might be easy to convert to translatable diagnostics. Finally, it also: - Expands and corrects some comments. - Does some minor formatting improvements. - Adds missing `DecorateLint` cases to `tests/ui-fulldeps/internal-lints/diagnostics.rs`.
2024-03-05Rollup merge of #122014 - surechen:change_attributes_to_local_20240304, r=lcnrMatthias Krüger-13/+26
Change some attributes to only_local. Modified according to https://github.com/rust-lang/compiler-team/issues/505. r? ``@lcnr``
2024-03-05Change some attributes to only_local.surechen-13/+26
Modified according to https://github.com/rust-lang/compiler-team/issues/505.
2024-03-04Add a scheme for moving away from `extern "rust-intrinsic"` entirelyOli Scherer-0/+4
2024-03-03Add new `pattern_complexity` attribute to add possibility to limit and check ↵Guillaume Gomez-0/+6
recursion in pattern matching
2024-02-29Forbid implementing `Freeze` even if the trait is stabilizedOli Scherer-0/+2
2024-02-29Rollup merge of #121740 - surechen:change_attribute_to_local_20240228, r=lcnrJacob Pratt-18/+45
Changing some attributes to only_local. Modified according to https://github.com/rust-lang/compiler-team/issues/505. r? ``@lcnr``
2024-02-28Changing some attributes to only_local.surechen-18/+45
Modified according to https://github.com/rust-lang/compiler-team/issues/505.
2024-02-27Stabilize the `#[diagnostic]` namespace and ↵Georg Semmler-2/+2
`#[diagnostic::on_unimplemented]` attribute This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute. The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working. The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented: * `message` which provides the text for the top level error message * `label` which provides the text for the label shown inline in the broken code in the error message * `note` which provides additional notes. The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated. All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated. Tracking issue: #111996
2024-02-27Changing some attributes to only_local.surechen-22/+41
Modified according to https://github.com/rust-lang/compiler-team/issues/505. By running test cases, I found that modifying the attribute's only_local tag sometimes causes some unintuitive error reports, so I tend to split it into multiple PRs and edit a small number of attributes each time to prevent too many changes at once. Prevent possible subsequent difficulties in locating problems.
2024-02-26Auto merge of #121516 - RalfJung:platform-intrinsics-begone, r=oli-obkbors-2/+3
remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics `@Amanieu` `@workingjubilee` I don't think there is any reason these need to be "special"? The [original RFC](https://rust-lang.github.io/rfcs/1199-simd-infrastructure.html) indicated eventually making them stable, but I think that is no longer the plan, so seems to me like we can clean this up a bit. Blocked on https://github.com/rust-lang/stdarch/pull/1538, https://github.com/rust-lang/rust/pull/121542.
2024-02-26Rollup merge of #121493 - surechen:edit_attribute_only_local, r=lcnrMatthias Krüger-18/+44
By changing some attributes to only_local, reducing encoding attributes in the crate metadate. Thank you. This is part of changing attributes to only_local. I hope get your opinion whether I should split into multiple PRs, or submit in one. According to [try to not rely on attributes from extern crates](https://github.com/rust-lang/compiler-team/issues/505) and lcnr's guidance.
2024-02-25Rollup merge of #119590 - ChrisDenton:cfg-target-abi, r=NilstriebMatthias Krüger-3/+2
Stabilize `cfg_target_abi` This stabilizes the `cfg` option called `target_abi`: ```rust #[cfg(target_abi = "eabihf")] ``` Tracking issue: #80970 fixes #78791 resolves #80970
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-2/+3
2024-02-25Auto merge of #121114 - Nilstrieb:no-inline!, r=saethlinbors-0/+4
Add `#[rustc_no_mir_inline]` for standard library UB checks should help with #121110 and also with #120848 Because the MIR inliner cannot know whether the checks are enabled or not, so inlining is an unnecessary compile time pessimization when debug assertions are disabled. LLVM knows whether they are enabled or not, so it can optimize accordingly without wasting time. r? `@saethlin`
2024-02-24Stabilize `cfg_target_abi`Chris Denton-3/+2
2024-02-24Add `#[rustc_no_mir_inline]` for standard library UB checksNilstrieb-0/+4
Co-authored-by: Ben Kimock <kimockb@gmail.com>
2024-02-24Add asm label support to AST and HIRGary Guo-0/+2
2024-02-23Rollup merge of #120742 - Nadrieril:use-min_exh_pats, r=compiler-errorsMatthias Krüger-1/+1
mark `min_exhaustive_patterns` as complete This is step 1 and 2 of my [proposal](https://github.com/rust-lang/rust/issues/119612#issuecomment-1918097361) to move `min_exhaustive_patterns` forward. The vast majority of in-tree use cases of `exhaustive_patterns` are covered by `min_exhaustive_patterns`. There are a few cases that still require `exhaustive_patterns` in tests and they're all behind references. r? ``@ghost``
2024-02-23By changing some attributes to only_local, reducing encoding attributes in ↵surechen-18/+44
the crate metadate. Thank you. This is part of changing attributes to only_local. I hope get your opinion whether I should split into multiple PRs, or submit in one. According to [try to not rely on attributes from extern crates](https://github.com/rust-lang/compiler-team/issues/505) and lcnr's guidance.
2024-02-16Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkinbors-0/+4
Implement intrinsics with fallback bodies fixes #93145 (though we can port many more intrinsics) cc #63585 The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for * codegen_ssa (so llvm and gcc) * codegen_cranelift other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body). cc `@scottmcm` `@WaffleLapkin` ### todo * [ ] miri support * [x] default intrinsic name to name of function instead of requiring it to be specified in attribute * [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-1/+1
2024-02-15Use generic `NonZero` internally.Markus Reiter-8/+9
2024-02-13Unmark the feature gate as incompleteNadrieril-1/+1
2024-02-12Rollup merge of #120965 - ChrisDenton:sahf, r=michaelwoeristerMatthias Krüger-0/+2
Add lahfsahf and prfchw target feature This adds target features for LAHF/SAHF and PrefetchW. These came up. along with the existing CMPXCHG16b. as [baseline features](https://download.microsoft.com/download/c/1/5/c150e1ca-4a55-4a7e-94c5-bfc8c2e785c5/Windows%2010%20Minimum%20Hardware%20Requirements.pdf) required for x86_64 Windows 10+.
2024-02-12Add lahfsahf and prfchw target featureChris Denton-0/+2
2024-02-12Implement intrinsics with fallback bodiesOli Scherer-0/+4
2024-02-12Tweak delayed bug mentions.Nicholas Nethercote-1/+1
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes sense to use the generic term "delayed bug" more.
2024-02-10unstably allow constants to refer to statics and read from immutable staticsRalf Jung-0/+2
2024-02-09Auto merge of #120676 - Mark-Simulacrum:bootstrap-bump, r=clubby789bors-6/+6
Bump bootstrap compiler to just-built 1.77 beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-02-09Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwcoMatthias Krüger-2/+0
Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? ````@davidtwco````
2024-02-08Bump version placeholdersMark Rousskov-6/+6
2024-02-06Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compiler-errorsMatthias Krüger-5/+3
Remove `ffi_returns_twice` feature The [tracking issue](https://github.com/rust-lang/rust/issues/58314) and [RFC](https://github.com/rust-lang/rfcs/pull/2633) have been closed for a couple of years. There is also an attribute gate in R-A which should be removed if this lands.
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-02-01`#![feature(inline_const_pat)]` is no longer incompleteMatthew Jasper-1/+1
2024-01-30Remove `ffi_returns_twice` featureclubby789-5/+3
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-2/+2
2024-01-24Add feature gateNadrieril-0/+3
2024-01-22Revert "Auto merge of #118133 - Urgau:stabilize_trait_upcasting, r=WaffleLapkin"Oli Scherer-3/+3
This reverts commit 6d2b84b3ed7848fd91b8d6151d4451b3103ed816, reversing changes made to 73bc12199ea8c7651ed98b069c0dd6b0bb5fabcf.