about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-03-31Rollup merge of #91416 - compiler-errors:infinite-ty-option-box, r=estebankDylan DPC-28/+160
Specialize infinite-type "insert some indirection" suggestion for Option Suggest `Option<Box<_>>` instead of `Box<Option<_>>` for infinitely-recursive members of a struct. Not sure if I can get the span of the generic subty of the Option so I can make this a `+++`-style suggestion. The current output is a tiny bit less fancy looking than the original suggestion. Should I limit the specialization to just `Option<Box<TheOuterStruct>>`? Because right now it applies to all `Option` members in the struct that are returned by `Representability::SelfRecursive`. Fixes #91402 r? `@estebank` (since you wrote the original suggestion and are definitely most familiar with it!)
2022-03-31address comments, add test for shadowed Box typeMichael Goulet-0/+29
2022-03-31Specialize suggestion for Option<T>Michael Goulet-28/+131
2022-03-31Rollup merge of #95478 - InfRandomness:infrandomness/lint_largemove_note, ↵Dylan DPC-0/+14
r=compiler-errors Add note to the move size diagnostic context: https://github.com/rust-lang/rust/issues/83518
2022-03-31Rollup merge of #95470 - GuillaumeGomez:fix-gui-spurious-test, r=notriddleDylan DPC-2/+1
Fix last rustdoc-gui spurious test This should the last spurious failing GUI test from https://github.com/rust-lang/rust/issues/93784. r? ``@notriddle``
2022-03-31Rollup merge of #95471 - oli-obk:tait_ice, r=estebankDylan DPC-0/+24
Don't ICE when opaque types get their hidden type constrained again. Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them. Fixes #89312 (for real this time)
2022-03-31Rollup merge of #95263 - compiler-errors:async-block-pretty, r=jackh726Dylan DPC-16/+16
Restore `impl Future<Output = Type>` to async blocks I was sad when I undid some of the code I wrote in #91096 in the PR #95225, so I fixed it here to not print `[async output]`. This PR "manually" normalizes the associated type `<[generator] as Generator>::Return` type which appears very frequently in `impl Future` types that result from async block desugaring.
2022-03-30Restore `impl Future<Output = Type>` to async blocksMichael Goulet-16/+16
2022-03-31Rollup merge of #95011 - michaelwoerister:awaitee_field, r=tmandryDylan DPC-0/+23
async: Give predictable name to binding generated from .await expressions. This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns. This will be useful for async stack traces, as discussed in https://internals.rust-lang.org/t/async-debugging-logical-stack-traces-setting-goals-collecting-examples/15547. I don't know if this needs some discussion by ````@rust-lang/compiler,```` e.g. about the name of the binding (`__awaitee`) or about the fact that this PR introduces a (soft) guarantee about a compiler generated name. Although, regarding the later, I think the same reasoning applies here as it does for debuginfo in general. r? ````@tmandry````
2022-03-31Rollup merge of #94869 - jackh726:gats_extended, r=compiler-errorsDylan DPC-0/+138
Add the generic_associated_types_extended feature Right now, this only ignore obligations that reference new placeholders in `poly_project_and_unify_type`. In the future, this might do other things, like allowing object-safe GATs. **This feature is *incomplete* and quite likely unsound. This is mostly just for testing out potential future APIs using a "relaxed" set of rules until we figure out *proper* rules.** Also drive by cleanup of adding a `ProjectAndUnifyResult` enum instead of using a `Result<Result<Option>>`. r? `@nikomatsakis`
2022-03-31Rollup merge of #93901 - petrochenkov:linkmod, r=wesleywiserDylan DPC-56/+59
Stabilize native library modifier syntax and the `whole-archive` modifier specifically Stabilization report: https://github.com/rust-lang/rust/pull/93901#issuecomment-1041325522 cc https://github.com/rust-lang/rust/issues/81490
2022-03-30Add the generic_associated_types_extended featureJack Huey-0/+138
2022-03-30Stabilize native library modifier syntax and the `whole-archive` modifier ↵Vadim Petrochenkov-56/+59
specifically
2022-03-30Auto merge of #95425 - nnethercote:yet-more-parse_tt-improvements, ↵bors-2/+3
r=petrochenkov Yet more `parse_tt` improvements Including lots of comment improvements, and an overhaul of how `matches` work that gives big speedups. r? `@petrochenkov`
2022-03-30Add note to the lint diagnosticInfRandomness-0/+14
2022-03-30Don't ICE when opaque types get their hidden type constrained again.Oli Scherer-0/+24
Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them.
2022-03-30Fix last rustdoc-gui spurious testGuillaume Gomez-2/+1
2022-03-30Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-sebors-134/+60
allow arbitrary inherent impls for builtin types in core Part of https://github.com/rust-lang/compiler-team/issues/487. Slightly adjusted after some talks with `@m-ou-se` about the requirements of `t-libs-api`. This adds a crate attribute `#![rustc_coherence_is_core]` which allows arbitrary impls for builtin types in core. For other library crates impls for builtin types should be avoided if possible. We do have to allow the existing stable impls however. To prevent us from accidentally adding more of these in the future, there is a second attribute `#[rustc_allow_incoherent_impl]` which has to be added to **all impl items**. This only supports impls for builtin types but can easily be extended to additional types in a future PR. This implementation does not check for overlaps in these impls. Perfectly checking that requires us to check the coherence of these incoherent impls in every crate, as two distinct dependencies may add overlapping methods. It should be easy enough to detect if it goes wrong and the attribute is only intended for use inside of std. The first two commits are mostly unrelated cleanups.
2022-03-30rework error messages for incorrect inherent implslcnr-5/+36
2022-03-30fix rustdoc wrt builtin impls switchlcnr-12/+11
2022-03-30fix behavior for empty implslcnr-4/+4
2022-03-30update rustdoclcnr-2/+1
2022-03-30update ui testslcnr-126/+23
2022-03-30async: Give predictable, reserved name to binding generated from .await ↵Michael Woerister-0/+23
expressions. This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns.
2022-03-30Auto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPCbors-1/+1
Rollup of 5 pull requests Successful merges: - #95294 (Document Linux kernel handoff in std::io::copy and std::fs::copy) - #95443 (Clarify how `src/tools/x` searches for python) - #95452 (fix since field version for termination stabilization) - #95460 (Spellchecking compiler code) - #95461 (Spellchecking some comments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-30Rollup merge of #95461 - nyurik:spelling, r=lcnrDylan DPC-1/+1
Spellchecking some comments This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30Auto merge of #94081 - oli-obk:lazy_tait_take_two, r=nikomatsakisbors-1552/+3876
Lazy type-alias-impl-trait take two ### user visible change 1: RPIT inference from recursive call sites Lazy TAIT has an insta-stable change. The following snippet now compiles, because opaque types can now have their hidden type set from wherever the opaque type is mentioned. ```rust fn bar(b: bool) -> impl std::fmt::Debug { if b { return 42 } let x: u32 = bar(false); // this errors on stable 99 } ``` The return type of `bar` stays opaque, you can't do `bar(false) + 42`, you need to actually mention the hidden type. ### user visible change 2: divergence between RPIT and TAIT in return statements Note that `return` statements and the trailing return expression are special with RPIT (but not TAIT). So ```rust #![feature(type_alias_impl_trait)] type Foo = impl std::fmt::Debug; fn foo(b: bool) -> Foo { if b { return vec![42]; } std::iter::empty().collect() //~ ERROR `Foo` cannot be built from an iterator } fn bar(b: bool) -> impl std::fmt::Debug { if b { return vec![42] } std::iter::empty().collect() // Works, magic (accidentally stabilized, not intended) } ``` But when we are working with the return value of a recursive call, the behavior of RPIT and TAIT is the same: ```rust type Foo = impl std::fmt::Debug; fn foo(b: bool) -> Foo { if b { return vec![]; } let mut x = foo(false); x = std::iter::empty().collect(); //~ ERROR `Foo` cannot be built from an iterator vec![] } fn bar(b: bool) -> impl std::fmt::Debug { if b { return vec![]; } let mut x = bar(false); x = std::iter::empty().collect(); //~ ERROR `impl Debug` cannot be built from an iterator vec![] } ``` ### user visible change 3: TAIT does not merge types across branches In contrast to RPIT, TAIT does not merge types across branches, so the following does not compile. ```rust type Foo = impl std::fmt::Debug; fn foo(b: bool) -> Foo { if b { vec![42_i32] } else { std::iter::empty().collect() //~^ ERROR `Foo` cannot be built from an iterator over elements of type `_` } } ``` It is easy to support, but we should make an explicit decision to include the additional complexity in the implementation (it's not much, see a721052457cf513487fb4266e3ade65c29b272d2 which needs to be reverted to enable this). ### PR formalities previous attempt: #92007 This PR also includes #92306 and #93783, as they were reverted along with #92007 in #93893 fixes #93411 fixes #88236 fixes #89312 fixes #87340 fixes #86800 fixes #86719 fixes #84073 fixes #83919 fixes #82139 fixes #77987 fixes #74282 fixes #67830 fixes #62742 fixes #54895
2022-03-30Clarify comments about doc comments in macros.Nicholas Nethercote-2/+3
2022-03-29Rollup merge of #95437 - notriddle:notriddle/issue-79076, r=compiler-errorsDylan DPC-0/+61
diagnostics: regression test for derive bounds Closes #79076
2022-03-29Rollup merge of #95386 - compiler-errors:try-wrapping, r=oli-obkDylan DPC-1/+171
Suggest wrapping patterns in enum variants Structured suggestion to wrap a pattern in a single-field enum or struct: ```diff struct A; enum B { A(A), } fn main(b: B) { match b { - A => {} + B::A(A) => {} } } ``` Half of #94942, the other half I'm not exactly sure how to fix. Also includes two drive-by changes (that I am open to splitting out into another PR, but thought they could be rolled up into this one): - 07776c111f07b887cd46b752870cd3fd76b2ba7c: Makes sure not to suggest wrapping if it doesn't have tuple field constructor (i.e. has named fields) - 8f2bbb18fd53e5008bb488302dbd354577698ede: Also suggest wrapping expressions in a tuple struct (not just enum variants)
2022-03-29Rollup merge of #93840 - ↵Dylan DPC-2/+0
yaahc:termination-stabilization-celebration-station, r=joshtriplett Stabilize Termination and ExitCode From https://github.com/rust-lang/rust/issues/43301 This PR stabilizes the Termination trait and associated ExitCode type. It also adjusts the ExitCode feature flag to replace the placeholder flag with a more permanent name, as well as splitting off the `to_i32` method behind its own permanently unstable feature flag. This PR stabilizes the termination trait with the following signature: ```rust pub trait Termination { fn report(self) -> ExitCode; } ``` The existing impls of `Termination` are effectively already stable due to the prior stabilization of `?` in main. This PR also stabilizes the following APIs on exit code ```rust #[derive(Clone, Copy, Debug)] pub struct ExitCode(_); impl ExitCode { pub const SUCCESS: ExitCode; pub const FAILURE: ExitCode; } impl From<u8> for ExitCode { /* ... */ } ``` --- All of the previous blockers have been resolved. The main ones that were resolved recently are: * The trait's name: We decided against changing this since none of the alternatives seemed particularly compelling. Instead we decided to end the bikeshedding and stick with the current name. ([link to the discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Termination.2FExit.20Status.20Stabilization/near/269793887)) * Issues around platform specific representations: We resolved this issue by changing the return type of `report` from `i32` to the opaque type `ExitCode`. That way we can change the underlying representation without affecting the API, letting us offer full support for platform specific exit code APIs in the future. * Custom exit codes: We resolved this by adding `From<u8> for ExitCode`. We choose to only support u8 initially because it is the least common denominator between the sets of exit codes supported by our current platforms. In the future we anticipate adding platform specific extension traits to ExitCode for constructors from larger or negative numbers, as needed.
2022-03-29Auto merge of #95433 - Dylan-DPC:rollup-xdfit9h, r=Dylan-DPCbors-0/+57
Rollup of 4 pull requests Successful merges: - #94566 (Show ignore message in console and json output) - #95415 (diagnostics: regression test for HashMap iter_mut suggestion) - #95422 (Refactor: Use `format-args-capture` and remove an unnecessary nested block) - #95424 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-29diagnostics: regression test for derive boundsMichael Howell-0/+61
Closes #79076
2022-03-29Auto merge of #94566 - yanganto:show-ignore-message, r=m-ou-sebors-8/+7
Show ignore message in console and json output - Provide ignore the message in console and JSON output - Modify the ignore message style in the log file related: #92714
2022-03-29Rollup merge of #95415 - notriddle:notriddle/issue-82081, r=Dylan-DPCDylan DPC-0/+57
diagnostics: regression test for HashMap iter_mut suggestion Closes #82081
2022-03-29Rollup merge of #94566 - yanganto:show-ignore-message, r=m-ou-seDylan DPC-8/+7
Show ignore message in console and json output - Provide ignore the message in console and JSON output - Modify the ignore message style in the log file related: #92714
2022-03-29Auto merge of #95096 - GuillaumeGomez:rm-header-fn-field, r=camelidbors-0/+12
Remove header field from clean::Function Fixes https://github.com/rust-lang/rust/issues/89673. This is another take on https://github.com/rust-lang/rust/issues/89673 (compared to https://github.com/rust-lang/rust/pull/91217) but very different on the approach: I moved the header call in one place but still require to have the `clean::Item` so I can use the `DefId` to get what is missing. cc `@jyn514` (you reviewed the original so maybe you want to take a look?) r? `@camelid`
2022-03-29Add test to ensure foreign functions from dependencies are correctly handledGuillaume Gomez-0/+12
2022-03-28Suggest function borrow ignoring needs_noteMichael Goulet-2/+47
`needs_note` is false if we've already suggested why the type is Copy... but that has nothing to do with the diagnostic.
2022-03-28Add suggestion to borrow opaque Fn and FnMut instead of moveMichael Goulet-3/+71
2022-03-28diagnostics: add regression test for #82081Michael Howell-0/+57
2022-03-28Rollup merge of #95328 - DrMeepster:box_gep_err, r=oli-obkDylan DPC-0/+22
Fix yet another Box<T, A> ICE Fixes #95036. This widens the special case from #94414 to make sure that boxes with a custom allocator are never directly dereferenced.
2022-03-28Rollup merge of #95318 - rust-lang:notriddle/issue-95208, r=wesleywiserDylan DPC-0/+64
diagnostics: correct generic bounds with doubled colon Fixes #95208
2022-03-28rebase falloutOli Scherer-1/+1
2022-03-28Add test for revealing auto traits in the defining scopeOli Scherer-0/+77
2022-03-28Add some tests showcasing further differences between TAIT and RPITOli Scherer-0/+42
2022-03-28Bless ui testsOli Scherer-1/+10
2022-03-28Also use the RPIT back compat hack in trait projectionOli Scherer-35/+5
2022-03-28Show that the behaviour is the same for RPIT and TAITOli Scherer-0/+230