about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-01-21Implement stable with negative coherence modeSantiago Pastorino-0/+26
2022-01-18Update cargoEric Huss-0/+0
2022-01-18Rollup merge of #92780 - b-naber:postpone-const-eval-coherence, r=lcnrMatthias Krüger-4/+40
Directly use ConstValue for single literals in blocks Addresses the minimal repro in https://github.com/rust-lang/rust/issues/92186, but doesn't fix the underlying problem (which would be solved by solving the anon subst problem afaict). I do, however, think that it makes sense in general to treat single literals in anon blocks as const values directly, especially in light of the problem that the issue refers to (anon const evaluation being postponed until infer variables in substs can be resolved, which was introduced by https://github.com/rust-lang/rust/pull/90023), i.e. while we do get warnings for those unnecessary braces, we should try to avoid errors caused by those braces if possible.
2022-01-18Rollup merge of #92692 - jsha:cool-sidebar, r=GuillaumeGomezMatthias Krüger-360/+228
Simplify and unify rustdoc sidebar styles Fixes #59860 This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise. I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler. Because the heading font sizes are bigger, increase the sidebar width slightly. As a very minor change, removed version from the "All types" page. It's now only on the crate page. struct - https://rustdoc.crud.net/jsha/cool-sidebar/std/vec/struct.Vec.html trait - https://rustdoc.crud.net/jsha/cool-sidebar/std/io/trait.Read.html crate - https://rustdoc.crud.net/jsha/cool-sidebar/std/index.html mod - https://rustdoc.crud.net/jsha/cool-sidebar/std/any/index.html macro - https://rustdoc.crud.net/jsha/cool-sidebar/std/macro.panic.html fn - https://rustdoc.crud.net/jsha/cool-sidebar/std/io/fn.stdin.html type alias - https://rustdoc.crud.net/jsha/cool-sidebar/std/io/type.Result.html keyword - https://rustdoc.crud.net/jsha/cool-sidebar/std/keyword.as.html primitive - https://rustdoc.crud.net/jsha/cool-sidebar/std/primitive.pointer.html r? `@GuillaumeGomez` cc `@camelid` [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/sidebar.20headings). Note: This has a lot of smaller commits, but I plan to squash them before merging.
2022-01-18Rollup merge of #92425 - calebzulawski:simd-cast, r=workingjubileeMatthias Krüger-0/+69
Improve SIMD casts * Allows `simd_cast` intrinsic to take `usize` and `isize` * Adds `simd_as` intrinsic, which is the same as `simd_cast` except for saturating float-to-int conversions (matching the behavior of `as`). cc `@workingjubilee`
2022-01-18Rollup merge of #91150 - dtolnay:qpath, r=davidtwcoMatthias Krüger-1/+13
Let qpath contain NtTy: `<$:ty as $:ty>::…` Example: ```rust macro_rules! m { (<$type:ty as $trait:ty>::$name:ident) => { <$type as $trait>::$name }; } fn main() { let _: m!(<str as ToOwned>::Owned); } ``` Previous behavior: ```console error: expected identifier, found `ToOwned` --> src/main.rs:3:19 | 3 | <$type as $trait>::$name | ^^^^^^ expected identifier ... 8 | let _: m!(<str as ToOwned>::Owned); | --------------------------- | | | this macro call doesn't expand to a type | in this macro invocation ``` The <code>expected identifier, found \`ToOwned\`</code> error is particularly silly. I think it should be fine to accept this code as long as $trait is of the form `TyKind::Path(None, path)`; if it is any other kind of `NtTy`, we'll keep the same behavior as before.
2022-01-18Rollup merge of #90782 - ricobbe:binutils-dlltool, r=michaelwoeristerMatthias Krüger-62/+90
Implement raw-dylib support for windows-gnu Add support for `#[link(kind = "raw-dylib")]` on windows-gnu targets. Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils `dlltool` utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of `@mati865's` earlier attempt at this strategy in PR #88801. (In particular, this attempt at this strategy adds support for `#[link_ordinal(...)]` as well.) In support of #58713.
2022-01-18Simplify and unify rustdoc sidebar stylesJacob Hoffman-Andrews-360/+228
This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise. I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler. Because the heading font sizes are bigger, increase the sidebar width slightly. As a very minor change, removed version from the "All types" page. It's now only on the crate page.
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-17add and update testsb-naber-4/+40
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
2022-01-17Rollup merge of #92799 - rust-lang:followup-from-92533, r=Aaron1011Matthias Krüger-7/+3
Remove some unnecessary uses of `FieldDef::ident` Followup from #92533. cc ``@Aaron1011`` ``@petrochenkov``