about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-01-18Update async-fn-nonsend.stderrEric Holk-29/+6
2022-01-18Handle more cases with conditionally initialized/dropped valuesEric Holk-2/+42
2022-01-18Basic loop supportEric Holk-1/+1
2022-01-18Support reinitialization of variablesEric Holk-22/+81
2022-01-18Support conditional dropsEric Holk-0/+22
This adds support for branching and merging control flow and uses this to correctly handle the case where a value is dropped in one branch of an if expression but not another. There are other cases we need to handle, which will come in follow up patches. Issue #57478
2022-01-18Attribute drop to parent expression of the consume pointEric Holk-8/+40
This is needed to handle cases like `[a, b.await, c]`. `ExprUseVisitor` considers `a` to be consumed when it is passed to the array, but the array is not quite live yet at that point. This means we were missing the `a` value across the await point. Attributing drops to the parent expression means we do not consider the value consumed until the consuming expression has finished. Issue #57478
2022-01-18Make generator and async-await tests passEric Holk-3/+2
The main change needed to make this work is to do a pessimistic over- approximation for AssignOps. The existing ScopeTree analysis in region.rs works by doing both left to right and right to left order and then choosing the most conservative ordering. This behavior is needed because AssignOp's evaluation order depends on whether it is a primitive type or an overloaded operator, which runs as a method call. This change mimics the same behavior as region.rs in generator_interior.rs. Issue #57478
2022-01-18Track drops across multiple yieldsEric Holk-0/+40
2022-01-18Track drop points in generator_interiorEric Holk-69/+7
This change adds the basic infrastructure for tracking drop ranges in generator interior analysis, which allows us to exclude dropped types from the generator type. Not yet complete, but many of the async/await and generator tests pass. The main missing piece is tracking branching control flow (e.g. around an `if` expression). The patch does include support, however, for multiple yields in th e same block. Issue #57478
2022-01-18Add test case for #57478Eric Holk-0/+14
2022-01-18Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obkbors-102/+304
allow eq constraints on associated constants Updates #70256 (cc `@varkor,` `@Centril)`
2022-01-18Auto merge of #93021 - matthiaskrgr:rollup-o7z8zoe, r=matthiaskrgrbors-240/+550
Rollup of 14 pull requests Successful merges: - #92629 (Pick themes on settings page, not every page) - #92640 (Fix ICEs related to `Deref<Target=[T; N]>` on newtypes) - #92701 (Add some more attribute validation) - #92803 (Hide mobile sidebar on some clicks) - #92830 (Rustdoc style cleanups) - #92866 ("Does exists" typos fix) - #92870 (add `rustc_diagnostic_item` attribute to `AtomicBool` type) - #92914 (htmldocck: Add support for `/text()` in ``@snapshot`)` - #92923 (Abstract the pretty printer's ringbuffer to be infinitely sized) - #92946 (Exclude llvm-libunwind from the self-contained set on s390x-musl targets) - #92947 (rustdoc: Use `intersperse` in a `visit_path` function) - #92997 (Add `~const` bound test for negative impls) - #93004 (update codegen test for LLVM 14) - #93016 (Stabilize vec_spare_capacity) Failed merges: - #92924 (Delete pretty printer tracing) r? `@ghost` `@rustbot` modify labels: rollup
2022-01-18Rollup merge of #93004 - krasimirgg:threadlocal-llvm-up, r=nikicMatthias Krüger-2/+2
update codegen test for LLVM 14 Fixes https://github.com/rust-lang/rust/issues/93003.
2022-01-18Rollup merge of #92997 - woppopo:test92114, r=Mark-SimulacrumMatthias Krüger-3/+23
Add `~const` bound test for negative impls Resolves #92114 which has been fixed in #92892.
2022-01-18Rollup merge of #92947 - vacuus:rustdoc-core-visit-path, r=camelidMatthias Krüger-3/+3
rustdoc: Use `intersperse` in a `visit_path` function (~~Is there a better way to word the title?~~ Eh, this works, I guess.) I'm surprised that the compiler didn't complain when I left out the `.to_string()`, but hey, if it works then it works.
2022-01-18Rollup merge of #92946 - kaniini:chore/llvm-libunwind-s390x, r=Mark-SimulacrumMatthias Krüger-2/+4
Exclude llvm-libunwind from the self-contained set on s390x-musl targets llvm-libunwind does not support s390x targets at present, so we cannot build it for s390x targets. Accordingly, remove it from the self-contained set.
2022-01-18Rollup merge of #92914 - camelid:snapshot-text, r=GuillaumeGomezMatthias Krüger-3/+11
htmldocck: Add support for `/text()` in `@snapshot` This allows just testing the text, in cases where the HTML tags don't matter. See https://github.com/rust-lang/rust/pull/92908#discussion_r785191758 for an example of when this would be useful. r? `@GuillaumeGomez`
2022-01-18Rollup merge of #92866 - maxwase:does_exist_typo, r=Mark-SimulacrumMatthias Krüger-3/+3
"Does exists" typos fix Fixed some typos
2022-01-18Rollup merge of #92830 - jsha:style-cleanups, r=GuillaumeGomezMatthias Krüger-41/+62
Rustdoc style cleanups - Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown Demo: https://rustdoc.crud.net/jsha/style-cleanups/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-18Rollup merge of #92803 - jsha:hide-sidebar, r=GuillaumeGomezMatthias Krüger-0/+12
Hide mobile sidebar on some clicks When the user clicks outside the sidebar, the sidebar should close. Also, when the user clicks an internal link in the sidebar, it should close. Fixes #92682 Demo: https://rustdoc.crud.net/jsha/hide-sidebar/std/string/struct.String.html
2022-01-18Rollup merge of #92701 - ehuss:even-more-attr-validation, r=matthewjasperMatthias Krüger-161/+327
Add some more attribute validation This adds some more validation for the position of attributes: * `link` is only valid on an `extern` block * `windows_subsystem` and `no_builtins` are only valid at the crate level
2022-01-18Rollup merge of #92640 - compiler-errors:array-deref-on-newtype, r=lcnrMatthias Krüger-0/+44
Fix ICEs related to `Deref<Target=[T; N]>` on newtypes 1. Stash a const infer's type into the canonical var during canonicalization, so we can recreate the fresh const infer with that same type. For example, given `[T; _]` we know `_` is a `usize`. If we go from infer => canonical => infer, we shouldn't forget that variable is a usize. Fixes #92626 Fixes #83704 2. Don't stash the autoderef'd slice type that we get from method lookup, but instead recreate it during method confirmation. We need to do this because the type we receive back after picking the method references a type variable that does not exist after probing is done. Fixes #92637 ... A better solution for the second issue would be to actually _properly_ implement `Deref` for `[T; N]` instead of fixing this autoderef hack to stop leaking inference variables. But I actually looked into this, and there are many complications with const impls.
2022-01-18Rollup merge of #92629 - jsha:theme-picker-local-only-2, r=GuillaumeGomezMatthias Krüger-22/+59
Pick themes on settings page, not every page This hides the paintbrush icon on most pages by default, in preference for the settings on the settings page. When loading from a local file, and not in mobile view, continue to show the theme picker. That's because some browsers limit access to localStorage from file:/// URLs, so choosing a theme from settings.html doesn't take effect. Fixes #84539 Part of #59840 r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/theme-picker-local-only-2/std/io/trait.Read.html
2022-01-18Auto merge of #93001 - flip1995:clippyup, r=Manishearthbors-100/+754
Out of cycle Clippy update I want to do an out-of-cycle sync for rust-lang/rust-clippy#8295, and possibly backport this to stable together with https://github.com/rust-lang/rust/issues/92938. If this doesn't get backported to stable, then I at least want to backport it to beta. r? `@Manishearth`
2022-01-17Add staged_api for testsJacob Hoffman-Andrews-0/+41
2022-01-17Update with final commentskadmin-24/+5
2022-01-17Hide mobile sidebar on some clicksJacob Hoffman-Andrews-0/+12
When the user clicks outside the sidebar, the sidebar should close. Also, when the user clicks an internal link in the sidebar, it should close.
2022-01-17Add term to ExistentialProjectionkadmin-11/+123
Also prevent ICE when adding a const in associated const equality.
2022-01-17Update w/ commentskadmin-5/+2
Removes uses of ty() where a method is implemented on TypeFoldable, and also directly formats a Term.
2022-01-17Update term for use in more placeskadmin-43/+128
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the future, but slightly worried it allows items which are consts which only accept types.
2022-01-17Rustdoc style cleanupsJacob Hoffman-Andrews-46/+21
- Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown.
2022-01-17Rollup merge of #92936 - vacuus:html-markdown-parse, r=GuillaumeGomezMatthias Krüger-3/+1
rustdoc: Remove `collect` in `html::markdown::parse`
2022-01-17Rollup merge of #92825 - pierwill:rustc-version-force-rename, r=Mark-SimulacrumMatthias Krüger-2/+2
Rename environment variable for overriding rustc version
2022-01-17Rollup merge of #92801 - jsha:overflow-wrap, r=GuillaumeGomezMatthias Krüger-0/+16
Enable wrapping words by default Faced with a very long word, browsers will let it overflow its box horizontally rather than break it in the middle. We essentially never want that behavior. We would rather break the word and keep it inside its horizontal limits. So we apply a default overflow-wrap: break-word/anywhere to the document as a while. In some contexts we would rather add a horizontal scrollbar (code blocks), or elide the excess text with an ellipsis (sidebar). Those still work as expected. Fixes #92771 [Some related discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/wrap.20.2F.20overflow.20.2F.20scroll) and a related issue: #92421. Demo: https://rustdoc.crud.net/jsha/overflow-wrap/std/iter/trait.Iterator.html#method.try_find r? ``@GuillaumeGomez``
2022-01-17Rollup merge of #92164 - WaffleLapkin:rustc_must_implement_one_of_attr, ↵Matthias Krüger-0/+256
r=Aaron1011 Implement `#[rustc_must_implement_one_of]` attribute This PR adds a new attribute — `#[rustc_must_implement_one_of]` that allows changing the "minimal complete definition" of a trait. It's similar to GHC's minimal `{-# MINIMAL #-}` pragma, though `#[rustc_must_implement_one_of]` is weaker atm. Such attribute was long wanted. It can be, for example, used in `Read` trait to make transitions to recently added `read_buf` easier: ```rust #[rustc_must_implement_one_of(read, read_buf)] pub trait Read { fn read(&mut self, buf: &mut [u8]) -> Result<usize> { let mut buf = ReadBuf::new(buf); self.read_buf(&mut buf)?; Ok(buf.filled_len()) } fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<()> { default_read_buf(|b| self.read(b), buf) } } impl Read for Ty0 {} //^ This will fail to compile even though all `Read` methods have default implementations // Both of these will compile just fine impl Read for Ty1 { fn read(&mut self, buf: &mut [u8]) -> Result<usize> { /* ... */ } } impl Read for Ty2 { fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<()> { /* ... */ } } ``` For now, this is implemented as an internal attribute to start experimenting on the design of this feature. In the future we may want to extend it: - Allow arbitrary requirements like `a | (b & c)` - Allow multiple requirements like - ```rust #[rustc_must_implement_one_of(a, b)] #[rustc_must_implement_one_of(c, d)] ``` - Make it appear in rustdoc documentation - Change the syntax? - Etc Eventually, we should make an RFC and make this (or rather similar) attribute public. --- I'm fairly new to compiler development and not at all sure if the implementation makes sense, but at least it passes tests :)
2022-01-17Rollup merge of #90498 - joshtriplett:target-tier-policy-draft-updates, ↵Matthias Krüger-16/+80
r=Mark-Simulacrum Clarifications in the target tier policy We've added several targets since the introduction of the target tier policy. Based on experiences of those adding such targets, and discussions around such additions, clarify the target tier policy to make it easier to follow and work with. None of these changes substantively change the requirements on targets. (In some cases the changes do direct target submitters to follow specific process requirements for the addition of a target, such as how to respond to requirements, where to put target-specific documentation, or what should appear in that documentation. Those changes are procedural in nature and document the procedures we already direct people to follow.) - Clarify how to quote and respond to the target tier policy requirements. Several times, people have seemed unclear on how to respond to some of the policy requirements, particularly those that just state things the target developers must *not* do (e.g. not posting to PRs that break the target). Add a note that such requirements just need acknowledgement, nothing more. - Clarify dependency requirements in the face of cross-compilation. I previously phrased this confusingly in terms of "host tools", since that is the case where an exception applies (allowing proprietary target libraries commonly used by binaries for the target). Rephrase it to apply equally to cross-compilation. This doesn't change the net effect of the requirements, since other requirements already cover the dependencies of the Rust toolchain. - Clarify documentation about running binaries. The requirement for target documentation talks about "running tests", but tier 3 targets often don't support running the full testsuite, and in practice the documentation for how to run an individual binary may be more useful. Change "running tests" to "running binaries, or running tests". - Explain where to place target-specific documentation (a subdirectory of platform-support, with a link from the platform-support entry for the target). - Add a template for target-specific documentation.
2022-01-17Use Term in ProjectionPredicatekadmin-73/+74
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2022-01-17Add termkadmin-8/+17
Instead of having a separate enum variant for types and consts have one but have either a const or type.
2022-01-17add eq constraints on associated constantskadmin-11/+28
2022-01-17update test assertionKrasimir Georgiev-2/+2
2022-01-17update codegen test for LLVM 14Krasimir Georgiev-2/+2
Fixes https://github.com/rust-lang/rust/issues/93003.
2022-01-17Auto merge of #90986 - camsteffen:nested-filter, r=cjgillotbors-450/+148
Replace `NestedVisitorMap` with generic `NestedFilter` This is an attempt to make the `intravisit::Visitor` API simpler and "more const" with regard to nested visiting. With this change, `intravisit::Visitor` does not visit nested things by default, unless you specify `type NestedFilter = nested_filter::OnlyBodies` (or `All`). `nested_visit_map` returns `Self::Map` instead of `NestedVisitorMap<Self::Map>`. It panics by default (unreachable if `type NestedFilter` is omitted). One somewhat trixty thing here is that `nested_filter::{OnlyBodies, All}` live in `rustc_middle` so that they may have `type Map = map::Map` and so that `impl Visitor`s never need to specify `type Map` - it has a default of `Self::NestedFilter::Map`.
2022-01-17Merge commit '8d14c94b5c0a66241b4244f1c60ac5859cec1d97' into clippyupflip1995-100/+754
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-2081/+171
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-17Add `~const` bound test for negative implswoppopo-3/+23
2022-01-17Auto merge of #92996 - matthiaskrgr:rollup-50wpzva, r=matthiaskrgrbors-106/+181
Rollup of 10 pull requests Successful merges: - #92795 (Link sidebar "location" heading to top of page) - #92799 (Remove some unnecessary uses of `FieldDef::ident`) - #92808 (Fix `try wrapping expression in variant` suggestion with struct field shorthand) - #92819 (rustdoc: remove hand-rolled isatty) - #92876 (Fix suggesting turbofish with lifetime arguments) - #92921 (Rename Printer constructor from mk_printer() to Printer::new()) - #92937 (rustdoc: Add missing dot separator) - #92953 (Copy an example to PartialOrd as well) - #92977 (Docs: recommend VecDeque instead of Vec::remove(0)) - #92981 (fix const_ptr_offset_from tracking issue) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-17Rollup merge of #92937 - GuillaumeGomez:dot-separator, r=jshaMatthias Krüger-3/+38
rustdoc: Add missing dot separator Fixes #92901. ![Screenshot from 2022-01-15 17-47-18](https://user-images.githubusercontent.com/3050060/149631249-e2c0c3a4-9ed8-48e2-92cc-79a5bb347b35.png) r? ``@jsha``
2022-01-17Rollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, ↵Matthias Krüger-44/+85
r=nagisa Fix suggesting turbofish with lifetime arguments Now we suggest turbofish correctly given exprs like `foo<'_>`. Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.
2022-01-17Rollup merge of #92819 - euclio:atty, r=CraftSpiderMatthias Krüger-41/+16
rustdoc: remove hand-rolled isatty This PR replaces bindings to the platform-specific isatty APIs with the `isatty` crate, as done elsewhere in the repository.
2022-01-17Rollup merge of #92808 - ↵Matthias Krüger-10/+31
compiler-errors:wrap-struct-shorthand-field-in-variant, r=davidtwco Fix `try wrapping expression in variant` suggestion with struct field shorthand Fixes a broken suggestion: [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=83fe2dbfe1485f8cfca1aef2a6582e77) before: ``` error[E0308]: mismatched types --> src/main.rs:7:19 | 7 | let x = Foo { bar }; | ^^^ expected enum `Option`, found integer | = note: expected enum `Option<i32>` found type `{integer}` help: try wrapping the expression in `Some` | 7 | let x = Foo { Some(bar) }; | +++++ + ``` after: ``` error[E0308]: mismatched types --> src/main.rs:7:19 | 7 | let x = Foo { bar }; | ^^^ expected enum `Option`, found integer | = note: expected enum `Option<i32>` found type `{integer}` help: try wrapping the expression in `Some` | 7 | let x = Foo { bar: Some(bar) }; | ~~~~~~~~~~~~~~ ``` r? ``@m-ou-se`` since you touched the code last in #91080