about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-03-12Auto merge of #108682 - est31:simplify_dirs, r=davidtwcobors-34/+34
Simplify message paths This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes. The commit was the result of automated changes: ``` for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done ``` r? `@davidtwco`
2023-03-11`MaybeUninit::assume_init_read` should have `noundef` load metadataScott McMurray-3/+31
I was looking into `array::IntoIter` optimization, and noticed that it wasn't annotating the loads with `noundef` for simple things like `array::IntoIter<i32, N>`. Turned out to be a more general problem as `MaybeUninit::assume_init_read` isn't marking the load as initialized (<https://rust.godbolt.org/z/Mxd8TPTnv>), which is unfortunate since that's basically its reason to exist. This PR lowers `ptr::read(p)` to `copy *p` in MIR, which fortuitiously also improves the IR we give to LLVM for things like `mem::replace`.
2023-03-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-35/+147
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.
2023-03-12Document BinOp::is_checkableTomasz Miąsko-0/+3
2023-03-11Use ensure_with_value in a few more places.Camille GILLOT-6/+7
2023-03-11Make the check for cache opt-in.Camille GILLOT-13/+57
2023-03-11Use ensure for thir_abstract_const.Camille GILLOT-5/+2
2023-03-11Ensure value is on the on-disk cache before returning.Camille GILLOT-9/+53
2023-03-11Use TyCtxt::trait_solver_next in some placesMichael Goulet-15/+13
2023-03-11Simplify message pathsest31-34/+34
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11Auto merge of #108417 - Zoxc:dep-graph-branch, r=cjgillotbors-173/+221
Move dep graph methods to DepGraphData to avoid branches and `unwrap`s This moves methods from `DepGraph` to `DepGraphData` which makes the code a bit cleaner since the dep graph is unconditionally available. It also changes `try_execute_query` to only branch on dep graph availability once, removing unnecessary branches and `unwrap`s. This is based on https://github.com/rust-lang/rust/pull/108134 and https://github.com/rust-lang/rust/pull/108167. Performance impact of just the last commit: <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7354s</td><td align="right">1.7242s</td><td align="right"> -0.64%</td></tr><tr><td>🟣 <b>clap</b>:check:initial</td><td align="right">2.0813s</td><td align="right">2.0687s</td><td align="right"> -0.61%</td></tr><tr><td>🟣 <b>clap</b>:check:unchanged</td><td align="right">0.4554s</td><td align="right">0.4550s</td><td align="right"> -0.09%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2528s</td><td align="right">0.2521s</td><td align="right"> -0.27%</td></tr><tr><td>🟣 <b>hyper</b>:check:initial</td><td align="right">0.3222s</td><td align="right">0.3214s</td><td align="right"> -0.25%</td></tr><tr><td>🟣 <b>hyper</b>:check:unchanged</td><td align="right">0.1339s</td><td align="right">0.1333s</td><td align="right"> -0.38%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9484s</td><td align="right">0.9455s</td><td align="right"> -0.30%</td></tr><tr><td>🟣 <b>regex</b>:check:initial</td><td align="right">1.1805s</td><td align="right">1.1727s</td><td align="right"> -0.66%</td></tr><tr><td>🟣 <b>regex</b>:check:unchanged</td><td align="right">0.3305s</td><td align="right">0.3307s</td><td align="right"> 0.08%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5453s</td><td align="right">1.5374s</td><td align="right"> -0.51%</td></tr><tr><td>🟣 <b>syn</b>:check:initial</td><td align="right">1.9230s</td><td align="right">1.9206s</td><td align="right"> -0.12%</td></tr><tr><td>🟣 <b>syn</b>:check:unchanged</td><td align="right">0.6340s</td><td align="right">0.6333s</td><td align="right"> -0.11%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.8623s</td><td align="right">5.8536s</td><td align="right"> -0.15%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:initial</td><td align="right">7.2873s</td><td align="right">7.2786s</td><td align="right"> -0.12%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:unchanged</td><td align="right">1.8378s</td><td align="right">1.8478s</td><td align="right"> 0.54%</td></tr><tr><td>Total</td><td align="right">26.5300s</td><td align="right">26.4750s</td><td align="right"> -0.21%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9976s</td><td align="right"> -0.24%</td></tr></table> r? `@cjgillot`
2023-03-11Gate const closures even when they appear in macrosMichael Goulet-12/+9
2023-03-11Gate all usages of dyn*, even in macrosMichael Goulet-3/+3
2023-03-11Add a fixme and address a more non trivial caseest31-2/+3
Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-03-11Address the new odd backticks tidy lint in compiler/est31-6/+10
2023-03-11Auto merge of #109019 - matthiaskrgr:rollup-ihjntil, r=matthiaskrgrbors-216/+316
Rollup of 9 pull requests Successful merges: - #104363 (Make `unused_allocation` lint against `Box::new` too) - #106633 (Stabilize `nonzero_min_max`) - #106844 (allow negative numeric literals in `concat!`) - #108071 (Implement goal caching with the new solver) - #108542 (Force parentheses around `match` expression in binary expression) - #108690 (Place size limits on query keys and values) - #108708 (Prevent overflow through Arc::downgrade) - #108739 (Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time) - #108806 (Querify register_tools and post-expansion early lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-11fix linkjyn-1/+1
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2023-03-11Rollup merge of #108806 - cjgillot:query-lints, r=davidtwcoMatthias Krüger-40/+74
Querify register_tools and post-expansion early lints The 2 extra queries correspond to code that happen before and after macro expansion, and don't need the resolver to exist.
2023-03-11Rollup merge of #108739 - 823984418:patch-1, r=cjgillotMatthias Krüger-0/+4
Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time Here, at the same time, there are two `start_llbb` builder, this should be unexpected.
2023-03-11Rollup merge of #108690 - Zoxc:query-size-limits, r=cjgillotMatthias Krüger-0/+30
Place size limits on query keys and values This just prevents these from growing accidentally too large. I'm not sure if there's an easy way to also print the actual size too.
2023-03-11Rollup merge of #108542 - bwmf2:expanded, r=wesleywiserMatthias Krüger-0/+4
Force parentheses around `match` expression in binary expression This attempts to solve https://github.com/rust-lang/rust/issues/98790.
2023-03-11Rollup merge of #108071 - compiler-errors:new-solver-caching, r=lcnrMatthias Krüger-173/+183
Implement goal caching with the new solver Maybe it's wrong, idk. Opening mostly for first impressions before I go to sleep. r? ``@lcnr,`` cc ``@cjgillot``
2023-03-11Rollup merge of #106844 - Ezrashaw:concat-negative-int-lit, r=dtolnayMatthias Krüger-1/+14
allow negative numeric literals in `concat!` Fixes #106837 While *technically* negative numeric literals are implemented as unary operations, users can reasonably expect that negative literals are treated the same as positive literals.
2023-03-11Rollup merge of #104363 - WaffleLapkin:bonk_box_new, r=NilstriebMatthias Krüger-2/+7
Make `unused_allocation` lint against `Box::new` too Previously it only linted against `box` syntax, which likely won't ever be stabilized, which is pretty useless. Even now I'm not sure if it's a meaningful lint, but it's at least something :shrug: This means that code like the following will be linted against: ```rust Box::new([1, 2, 3]).len(); f(&Box::new(1)); // where f : &i32 -> () ``` The lint works by checking if a `Box::new` (or `box`) expression has an a borrow adjustment, meaning that the code that first stores the box in a variable won't be linted against: ```rust let boxed = Box::new([1, 2, 3]); // no lint boxed.len(); ```
2023-03-11Expand on the allocator comment in `rustc-main`Joshua Nelson-0/+9
Before, it said "global_allocator does nothing". Now it gives you suggestions for what to do if you want to change the global allocator (which is likely the main reason you'd be reading the comment).
2023-03-11remove duplicated calls to sort_stringklensy-6/+2
2023-03-11Rollup merge of #108988 - adrianheine:crate-reference-block, r=petrochenkovMatthias Krüger-10/+2
rustdoc: Don't crash on `crate` references in blocks This is a regression from #94857.
2023-03-11Rollup merge of #108950 - cjgillot:inherit-less, r=compiler-errorsMatthias Krüger-151/+122
Directly construct Inherited in typeck. Using `InheritedBuilder` + a closure does not seem necessary any more. + a few opportunistic simplifications to typeck entry point.
2023-03-11Rollup merge of #108949 - Urgau:check-cfg-target-json, r=oli-obkMatthias Krüger-4/+5
Honor current target when checking conditional compilation values This is fixed by simply using the currently registered target in the current session. We need to use it because of target json that are not by design included in the rustc list of targets. Fixes https://github.com/rust-lang/rust/issues/108941
2023-03-11Rollup merge of #108711 - Nilstrieb:nt-note, r=petrochenkovMatthias Krüger-3/+9
Add note when matching token with nonterminal The current error message is _really_ confusing. The implementation is slightly hacky, but not that much more hacky than all this nonterminal stuff.. r? ``@petrochenkov``
2023-03-11Give proper error message when tcx wasn't passed to decoderNilstrieb-5/+18
2023-03-11Auto merge of #109001 - matthiaskrgr:rollup-a3agnwp, r=matthiaskrgrbors-101/+99
Rollup of 8 pull requests Successful merges: - #105798 (Relax ordering rules for `asm!` operands) - #105962 (Stabilize path_as_mut_os_str) - #106085 (use problem matchers for tidy CI) - #107711 (Stabilize movbe target feature) - #108017 (Add `--no-undefined-version` link flag and fix associated breakage) - #108891 (Remove an extraneous include) - #108902 (no more do while :<) - #108912 (Document tool lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-11Auto merge of #108998 - matthiaskrgr:rollup-sxbdulg, r=matthiaskrgrbors-137/+274
Rollup of 9 pull requests Successful merges: - #106921 (Add documentation about the memory layout of `Cell`) - #108828 (Emit alias-eq when equating numeric var and projection) - #108834 (Do not ICE when we have fn pointer `Fn` obligations with bound vars in the self type) - #108900 (fix(lexer): print whitespace warning for \x0c) - #108930 (feat: implement better error for manual impl of `Fn*` traits) - #108937 (improve readability of winnowing) - #108947 (Don't even try to combine consts with incompatible types) - #108976 (Update triagebot rust-analyzer team mention) - #108983 (Forbid `#[target_feature]` on safe default implementations) Failed merges: - #108950 (Directly construct Inherited in typeck.) r? `@ghost` `@rustbot` modify labels: rollup
2023-03-11Auto merge of #104527 - ferrocene:pa-more-licenses, r=pnkfelixbors-18/+6
Add more license annotations This PR updates the `.reuse/dep5` file to include more accurate licensing data for everything in the repository (*excluding* submodules and dependencies). Some decisions were made in this PR: * The standard copyright attribution for files maintained by us is "The Rust Project Developers (see https://thanks.rust-lang.org)", to avoid having to maintain an in-tree `AUTHORS` file. * For files that have specific licensing terms, we added the terms to the `.reuse/dep5` rather than adding SPDX comments in the files themselves. * REUSE picks up any comment/text line with `Copyright` on it, so I had to sprinkle around `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` comments. The rendered `COPYRIGHT` file is available at https://gist.github.com/pietroalbini/efb81103f69596d39758114f3f6a8688. r? `@pnkfelix`
2023-03-10Actually cache goalsMichael Goulet-70/+65
2023-03-10Move some solver stuff to middleMichael Goulet-103/+118
2023-03-10Rollup merge of #108912 - clubby789:doc-tool-lints, r=NilstriebMatthias Krüger-0/+30
Document tool lints Add brief doc comments for the internal tool lints so a summary can be seen without needing to open source code
2023-03-10Rollup merge of #108902 - lcnr:do-while-sus, r=davidtwco,NilstriebMatthias Krüger-25/+23
no more do while :<
2023-03-10Rollup merge of #108891 - kazutakahirata:master, r=cuviperMatthias Krüger-1/+0
Remove an extraneous include SymbolWrapper.cpp doesn't use std::optional or llvm::Optional, so this patch removes the extraneous include. Note that llvm/ADT/Optional.h has been deprecated upstream. This patch ensures that SymbolWrapper.cpp continues to compile even after the upcoming removal of Optional.h.
2023-03-10Rollup merge of #108017 - chbaker0:fix-105967, r=chbaker0Matthias Krüger-40/+38
Add `--no-undefined-version` link flag and fix associated breakage LLVM upstream sets `--no-undefined-version` by default in lld: https://reviews.llvm.org/D135402. Due to a bug in how version scripts are generated, this breaks the `dylib` output type for most crates. See https://github.com/rust-lang/rust/issues/105967#issuecomment-1428671533 for details. This PR adds the flag to gcc flavor linkers in anticipation of this LLVM change rolling in, and patches `rustc` to not attempt to export `__rust_*` allocator symbols when they weren't generated. Fixes #105967
2023-03-10Rollup merge of #107711 - calebzulawski:movbe, r=pnkfelixMatthias Krüger-4/+4
Stabilize movbe target feature Almost all "old" x86 target features are stable. As far as I can tell, these are the last two unstable features in the `x86-64-v2` or `x86-64-v3` microarchitecture levels, so I'm not sure if it was an oversight or if they're still unstable for a reason (see #106323 for `f16c`). Note that this only stabilizes the target features, and not the intrinsics. cc ```@Amanieu``` r? ```@rust-lang/lang```
2023-03-10Rollup merge of #105798 - Amanieu:relax-asm, r=joshtriplettMatthias Krüger-31/+4
Relax ordering rules for `asm!` operands The `asm!` and `global_asm!` macros require their operands to appear strictly in the following order: - Template strings - Positional operands - Named operands - Explicit register operands - `clobber_abi` - `options` This is overly strict and can be inconvienent when building complex `asm!` statements with macros. This PR relaxes the ordering requirements as follows: - Template strings must still come before all other operands. - Positional operands must still come before named and explicit register operands. - Named and explicit register operands can be freely mixed. - `options` and `clobber_abi` can appear in any position after the template strings. r? ```````@joshtriplett```````
2023-03-10Simplify typeck entry.Camille GILLOT-51/+46
2023-03-10Directly construct Inherited.Camille GILLOT-143/+119
2023-03-10Rollup merge of #108983 - ↵Matthias Krüger-1/+1
LeSeulArtichaut:108646-target-feature-default-impl, r=cjgillot Forbid `#[target_feature]` on safe default implementations Fixes #108646.
2023-03-10Rollup merge of #108947 - compiler-errors:ct-infer-no-shapeshifting, r=BoxyUwUMatthias Krüger-13/+24
Don't even try to combine consts with incompatible types ~I left a more detailed explanation for why this fixes this issue in the UI test, but in general, we should not try to unify const infer vars and rigid consts if they have incompatible types. That's because we don't want something like a `ConstArgHasType` predicate to suddenly go from passing to failing, or vice versa, due to a shallow resolve.~ 1. Use the `type_of` for a parameter in `try_eval_lit_or_param`, instead of the "expected" type from a `WithOptConstParam` def id. 2. Don't combine consts that have incompatible types. Fixes #108781
2023-03-10Rollup merge of #108937 - lcnr:winnowing-enum, r=WaffleLapkinMatthias Krüger-40/+67
improve readability of winnowing
2023-03-10Rollup merge of #108930 - Ezrashaw:better-error-for-manual-fn-impl, ↵Matthias Krüger-51/+96
r=petrochenkov feat: implement better error for manual impl of `Fn*` traits Fixes #39259 cc `@estebank` (you gave me some advice in the linked issue, would you like to review?)
2023-03-10Rollup merge of #108900 - bvanjoi:issue-108275, r=petrochenkovMatthias Krüger-4/+4
fix(lexer): print whitespace warning for \x0c - close https://github.com/rust-lang/rust/issues/108275 - discussion: https://github.com/rust-lang/rust/pull/108403
2023-03-10Rollup merge of #108834 - compiler-errors:fn-ptr-fn-obl, r=spastorinoMatthias Krüger-3/+11
Do not ICE when we have fn pointer `Fn` obligations with bound vars in the self type We never supported solving `for<'a> fn(&'a ()): Fn(&'a ())` -- I tried to add that support in #104929, but iirc `@lcnr` wanted to support this more generally by eagerly instantiating trait predicate binders with placeholders. That never happened due to blockers in the old solver, but we probably shouldn't ICE in any case. On the bright side, this passes on the new solver :^)