about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-07-27Rollup merge of #99812 - GuillaumeGomez:fix-headings-colors, r=jsha,notriddleGuillaume Gomez-11/+105
Fix headings colors Fixes #99797. ![image](https://user-images.githubusercontent.com/3050060/181260966-49faf9d3-f6b8-4de4-bc7d-ed9f0467cf68.png) cc `@jsha` r? `@notriddle`
2022-07-27Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkovGuillaume Gomez-3/+27
Clean up HIR-based lifetime resolution Based on https://github.com/rust-lang/rust/pull/97313. Fixes #98932. r? `@petrochenkov`
2022-07-27Rollup merge of #99710 - davidtwco:internal-lint-opts, r=lcnrGuillaume Gomez-1/+45
lint: add bad opt access internal lint Prompted by [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/sess.2Ecrate_types.28.29.20vs.20sess.2Eopts.2Ecrate_types/near/290682847). Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`. Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted. A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too. **Leave a comment if there's an option I should add this to.**
2022-07-27Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, ↵Guillaume Gomez-17/+71
r=oli-obk Deeply deny fn and raw ptrs in const generics I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter. We now reject both of these in the same way: ``` #![feature(adt_const_params)] #[derive(Eq, PartialEq)] struct Wrapper(); fn foo<const W: Wrapper>() {} fn foo2<const F: fn()>() {} ``` This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place. cc: ``@b-naber`` who introduced that test^ fixes #99641
2022-07-27Rollup merge of #99358 - compiler-errors:issue-99325, r=oli-obkGuillaume Gomez-0/+307
Allow `ValTree::try_to_raw_bytes` on `u8` array Fixes #99325 cc `@b-naber` I think who touched this last in 705d818bd52a6324d5e7693cc4306457395eebc8
2022-07-27Add GUI tests for headings border and text colorGuillaume Gomez-5/+103
2022-07-27Fix headings borderGuillaume Gomez-5/+1
2022-07-27Fix invalid css property valueGuillaume Gomez-1/+1
2022-07-27lint: add bad opt access internal lintDavid Wood-0/+44
Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`. Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted. A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-27session: disable internal lints for rustdocDavid Wood-1/+1
If an internal lint uses `typeck_results` or similar queries then that can result in rustdoc checking code that it shouldn't (e.g. from other platforms) and emit compilation errors. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-27Rollup merge of #99783 - notriddle:notriddle/clean-trait-removal, ↵Yuki Okushi-58/+61
r=GuillaumeGomez rustdoc: remove Clean trait impls for more items Follow up to #99638 and #99672
2022-07-27Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obkYuki Okushi-194/+164
Add `Self: ~const Trait` to traits with `#[const_trait]` r? `@oli-obk`
2022-07-27Rollup merge of #99079 - compiler-errors:issue-99073, r=oli-obkYuki Okushi-21/+20
Check that RPITs constrained by a recursive call in a closure are compatible Fixes #99073 Adapts a similar visitor pattern to `find_opaque_ty_constraints` (that we use to check TAITs), but with some changes: 0. Only walk the "OnlyBody" children, instead of all items in the RPIT's defining scope 1. Only walk through the body's children if we found a constraining usage 2. Don't actually do any inference, just do a comparison and error if they're mismatched ---- r? `@oli-obk` -- you know all this impl-trait stuff best... is this the right approach? I can explain the underlying issue better if you'd like, in case that might reveal a better solution. Not sure if it's possible to gather up the closure's defining usages of the RPIT while borrowck'ing the outer function, that might be a better place to put this check...
2022-07-27Auto merge of #99778 - ehuss:update-cargo, r=ehussbors-0/+0
Update cargo 5 commits in d8d30a75376f78bb0fabe3d28ee9d87aa8035309..85b500ccad8cd0b63995fd94a03ddd4b83f7905b 2022-07-19 13:59:17 +0000 to 2022-07-24 21:10:46 +0000 - Make the empty rustc-wrapper test more explicit. (rust-lang/cargo#10899) - expand RUSTC_WRAPPER docs (rust-lang/cargo#10896) - Stabilize Workspace Inheritance (rust-lang/cargo#10859) - Fix typo in unstable docs: s/PROGJCT/PROJECT/ (rust-lang/cargo#10890) - refactor(source): Open query API for adding more types of queries (rust-lang/cargo#10883)
2022-07-27Rollup merge of #99775 - notriddle:notriddle/as-str, r=camelidYuki Okushi-2/+2
rustdoc: do not allocate String when writing path full name No idea if this makes any perf difference, but it just seems like premature pessimisation to use String when str will do.
2022-07-27Rollup merge of #99771 - GuillaumeGomez:update-pulldown-cmark, r=UrgauYuki Okushi-1/+1
Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars) Fixes https://github.com/rust-lang/rust/issues/97125. r? ``@Dylan-DPC``
2022-07-27Rollup merge of #99765 - nicholasbishop:bishop-disable-uefi-std-build, r=jyn514Yuki Okushi-1/+5
Don't build std for *-uefi targets https://github.com/rust-lang/rust/issues/97322
2022-07-27Rollup merge of #99712 - davidtwco:translation-migrate-passes-2, ↵Yuki Okushi-10/+10
r=compiler-errors passes: port more of `check_attr` module Continues from #99213. Port more diagnostics in `rustc_passes::check_attr` to using the diagnostic derive and translation machinery. r? `@compiler-errors`
2022-07-27Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomezYuki Okushi-1/+7
Add a clickable link to the layout section The layout section (activated by `--show-type-layout`) is currently not linkable to (outside of chrome's link to text feature). This PR makes it linkable via `#layout`.
2022-07-27Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillotYuki Okushi-0/+69
Prefer visibility map parents that are not `doc(hidden)` first Far simpler approach to #98876. This only fixes the case where the parent is `doc(hidden)`, not where the child is `doc(hidden)` since I don't know how to get the attrs on the import statement given a `ModChild`... I'll try to follow up with that, but this is a good first step.
2022-07-26rustdoc: remove Clean trait impl for ty::PolyTraitPredicateMichael Howell-16/+19
2022-07-26rustdoc: remove Clean trait impls for ty::OutlivesPredicateMichael Howell-29/+27
2022-07-26rustdoc: remove Clean trait impl for ProjectionPredicateMichael Howell-8/+9
2022-07-26rustdoc: remove Clean trait impl for ProjectionTyMichael Howell-9/+10
2022-07-26Update cargoEric Huss-0/+0
2022-07-26Auto merge of #99574 - durin42:allocator-patch-redux, r=nikicbors-0/+183
codegen: use new {re,de,}allocator annotations in llvm This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. r? `@nikic`
2022-07-26rustdoc: do not allocate String when writing path full nameMichael Howell-2/+2
No idea if this makes any perf difference, but it just seems like premature pessimisation to use String when str will do.
2022-07-26Update pulldown-cmark versionGuillaume Gomez-1/+1
2022-07-26Clippy fallout.Camille GILLOT-1/+1
2022-07-26Check that we do not ICE when anonymous lifetimes appear in AnonConst.Camille GILLOT-0/+24
Fixes #98932.
2022-07-26Replace LifetimeRes::Anonymous by LifetimeRes::Infer.Camille GILLOT-2/+2
2022-07-26Auto merge of #99764 - matthiaskrgr:rollup-fawyb3m, r=matthiaskrgrbors-14/+34
Rollup of 6 pull requests Successful merges: - #99235 (rustdoc: Add support for `#[rustc_must_implement_one_of]`) - #99716 (remove useless mut from examples) - #99724 (Fix some broken link fragments.) - #99729 (Remove unused tuple fields) - #99757 (Make `transmute_copy` docs read better) - #99758 (remove useless `#[allow]` in a test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-26Don't build std for *-uefi targetsNicholas Bishop-1/+5
https://github.com/rust-lang/rust/issues/97322
2022-07-26Rollup merge of #99758 - WaffleLapkin:remove_useless_allow, r=Dylan-DPCMatthias Krüger-1/+0
remove useless `#[allow]` in a test The mentioned issue, https://github.com/rust-lang/rust/issues/54586 was fixed 4 years ago :)
2022-07-26Rollup merge of #99724 - ehuss:fix-broken-links-fragment, r=Dylan-DPCMatthias Krüger-7/+2
Fix some broken link fragments. An exception for link fragments starting with `-` was added in #49590. However, it is not clear what issues were encountered at the time. Perhaps those were fixed in the meantime. This removes the exception, and fixes a couple of broken links that were skipped due to it.
2022-07-26Rollup merge of #99235 - ↵Matthias Krüger-6/+32
WaffleLapkin:rustdoc_implement_support_for_must_implement, r=GuillaumeGomez rustdoc: Add support for `#[rustc_must_implement_one_of]` This PR adds support for `#[rustc_must_implement_one_of]` attribute added in #92164. There is a desire to eventually use this attribute of `Read`, so making it show up in docs is a good thing. I "stole" the styling from cfg notes, not sure what would be a proper styling. Currently it looks like this: ![2022-07-14_15-00](https://user-images.githubusercontent.com/38225716/178968170-913c1dd5-8875-4a95-9848-b075a0bb8998.png) <details><summary>Code to reproduce</summary> <p> ```rust #![feature(rustc_attrs)] #[rustc_must_implement_one_of(a, b)] pub trait Trait { fn req(); fn a(){ Self::b() } fn b(){ Self::a() } } ``` </p> </details>
2022-07-26Fix diagnostics for unfulfilled obligationsDeadbeef-19/+1
2022-07-26bless tests, remove nonexistent E0395Deadbeef-194/+182
2022-07-26codegen: use new {re,de,}allocator annotations in llvmAugie Fackler-0/+183
This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. While we're here, we also emit allocator attributes on __rust_alloc_zeroed. This should allow LLVM to perform more optimizations for zeroed blocks, and probably fixes #90032. [This comment](https://github.com/rust-lang/rust/issues/24194#issuecomment-308791157) mentions "weird UB-like behaviour with bitvec iterators in rustc_data_structures" so we may need to back this change out if things go wrong. The new test cases require LLVM 15, so we copy them into LLVM 14-supporting versions, which we can delete when we drop LLVM 14.
2022-07-26Auto merge of #99680 - workingjubilee:revert-revert-icf, r=Mark-Simulacrumbors-1/+12
Revert "Revert "Use ICF (identical code folding) for building rustc"" This reverts commit rust-lang/rust@45575d23f316af7476ccd0a895234ac59c47a6be, thereby enabling identical code folding again. Closes #99440 (again).
2022-07-26Simplify testest31-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-07-26remove useless `#[allow]` in a testMaybe Waffle-1/+0
2022-07-26Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-deadDylan DPC-24/+24
Use full type name instead of just saying `impl Trait` in "captures lifetime" error I think this is very useful, especially when there's >1 `impl Trait`, and it just means passing around a bit more info that we already have access to.
2022-07-26Rollup merge of #99739 - nnethercote:rm-E0133, r=Dylan-DPCDylan DPC-8/+8
Remove erroneous E0133 code from an error message. This error message is about `derive` and `packed`, but E0133 is for "Unsafe code was used outside of an unsafe function or block". r? ``@estebank``
2022-07-26Rollup merge of #99692 - RalfJung:too-far, r=oli-obkDylan DPC-22/+103
interpret, ptr_offset_from: refactor and test too-far-apart check We didn't have any tests for the "too far apart" message, and indeed that check mostly relied on the in-bounds check and was otherwise probably not entirely correct... so I rewrote that check, and it is before the in-bounds check so we can test it separately.
2022-07-26Rollup merge of #99666 - compiler-errors:issue-99663, r=lcnrDylan DPC-1/+45
Restore `Opaque` behavior to coherence check Fixes #99663. This broke in 84c3fcd2a0285c06a682c9b064640084e4c7271b. I'm not exactly certain that adding this behavior back is necessarily correct, but at least the UI test I provided may stimulate some thoughts. I think delaying a bug here is certainly not correct in the case of opaques -- if we want to change coherence behavior for opaques, then we should at least be emitting a new error. r? ``@lcnr``
2022-07-26Rollup merge of #99618 - compiler-errors:uhh-idk, r=lcnrDylan DPC-43/+2
handle consts with param/infer in `const_eval_resolve` better This PR addresses [this thread here](https://github.com/rust-lang/rust/pull/99449#discussion_r924141230). Was this the change you were looking for ``@lcnr?`` Interestingly, one test has begun to pass. Was that expected? r? ``@lcnr``
2022-07-26Check that RPITs constrained by a recursive call in a closure are compatibleMichael Goulet-21/+20
2022-07-26Allow try_to_raw_bytes on u8 arrayMichael Goulet-0/+307
2022-07-26Use real opaque type instead of just saying impl TraitMichael Goulet-24/+24