about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-06-16bless clippy testsklensy-26/+26
2022-06-16bless rustdoc-ui testsklensy-3/+3
2022-06-16 fix one more case of trailing spaceklensy-139/+139
2022-06-16diagnostics: fix trailing spaceklensy-483/+483
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-1/+15
Improve the tuple and unit trait docs * Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. Here's the new version: * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html> * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
2022-06-16Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, ↵Matthias Krüger-0/+175
r=wesleywiser,flip1995 Support lint expectations for `--force-warn` lints (RFC 2383) Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope. This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust. This will probably conflict with https://github.com/rust-lang/rust/pull/97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix. --- r? `@wesleywiser` cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. :upside_down_face: Follow-up of: https://github.com/rust-lang/rust/pull/87835 Issue: https://github.com/rust-lang/rust/issues/85549 Yeah, and that's it.
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-0/+175
2022-06-16Do not suggest adding semicolon/changing delimiters for macros in item ↵Chayim Refael Friedman-0/+98
position that originates in macros
2022-06-16Auto merge of #98103 - exrook:btreemap-alloc, r=Amanieubors-8/+8
BTreeMap: Support custom allocators (v1.5) Related: https://github.com/rust-lang/wg-allocators/issues/7 https://github.com/TimDiekmann/alloc-wg Blocked on: ~~#77187~~ ~~#78459~~ ~~#95036~~ previous: #77438
2022-06-15remove box derefs from codgenDrMeepster-8/+10
2022-06-16Rollup merge of #98135 - JohnTitor:issue-93022-93775, r=compiler-errorsYuki Okushi-0/+29
Add regression test for #93775 Closes #93775, also closes #93022 as it should have the same root cause r? ```@compiler-errors``` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-16Rollup merge of #98119 - EdwinRy:path-parenthesized-type-error, r=estebankYuki Okushi-20/+35
Refactor path segment parameter error This PR attempts to rewrite the error handling for an unexpected parenthesised type parameters to: - Use provided data instead of re-parsing the whole span - Add a multipart suggestion to reflect on the changes with an underline - Remove the unnecessary "if" nesting
2022-06-16Rollup merge of #97964 - WaffleLapkin:fix_borrow_par_suggestions, ↵Yuki Okushi-60/+449
r=compiler-errors Fix suggestions for `&a: T` parameters I've accidentally discovered that we have broken suggestions for `&a: T` parameters: ```rust fn f(&mut bar: u32) {} fn main() { let _ = |&mut a| (); } ``` ```text error[E0308]: mismatched types --> ./t.rs:1:6 | 1 | fn f(&mut bar: u32) {} | ^^^^^^^^----- | | | | | expected due to this | expected `u32`, found `&mut _` | help: did you mean `bar`: `&u32` | = note: expected type `u32` found mutable reference `&mut _` error[E0308]: mismatched types --> ./t.rs:4:23 | 4 | let _: fn(u32) = |&mut a| (); | ^^^^^-- | | | | | expected due to this | expected `u32`, found `&mut _` | help: did you mean `a`: `&u32` | = note: expected type `u32` found mutable reference `&mut _` ``` It's hard to see, but 1. The help span is overlapping with "expected" spans 2. It suggests `fn f( &u32) {}` (no `mut` and lost parameter name) and `|&u32 ()` (no closing `|` and lost parameter name) I've tried to fix this. r? ``@compiler-errors``
2022-06-15tests H.R. `T: 'a` bounds proving themselvesNiko Matsakis-0/+41
2022-06-15mark issue-91139 and issue-92096 as FIXMENiko Matsakis-3/+82
These were "fixed" as part of switching on NLL but seems to be due to another problem. Preliminary investigation suggests they are both PROBABLY "implied bounds" related.
2022-06-15fix universes in the NLL type testsNiko Matsakis-0/+37
In the NLL code, we were not accommodating universes in the `type_test` logic. This led to issue 98095.
2022-06-15[RFC 2011] Expand expressions where possibleCaio-0/+42
2022-06-15Auto merge of #97665 - c410-f3r:assert-compiler, r=oli-obkbors-15/+379
[RFC 2011] Minimal initial implementation Tracking issue: #44838 Third step of #96496 Implementation has ~290 LOC with the bare minimum to be in a functional state. Currently only searches for binary operations to mimic what `assert_eq!` and `assert_ne!` already do. r? `@oli-obk`
2022-06-15generalize the outlives obligation codeNiko Matsakis-143/+15
The code now accepts `Binder<OutlivesPredicate>` instead of just `OutlivesPredicate` and thus exercises the new, generalized `IfEqBound` codepaths. Note though that we never *produce* Binder<OutlivesPredicate>, so we are only testing a subset of those codepaths that excludes actual higher-ranked outlives bounds.
2022-06-15Add regression test for #93775Yuki Okushi-0/+29
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-15[RFC 2011] Minimal initial implementationCaio-15/+379
2022-06-15Rollup merge of #98115 - jhpratt:remove-rustc_deprecated, r=compiler-errorsYuki Okushi-198/+163
Remove `rustc_deprecated` diagnostics Follow-up on #95960. The diagnostics will remain until the next bootstrap, at which point people will have had six weeks to adjust. ``@rustbot`` label +A-diagnostics r? ``@compiler-errors``
2022-06-15Auto merge of #98123 - JohnTitor:rollup-rfg1a4s, r=JohnTitorbors-4/+85
Rollup of 7 pull requests Successful merges: - #97822 (Filter out intrinsics if we have other import candidates to suggest) - #98026 (Move some tests to more reasonable directories) - #98067 (compiler: remove unused deps) - #98078 (Use unchecked mul to compute slice sizes) - #98083 (Rename rustc_serialize::opaque::Encoder as MemEncoder.) - #98087 (Suggest adding a `#[macro_export]` to a private macro) - #98113 (Fix misspelling of "constraint" as "contraint") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-15Rollup merge of #98087 - TaKO8Ki:suggest-adding-macro-export, r=oli-obkYuki Okushi-4/+50
Suggest adding a `#[macro_export]` to a private macro fixes #97628
2022-06-15Rollup merge of #98026 - c410-f3r:z-errors, r=petrochenkovYuki Okushi-0/+0
Move some tests to more reasonable directories r? ```@petrochenkov```
2022-06-15Rollup merge of #97822 - compiler-errors:hesitate-to-suggest-intrinsics, ↵Yuki Okushi-0/+35
r=oli-obk Filter out intrinsics if we have other import candidates to suggest Fixes #97618 Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
2022-06-15Auto merge of #97474 - compiler-errors:if-cond-and-block, r=oli-obkbors-100/+243
Improve parsing errors and suggestions for bad `if` statements 1. Parses `if {}` as `if <err> {}` (block-like conditions that are missing a "then" block), and `if true && {}` as `if true && <err> {}` (unfinished binary operation), which is a more faithful recovery and leads to better typeck errors later on. 1. Points out the span of the condition if we don't see a "then" block after it, to help the user understand what is being parsed as a condition (and by elimination, what isn't). 1. Allow `if cond token else { }` to be fixed properly to `if cond { token } else { }`. 1. Fudge with the error messages a bit. This is somewhat arbitrary and I can revert my rewordings if they're useless. ---- Also this PR addresses a strange parsing regression (1.20 -> 1.21) where we chose to reject this piece of code somewhat arbitrarily, even though we should parse it fine: ```rust fn main() { if { if true { return } else { return }; } {} } ``` For context, all of these other expressions parse correctly: ```rust fn main() { if { if true { return } else { return } } {} if { return; } {} if { return } {} if { return if true { } else { }; } {} } ``` The parser used a heuristic to determine if the "the parsed `if` condition makes sense as a condition" that did like a one-expr-deep reachability analysis. This should not be handled by the parser though.
2022-06-15Refactor path segment parameter errorEdwinRy-20/+35
2022-06-14Remove `rustc_deprecated` diagnosticsJacob Pratt-198/+163
2022-06-14btreemap-alloc: adjust ui testJacob Hughes-8/+8
2022-06-15add a test case for `decl_macro`Takayuki Maeda-3/+21
2022-06-14rebaseb-naber-41/+113
2022-06-14address reviewb-naber-2/+2
2022-06-14bless 32-bit ui testsb-naber-4/+10
2022-06-14address reviewb-naber-5/+5
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-249/+398
2022-06-14change edition to 2021Takayuki Maeda-1/+1
2022-06-14suggest adding a `#[macro_export]` to a private macroTakayuki Maeda-4/+32
2022-06-13Improve parsing errors and suggestions for bad if statementsMichael Goulet-100/+243
2022-06-14Rollup merge of #97508 - JohnTitor:more-strict-placeholder-dyn-obj, r=pnkfelixYuki Okushi-7/+74
Harden bad placeholder checks on statics/consts Resubmission of #89161 Fixes https://github.com/rust-lang/rust/issues/88643 In #83739, I added a check for trait objects on statics/consts but it wasn't robust. `is_suggestable_infer_ty` fn does a more strict check and finds more bad placeholders. See https://github.com/rust-lang/rust/pull/89161#issuecomment-934690300 for the more detailed explanation. r? `@pnkfelix` as you're the reviewer of the previous PR
2022-06-14Rollup merge of #95243 - vladimir-ea:compiler_watch_os, r=nagisaYuki Okushi-1/+1
Add Apple WatchOS compile targets Hello, I would like to add the following target triples for Apple WatchOS as Tier 3 platforms: armv7k-apple-watchos arm64_32-apple-watchos x86_64-apple-watchos-sim There are some pre-requisites Pull Requests: https://github.com/rust-lang/compiler-builtins/pull/456 (merged) https://github.com/alexcrichton/cc-rs/pull/662 (pending) https://github.com/rust-lang/libc/pull/2717 (merged) There will be a subsequent PR with standard library changes for WatchOS. Previous compiler and library changes were in a single PR (https://github.com/rust-lang/rust/pull/94736) which is now closed in favour of separate PRs. Many thanks! Vlad. ### Tier 3 Target Requirements Adds support for Apple WatchOS compile targets. Below are details on how this target meets the requirements for tier 3: > tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) `@deg4uss3r` has volunteered to be the target maintainer. I am also happy to help if a second maintainer is required. > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. Uses the same naming as the LLVM target, and the same convention as other Apple targets. > Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. I don't believe there is any ambiguity here. > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. I don't see any legal issues here. > The target must not introduce license incompatibilities. > Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). > The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements. > If the target supports building host tools (such as rustc or cargo), those host tools must not depend on proprietary (non-FOSS) libraries, other than ordinary runtime libraries supplied by the platform and commonly used by other binaries built for the target. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3. > Targets should not require proprietary (non-FOSS) components to link a functional binary or library. > "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users. I see no issues with any of the above. > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. > This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements. Only relevant to those making approval decisions. > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. core and alloc can be used. std support will be added in a subsequent PR. > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running tests (even if they do not pass), the documentation must explain how to run tests for the target, using emulation if possible or dedicated hardware if necessary. Use --target=<target> option to cross compile, just like any target. Tests can be run using the WatchOS simulator (see https://developer.apple.com/documentation/xcode/running-your-app-in-the-simulator-or-on-a-device). > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. > Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications. I don't foresee this being a problem. > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. > In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target. No other targets should be affected by the pull request.
2022-06-14Rollup merge of #95211 - terrarier2111:improve-parser, r=compiler-errorsYuki Okushi-24/+47
Improve parser diagnostics This pr fixes https://github.com/rust-lang/rust/issues/93867 and contains a couple of diagnostics related changes to the parser. Here is a short list with some of the changes: - don't suggest the same thing that is the current token - suggest removing the current token if the following token is one of the suggestions (maybe incorrect) - tell the user to put a type or lifetime after where if there is none (as a warning) - reduce the amount of tokens suggested (via the new eat_noexpect and check_noexpect methods) If any of these changes are undesirable, i can remove them, thanks!
2022-06-13Move testsCaio-0/+0
2022-06-13Rollup merge of #98050 - JohnTitor:issue-67945, r=compiler-errorsMatthias Krüger-0/+107
Add some more regression tests for #67945 Closes #67945, added two tests from https://github.com/rust-lang/rust/issues/67945#issuecomment-572617285, other snippets were already added in #71952 and #77439 r? `@compiler-errors`
2022-06-13Rollup merge of #98044 - dust1:master, r=Dylan-DPCMatthias Krüger-5/+1
[issues:97981] del unrelated comment fixes https://github.com/rust-lang/rust/issues/97981 summary: del unrelated comment
2022-06-13Rollup merge of #97960 - RalfJung:offset-from, r=oli-obkMatthias Krüger-17/+17
interpret: unify offset_from check with offset check `offset` does the check with a single `check_ptr_access` call while `offset_from` used two calls. Make them both just one one call. I originally intended to actually factor this into a common function, but I am no longer sure if that makes a lot of sense... the two functions start with pretty different precondition (e.g. `offset` *knows* that the 2nd pointer has the same provenance). I also reworded the UB messages a little. Saying it "cannot" do something is not how we usually phrase UB (as far as I know). Instead it's not *allowed* to do that. r? ``````@oli-obk``````
2022-06-13Rollup merge of #97875 - JohnTitor:rm-infer-static-outlives-requirements, ↵Matthias Krüger-60/+3
r=pnkfelix Remove the `infer_static_outlives_requirements` feature Closes #54185 r? ``@pnkfelix``
2022-06-13Rollup merge of #97709 - compiler-errors:normalize-const-param-ty, r=oli-obkMatthias Krüger-0/+88
Normalize consts' tys when relating with `adt_const_params` Fixes #97007
2022-06-13Add Apple WatchOS compile targetsVladimir Michael Eatwell-1/+1
2022-06-13Add some more regression tests for #67945Yuki Okushi-0/+107