about summary refs log tree commit diff
path: root/tests/ui/rfcs
AgeCommit message (Collapse)AuthorLines
2023-12-18Check const_eval_select intrinsic correctlyMichael Goulet-1/+6
2023-12-18Check FnPtr/FnDef built-in fn traits correctly with effectsMichael Goulet-2/+13
2023-12-18Rollup merge of #119059 - fmease:no-tilde-const-in-inh-impl-headers, r=fee1-deadMatthias Krüger-17/+19
Deny `~const` trait bounds in inherent impl headers Follow-up to #117817. Implements https://github.com/rust-lang/rust/pull/117817#discussion_r1416213747. Fixes #117004. r? fee1-dead or compiler
2023-12-18Deny ~const trait bounds in inherent impl headersLeón Orell Valerian Liehr-17/+19
2023-12-17Auto merge of #114962 - darklyspaced:debug, r=est31bors-15/+15
adds a column number to `dbg!()` this would be very nice to have for a few reasons: 1. the rfc, when deciding not to add column numbers to macro, failed to acknowledge any potential ambiguous cases -- such as the one provided in #114910 -- which do exist 2. would be able to consistently and easily jump directly to the `dbg!()` regardless of the sutation 3. takes up, at a maximum, 3 characters of _horizontal_ screen space fixes #114910
2023-12-14update use of feature flagslcnr-1/+1
2023-12-12blesseddarklyspaced-15/+15
resolved conflicts
2023-12-11Auto merge of #118661 - fee1-dead-contrib:restore-const-partialEq, ↵bors-108/+68
r=compiler-errors Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
2023-12-11Add spacing information to delimiters.Nicholas Nethercote-8/+8
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
2023-12-11Improve `print_tts` by changing `tokenstream::Spacing`.Nicholas Nethercote-20/+19
`tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-12-10fix testsDeadbeef-10/+41
2023-12-10Revert "Don't print host effect param in pretty path_generic_args"Deadbeef-1/+1
This reverts commit f1bf874fb13703d706fc8184407c6df12555d8e9.
2023-12-10Restore `const PartialEq`Deadbeef-111/+40
2023-12-09Print constness in TraitPredPrintModifiersAndPathMichael Goulet-5/+5
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-2/+2
2023-12-09Rollup merge of #118734 - nnethercote:literal-cleanups, r=fee1-deadGuillaume Gomez-0/+0
Unescaping cleanups Minor improvements I found while working on #118699. r? `@fee1-dead`
2023-12-09Tweak the `no-nuls.rs` test.Nicholas Nethercote-0/+0
The `empty!` macro calls should be outside the `cfg(FALSE)` function.
2023-12-08Rollup merge of #118730 - jyn514:cmp_refs, r=estebank,compiler-errorsMatthias Krüger-4/+4
recurse into refs when comparing tys for diagnostics before: ![image](https://github.com/rust-lang/rust/assets/23638587/bf6abd62-c7f3-4c09-a47e-31b6e129de19) after: ![image](https://github.com/rust-lang/rust/assets/23638587/b704d728-ddba-4204-aebe-c07dcbbcb55c) this diff from the test suite is also quite nice imo: ```diff `@@` -4,8 +4,8 `@@` error[E0308]: mismatched types LL | debug_assert_eq!(iter.next(), Some(value)); | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | - = note: expected enum `Option<<I as Iterator>::Item>` - found enum `Option<&<I as Iterator>::Item>` + = note: expected enum `Option<_>` + found enum `Option<&_>` ```
2023-12-08Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errorsbors-0/+183
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-07recurse into refs when comparing tys for diagnosticsjyn-4/+4
2023-12-07Fix const drop checkingMichael Goulet-22/+2
2023-12-06Auto merge of #118605 - fee1-dead-contrib:rm-rustc_host, r=compiler-errorsbors-6/+7
Remove `#[rustc_host]`, use internal desugaring Also removed a way for users to explicitly specify the host param since that isn't particularly useful. This should eliminate any pain with encoding attributes across crates and etc. r? `@compiler-errors`
2023-12-05Rollup merge of #118268 - compiler-errors:pretty-print, r=estebankMichael Goulet-4/+4
Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always It's almost always better, at least in diagnostics, to print `Fn(i32, u32)` instead of `Fn<(i32, u32)>`. Related to but doesn't fix #118225. That needs a separate fix.
2023-12-05Add print_trait_sugaredMichael Goulet-4/+4
2023-12-05Remove `#[rustc_host]`, use internal desugaringDeadbeef-6/+7
2023-12-04Use default params until effects in desugaringDeadbeef-6/+19
2023-12-03Satisfy tidyNadrieril-0/+183
2023-12-01Auto merge of #117472 - jmillikin:stable-c-str-literals, r=Nilstriebbors-40/+0
Stabilize C string literals RFC: https://rust-lang.github.io/rfcs/3348-c-str-literal.html Tracking issue: https://github.com/rust-lang/rust/issues/105723 Documentation PR (reference manual): https://github.com/rust-lang/reference/pull/1423 # Stabilization report Stabilizes C string and raw C string literals (`c"..."` and `cr#"..."#`), which are expressions of type [`&CStr`](https://doc.rust-lang.org/stable/core/ffi/struct.CStr.html). Both new literals require Rust edition 2021 or later. ```rust const HELLO: &core::ffi::CStr = c"Hello, world!"; ``` C strings may contain any byte other than `NUL` (`b'\x00'`), and their in-memory representation is guaranteed to end with `NUL`. ## Implementation Originally implemented by PR https://github.com/rust-lang/rust/pull/108801, which was reverted due to unintentional changes to lexer behavior in Rust editions < 2021. The current implementation landed in PR https://github.com/rust-lang/rust/pull/113476, which restricts C string literals to Rust edition >= 2021. ## Resolutions to open questions from the RFC * Adding C character literals (`c'.'`) of type `c_char` is not part of this feature. * Support for `c"..."` literals does not prevent `c'.'` literals from being added in the future. * C string literals should not be blocked on making `&CStr` a thin pointer. * It's possible to declare constant expressions of type `&'static CStr` in stable Rust (as of v1.59), so C string literals are not adding additional coupling on the internal representation of `CStr`. * The unstable `concat_bytes!` macro should not accept `c"..."` literals. * C strings have two equally valid `&[u8]` representations (with or without terminal `NUL`), so allowing them to be used in `concat_bytes!` would be ambiguous. * Adding a type to represent C strings containing valid UTF-8 is not part of this feature. * Support for a hypothetical `&Utf8CStr` may be explored in the future, should such a type be added to Rust.
2023-11-30Auto merge of #118379 - compiler-errors:const-params-for-partialeq, r=fee1-deadbors-45/+13
Fix `PartialEq` args when `#[const_trait]` is enabled This is based off of your PR that enforces effects on all methods, so just see the last commits. r? fee1-dead
2023-11-29Rollup merge of #118333 - eduardosm:print-missing-target-features, r=est31Matthias Krüger-47/+129
Print list of missing target features when calling a function with target features outside an unsafe block Fixes https://github.com/rust-lang/rust/issues/108680 Supersedes https://github.com/rust-lang/rust/pull/109710. I used the same wording for the messages, but the implementation is different. r? `@est31`
2023-11-29Rollup merge of #118191 - estebank:let-chain-typo, r=compiler-errorsMatthias Krüger-0/+8
Suggest `let` or `==` on typo'd let-chain When encountering a bare assignment in a let-chain, suggest turning the assignment into a `let` expression or an equality check. ``` error: expected expression, found `let` statement --> $DIR/bad-if-let-suggestion.rs:5:8 | LL | if let x = 1 && i = 2 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions help: you might have meant to continue the let-chain | LL | if let x = 1 && let i = 2 {} | +++ help: you might have meant to compare for equality | LL | if let x = 1 && i == 2 {} | + ```
2023-11-28Add with_opt_const_effect_param helper, simplifyMichael Goulet-2/+2
2023-11-28Add PartialEq<&B> for &AMichael Goulet-44/+12
2023-11-28Fix PartialEq args when #[const_trait] is enabledMichael Goulet-1/+1
2023-11-28thir-unsafeck: print list of missing target features when calling a function ↵Eduardo Sánchez Muñoz-13/+65
with target features outside an unsafe block
2023-11-28Suggest `let` or `==` on typo'd let-chainEsteban Küber-0/+8
When encountering a bare assignment in a let-chain, suggest turning the assignment into a `let` expression or an equality check. ``` error: expected expression, found `let` statement --> $DIR/bad-if-let-suggestion.rs:5:8 | LL | if let x = 1 && i = 2 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions help: you might have meant to continue the let-chain | LL | if let x = 1 && let i = 2 {} | +++ help: you might have meant to compare for equality | LL | if let x = 1 && i == 2 {} | + ```
2023-11-28Auto merge of #118282 - fee1-dead-contrib:enforce-more, r=compiler-errorsbors-30/+75
effects: Run `enforce_context_effects` for all method calls So that we also perform checks when overloaded `PartialEq`s are called. r? `@compiler-errors`
2023-11-27Print list of missing target features when calling a function with target ↵Eduardo Sánchez Muñoz-37/+67
features outside an unsafe block
2023-11-26Auto merge of #117611 - Nadrieril:linear-pass-take-4, r=cjgillotbors-120/+95
Rewrite exhaustiveness in one pass This is at least my 4th attempt at this in as many years x) Previous attempts were all too complicated or too slow. But we're finally here! The previous version of the exhaustiveness algorithm computed reachability for each arm then exhaustiveness of the whole match. Since each of these steps does roughly the same things, this rewrites the algorithm to do them all in one go. I also think this makes things much simpler. I also rewrote the documentation of the algorithm in depth. Hopefully it's up-to-date and easier to follow now. Plz comment if anything's unclear. r? `@oli-obk` I think you're one of the rare other people to understand the exhaustiveness algorithm? cc `@varkor` I know you're not active anymore, but if you feel like having a look you might enjoy this :D Fixes https://github.com/rust-lang/rust/issues/79307
2023-11-25effects: Run `enforce_context_effects` for all method callsDeadbeef-30/+75
2023-11-24Auto merge of #118138 - Nilstrieb:one-previous-error, r=WaffleLapkinbors-137/+137
Fixes error count display is different when there's only one error left Supersedes #114759 ### What did I do? I did the small change in `rustc_errors` by hand. Then I did the other changes in `/compiler` by hand, those were just find replace on `*.rs` in the workspace. The changes in run-make are find replace for `run-make` in the workspace. All other changes are blessed using `x test TEST --bless`. I blessed the tests that were blessed in #114759. ### how to review this nightmare ping bors with an `r+`. You should check that my logic is sound and maybe quickly scroll through the diff, but fully verifying it seems fairly hard to impossible. I did my best to do this correctly. Thank you `@adrianEffe` for bringing this up and your initial implementation. cc `@flip1995,` you said you want to do a subtree sync asap cc `@RalfJung` maybe you want to do a quick subtree sync afterwards as well for Miri r? `@WaffleLapkin`
2023-11-24Manual find replace updatesNilstrieb-10/+10
2023-11-24Show number in error message even for one errorNilstrieb-127/+127
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24Add `Span` to `TraitBoundModifier`Deadbeef-35/+35
2023-11-22When failing to import `core`, suggest `std`Esteban Küber-5/+8
2023-11-22Add some testsNadrieril-120/+95
2023-11-12Auto merge of #117817 - fmease:deny-more-tilde-const, r=fee1-deadbors-81/+391
Deny more `~const` trait bounds thereby fixing a family of ICEs (delayed bugs) for `feature(const_trait_impl, effects)` code. As discussed r? `@fee1-dead`
2023-11-12Deny more `~const` trait boundsLeón Orell Valerian Liehr-81/+391
2023-11-08Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwcobors-14/+133
patterns: reject raw pointers that are not just integers Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not. This extends the existing check against function pointers and wide pointers: we now uniformly reject all these pointer types during valtree construction, and then later lint because of that. See [here](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784654073) for some more explanation and context. Also fixes https://github.com/rust-lang/rust/issues/116929. Cc `@oli-obk` `@lcnr`
2023-11-06Rollup merge of #117516 - matthiaskrgr:test_effects_113375_oob, r=fee1-deadMatthias Krüger-0/+18
add test for #113375 Fixes #113375 r? `@fee1-dead`