about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-02-20Use named arguments for `int_impl` macroNilstrieb-39/+182
This makes it easier to understand.
2023-02-20Use named arguments for `uint_impl` macroNilstrieb-39/+174
This makes it easier to understand.
2023-02-20Auto merge of #107721 - megakorre:issue_105700, r=petrochenkovbors-0/+24
create dummy placeholder crate to prevent compiler from panicing This PR is to address the panic found in https://github.com/rust-lang/rust/issues/105700. There are 2 separate things going on with this panic. First the code could not generate a dummy response for crate fragment types when it hits the recursion limit. This PR adds the method to the trait implementation for `DymmyResult` to be able to create a dummy crate node. This stops the panic from happening. The second thing that is not addressed (and maybe does not need addressing? 🤷🏻) is that when you have multiple attributes it ends up treating attributes that follow another as being the result of expanding the former (maybe there is a better way to say that). So you end up hitting the recursion limit. Even though you would think there is no expansion happening here. If you did not hit the recursion limit the compiler would output that `invalid_attribute` does not exists. But it currently exits before the resolution step when the recursion limit is reached here.
2023-02-20Auto merge of #107969 - b-naber:proj-relate-variance, r=lcnrbors-4/+159
Use covariance on type relations of field projection types if possible It's fine to use covariance here unless we're in a mutating context. Fixes https://github.com/rust-lang/rust/issues/96514 Supersedes https://github.com/rust-lang/rust/pull/105958 r? `@lcnr`
2023-02-20create dummy placeholder crate to prevent compilerPatrik Kårlin-0/+24
2023-02-20Auto merge of #106316 - camelid:rustdoc-all-only-stable, r=GuillaumeGomezbors-20/+45
Only include stable lints in `rustdoc::all` group Fixes #106289. Including unstable lints in the lint group produces unintuitive behavior on stable (see #106289). Meanwhile, if we only included unstable lints on nightly and not on stable, we could end up with confusing bugs that were hard to compare across versions of Rust that lacked code changes. I think that only including stable lints in `rustdoc::all`, no matter the release channel, is the most intuitive option. Users can then control unstable lints individually, which is reasonable since they have to enable the feature gates individually anyway. r? `@GuillaumeGomez`
2023-02-19Only include stable lints in `rustdoc::all` groupNoah Lev-20/+45
Including unstable lints in the lint group produces unintuitive behavior on stable (see #106289). Meanwhile, if we only included unstable lints on nightly and not on stable, we could end up with confusing bugs that were hard to compare across versions of Rust that lacked code changes. I think that only including stable lints in `rustdoc::all`, no matter the release channel, is the most intuitive option. Users can then control unstable lints individually, which is reasonable since they have to enable the feature gates individually anyway.
2023-02-20Auto merge of #108235 - tmiasko:read-buf, r=the8472bors-0/+4
Use custom implementation of read_buf in Read for &'a FileDesc This allows to skip an unnecessary buffer initialization. Fixes #108223.
2023-02-20Auto merge of #105961 - fmease:iat-type-directed-probing, r=jackh726bors-84/+946
Type-directed probing for inherent associated types When probing for inherent associated types (IATs), equate the Self-type found in the projection with the Self-type of the relevant inherent impl blocks and check if all predicates are satisfied. Previously, we didn't look at the Self-type or at the bounds and just picked the first inherent impl block containing an associated type with the name we were searching for which is obviously incorrect. Regarding the implementation, I basically copied what we do during method probing (`assemble_inherent_impl_probe`, `consider_probe`). Unfortunately, I had to duplicate a lot of the diagnostic code found in `rustc_hir_typeck::method::suggest` which we don't have access to in `rustc_hir_analysis`. Not sure if there is a simple way to unify the error handling. Note that in the future, `rustc_hir_analysis::astconv` might not actually be the place where we resolve inherent associated types (see https://github.com/rust-lang/rust/pull/103621#issuecomment-1304309565) but `rustc_hir_typeck` (?) in which case the duplication may naturally just disappear. While inherent associated *constants* are currently resolved during "method" probing, I did not find a straightforward way to incorporate IAT lookup into it as types and values (functions & constants) are two separate entities for which distinct code paths are taken. Fixes #104251 (incl. https://github.com/rust-lang/rust/issues/104251#issuecomment-1338501171). Fixes #105305. Fixes #107468. `@rustbot` label T-types F-inherent_associated_types r? types
2023-02-19Add some FIXMEs for follow-up PRsLeón Orell Valerian Liehr-4/+9
2023-02-19Collect fulfillment errors across implsLeón Orell Valerian Liehr-2/+42
2023-02-19Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726bors-34/+60
Properly check for builtin derived code Fixes #108122
2023-02-19Auto merge of #107921 - cjgillot:codegen-overflow-check, r=tmiaskobors-217/+250
Make codegen choose whether to emit overflow checks ConstProp and DataflowConstProp currently have a specific code path not to propagate constants when they overflow. This is meant to have the correct behaviour when inlining from a crate with overflow checks (like `core`) into a crate compiled without. This PR shifts the behaviour change to the `Assert(Overflow*)` MIR terminators: if the crate is compiled without overflow checks, just skip emitting the assertions. This is already what happens with `OverflowNeg`. This allows ConstProp and DataflowConstProp to transform `CheckedBinaryOp(Add, u8::MAX, 1)` into `const (0, true)`, and let codegen ignore the `true`. The interpreter is modified to conform to this behaviour. Fixes #35310
2023-02-19Deduplicate fresh_item_substsLeón Orell Valerian Liehr-60/+35
2023-02-19Add a test and several known bugsLeón Orell Valerian Liehr-0/+127
2023-02-19Fix substitution bugLeón Orell Valerian Liehr-19/+67
2023-02-19Use InferCtxt::probe to properly detect ambiguous candidatesLeón Orell Valerian Liehr-21/+62
2023-02-19Switch from for-loop to filter_mapLeón Orell Valerian Liehr-27/+26
2023-02-19Groundwork for detecting ambiguous candidatesLeón Orell Valerian Liehr-2/+85
NB: Since we are using the same InferCtxt in each iteration, we essentially *spoil* the inference variables and we only ever get at most *one* applicable candidate (only the 1st candidate has clean variables that can still unify correctly).
2023-02-19Make use of ObligationCtxtLeón Orell Valerian Liehr-54/+33
2023-02-19Use the correct ParamEnvLeón Orell Valerian Liehr-3/+41
2023-02-19Type-directed probing for inherent associated typesLeón Orell Valerian Liehr-54/+581
2023-02-19Auto merge of #108237 - GuillaumeGomez:rollup-olxq5dt, r=GuillaumeGomezbors-91/+294
Rollup of 5 pull requests Successful merges: - #107766 (Fix json reexports of different items with same name) - #108129 (Correctly handle links starting with whitespace) - #108188 (Change src/etc/vscode_settings.json to always treat ./library as the sysroot source) - #108203 (Fix RPITITs in default trait methods (by assuming projection predicates in param-env)) - #108212 (Download rustfmt regardless of rustc being set in config.toml) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-19Rollup merge of #108212 - KittyBorgX:master, r=jyn514Guillaume Gomez-9/+0
Download rustfmt regardless of rustc being set in config.toml Fixes #81155 cc : https://github.com/rust-lang/rust/issues/108210 for exact error details
2023-02-19Rollup merge of #108203 - compiler-errors:rpitit-fix-defaults-2, r=jackh726Guillaume Gomez-37/+161
Fix RPITITs in default trait methods (by assuming projection predicates in param-env) Instead of having special projection logic that allows us to turn `ProjectionTy(RPITIT, [Self#0, ...])` into `OpaqueTy(RPITIT, [Self#0, ...])`, we can instead augment the param-env of default trait method bodies to assume these as projection predicates. This should allow us to only project where we're allowed to! In order to make this work without introducing a bunch of cycle errors, we additionally tweak the `OpaqueTypeExpander` used by `ParamEnv::with_reveal_all_normalized` to not normalize the right-hand side of projection predicates. This should be fine, because if we use the projection predicate to normalize some other projection type, we'll continue to normalize the opaque that it gets projected to. This also makes it possible to support default trait methods with RPITITs in an associated-type based RPITIT lowering strategy without too much extra effort. Fixes #107002 Alternative to #108142
2023-02-19Rollup merge of #108188 - jyn514:ra-sysroot, r=albertlarsan68Guillaume Gomez-2/+3
Change src/etc/vscode_settings.json to always treat ./library as the sysroot source See https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/False.20error.20report.20for.20.60rust-analyzer.28private-field.29.60 for further discussion; previously this had various bugs. I tested go-to-definition on: - `use std::io::Write` in `src/bootstrap/setup.rs` - `use std::cell::RefCell` in `src/librustdoc/core.rs` - `use rustc_span::symbol::sym` in `src/librustdoc/core.rs` - `use std::fmt` in `compiler/rustc_span/src/symbol.rs` - `Global` in `library/alloc/src/alloc/tests.rs` The following things still don't work: - `Global.deallocate` in alloc/tests.rs. This function is under `cfg(not(test))`, so it can't be enabled without disabling RA in `tests.rs` altogether. I think this might be fixable by moving `library/alloc/src/alloc/tests.rs` to `library/alloc/tests/alloc/lib.rs`, so it's in a different crate, but I'd like to avoid blocking this improvement on that change. cc `@thomcc` `@BoxyUwU` `@spastorino` - you've had issues with RA in the past, does this fix them? Are there any other use cases I should test? You can try these changes out by running `cp src/etc/vscode_settings.json .vscode/settings.json`, or running `x setup` and picking a random profile (it won't overwrite config.toml if it already exists). See https://github.com/rust-lang/rust/pull/108135 for plans to make updating the config easier. r? `@Veykril`
2023-02-19Rollup merge of #108129 - ↵Guillaume Gomez-2/+32
GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov Correctly handle links starting with whitespace Part of https://github.com/rust-lang/rust/issues/107995. I just got this issue, wrote a fix and then saw the issue. So here's the PR. ^^' r? `@petrochenkov`
2023-02-19Rollup merge of #107766 - ↵Guillaume Gomez-41/+98
GuillaumeGomez:fix-json-reexports-of-different-items-with-same-name, r=aDotInTheVoid Fix json reexports of different items with same name Fixes #107677. I renamed `from_item_id*` functions into `id_from_item` instead because it makes more sense now. I also simplified the logic around it a bit so that the `ids` function will now directly pass `&clean::Item` to `id_from_item` and the ID will be consistently generated (it caused an issue when I updated the ID for imports). So now, the big change of this PR: I changed how imports' ID is generated: it now includes the target item's ID at the end of the ID. It's to prevent two reexported items with the same name (but different types). r? `@aDotInTheVoid`
2023-02-19Use custom implementation of read_buf in Read for &'a FileDescTomasz Miąsko-0/+4
This allows to skip an unnecessary buffer initialization.
2023-02-19Auto merge of #108228 - Dylan-DPC:rollup-i9t13qu, r=Dylan-DPCbors-161/+275
Rollup of 7 pull requests Successful merges: - #104659 (reflow the stack size story) - #106933 (Update documentation of select_nth_unstable and select_nth_unstable_by to state O(n^2) complexity) - #107783 (rustdoc: simplify DOM for `.item-table`) - #107951 (resolve: Fix doc links referring to other crates when documenting proc macro crates directly) - #108130 ("Basic usage" is redundant for there is just one example) - #108146 (rustdoc: hide `reference` methods in search index) - #108189 (Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-19Rollup merge of #108189 - compiler-errors:non_lifetime_binders-bound-stuff, ↵Dylan DPC-9/+103
r=jackh726 Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds 1. When assembling candidates for `for<T> T: Sized`, we can't ICE because the self-type is a bound type. 2. Fix an issue where, when canonicalizing in non-universe preserving mode, we don't actually set the universe for placeholders to the root even though we do the same for region vars. 3. Make `Placeholder("T")` format like `T` in error messages. Fixes #108180 Fixes #108182 r? types
2023-02-19Rollup merge of #108146 - notriddle:notriddle/rustdoc-search-reference, ↵Dylan DPC-0/+18
r=GuillaumeGomez rustdoc: hide `reference` methods in search index They're hidden in the HTML, so it makes no sense in the search engine for `reference::next` or `reference::shrink` to be shown. https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/What.20is.20.60reference.3A.3Ashrink.60.3F
2023-02-19Rollup merge of #108130 - tshepang:just-one-example, r=workingjubileeDylan DPC-42/+0
"Basic usage" is redundant for there is just one example
2023-02-19Rollup merge of #107951 - petrochenkov:procmacdoc, r=jackh726Dylan DPC-1/+33
resolve: Fix doc links referring to other crates when documenting proc macro crates directly Fixes https://github.com/rust-lang/rust/issues/107950
2023-02-19Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomezDylan DPC-101/+103
rustdoc: simplify DOM for `.item-table` This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-19Rollup merge of #106933 - schuelermine:fix/doc/102451, r=AmanieuDylan DPC-6/+14
Update documentation of select_nth_unstable and select_nth_unstable_by to state O(n^2) complexity See #102451
2023-02-19Rollup merge of #104659 - tshepang:reflow, r=workingjubileeDylan DPC-2/+4
reflow the stack size story
2023-02-19Download rustfmt regardless of rustc being set in config.tomlKittyBorgX-9/+0
2023-02-19Auto merge of #107772 - compiler-errors:dyn-star-backend-is-ptr, r=eholkbors-95/+129
Make `dyn*`'s value backend type a pointer One tweak on top of Ralf's commit should fix using `usize` as a `dyn*`-coercible type, and should fix when we're using various other pointer types when LLVM opaque pointers is disabled. r? `@eholk` but feel free to reassign cc https://github.com/rust-lang/rust/pull/107728#issuecomment-1421231823 `@RalfJung`
2023-02-19Auto merge of #107867 - compiler-errors:new-solver-fn-trait-safety, r=lcnrbors-74/+135
Check that built-in callable types validate their output type is `Sized` (in new solver) Working on parity with old solver. Putting this up for consideration, it's not *really* needed or anything just yet. Maybe it's better to approach this from another direction (like always checking the item bounds when calling `consider_assumption`? we may need that for coinduction to be sound though?) This basically implements #100096 for the new solver.
2023-02-18Auto merge of #107542 - ↵bors-7/+23
compiler-errors:param-envs-with-inference-vars-are-cursed, r=jackh726 Don't call `with_reveal_all_normalized` in const-eval when `param_env` has inference vars in it **what:** This slightly shifts the order of operations from an existing hack: https://github.com/rust-lang/rust/blob/5b6ed253c42a69b93e7447fb0874a89ab6bc1cfb/compiler/rustc_middle/src/ty/consts/kind.rs#L225-L230 in order to avoid calling a tcx query (`TyCtxt::reveal_opaque_types_in_bounds`, via `ParamEnv::with_reveal_all_normalized`) when a param-env has inference variables in it. **why:** This allows us to enable fingerprinting of query keys/values outside of incr-comp in deubg mode, to make sure we catch other places where we're passing infer vars and other bad things into query keys. Currently that (bbf33836b9adfe4328aefa108c421e670a3923b7) crashes because we introduce inference vars into a param-env in the blanket-impl finder in rustdoc :sweat: https://github.com/rust-lang/rust/blob/5b6ed253c42a69b93e7447fb0874a89ab6bc1cfb/src/librustdoc/clean/blanket_impl.rs#L43 See the CI failure here: https://github.com/rust-lang/rust/actions/runs/4058194838/jobs/6984834619
2023-02-18Add regression test for #107995Guillaume Gomez-0/+28
2023-02-18Correctly handle if a link starts with a whitespaceGuillaume Gomez-2/+4
2023-02-18Stop implementing _with_overflow intrinsics in codegen backends.Camille GILLOT-50/+0
2023-02-18Replace _with_overflow instrinsics in LowerIntrinsics.Camille GILLOT-3/+113
2023-02-18Adapt cg_clif.Camille GILLOT-10/+7
2023-02-18Fix codegen test.Camille GILLOT-1/+1
2023-02-18Rename checked_binop_checks_overflow.Camille GILLOT-7/+8
2023-02-18Remove special case in rvalue codegen.Camille GILLOT-12/+0
2023-02-18Make name more explicit.Camille GILLOT-2/+2