about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-01-03Auto merge of #92080 - Aaron1011:pattern-ice, r=cjgillotbors-4/+75
Move `PatKind::Lit` checking from ast_validation to ast lowering Fixes #92074 This allows us to insert an `ExprKind::Err` when an invalid expression is used in a literal pattern, preventing later stages of compilation from seeing an unexpected literal pattern.
2022-01-03Auto merge of #92395 - Kobzol:rustdoc-bindings-thin-vec, r=camelidbors-7/+9
Rustdoc: use ThinVec for GenericArgs bindings The bindings are almost always empty. This reduces the size of `PathSegment` and `GenericArgs` by about one fourth.
2022-01-02Auto merge of #90128 - joshtriplett:stabilize-symbol-mangling-version, ↵bors-30/+30
r=wesleywiser Stabilize -Z symbol-mangling-version=v0 as -C symbol-mangling-version=v0 This allows selecting `v0` symbol-mangling without an unstable option. Selecting `legacy` still requires -Z unstable-options. This does not change the default symbol-mangling-version. See https://github.com/rust-lang/rust/pull/89917 for a pull request changing the default. Rationale, from #89917: Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain . characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters A-Z, a-z, 0-9, and _. Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers). This pull request allows enabling the new v0 symbol-mangling-version. See #89917 for references to the implementation of v0, and for references to the tool changes to decode Rust symbols.
2022-01-02Auto merge of #92066 - Smittyvb:concat_bytes-repeat, r=nagisabors-2/+70
Support [x; n] expressions in concat_bytes! Currently trying to use `concat_bytes!` with a repeating array value like `[42; 5]` results in an error: ``` error: expected a byte literal --> src/main.rs:3:27 | 3 | let x = concat_bytes!([3; 4]); | ^^^^^^ | = note: only byte literals (like `b"foo"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()` ``` This makes it so repeating array syntax can be used the same way normal arrays can be. The RFC doesn't explicitly mention repeat expressions, but it seems reasonable to allow them as well, since normal arrays are allowed. It is possible to make the compiler get stuck compiling forever with `concat_bytes!([3; 999999999])`, but I don't think that's much of an issue since you can do that already with `const X: [u8; 999999999] = [3; 999999999];`. Contributes to #87555.
2022-01-02Auto merge of #92034 - petrochenkov:nolinknores, r=joshtriplettbors-10/+2
Remove effect of `#[no_link]` attribute on name resolution Previously it hid all non-macro names from other crates. This has no relation to linking and can change name resolution behavior in some cases (e.g. glob conflicts), in addition to just producing the "unresolved name" errors. I can kind of understand the possible reasoning behind the current behavior - if you can use names from a `no_link` crates then you can use, for example, functions too, but whether it will actually work or produce link-time errors will depend on random factors like inliner behavior. (^^^ This is not the actual reason why the current behavior exist, I've looked through git history and it's mostly accidental.) I think this risk is ok for such an obscure attribute, and we don't need to specifically prevent use of non-macro items from such crates. (I'm not actually sure why would anyone use `#[no_link]` on a crate, even if it's macro only, if you aware of any use cases, please share. IIRC, at some point it was used for crates implementing custom derives - the now removed legacy ones, not the current proc macros.) Extracted from https://github.com/rust-lang/rust/pull/91795.
2022-01-01Update references to `-Z symbol-mangling-version` to use `-C`Josh Triplett-30/+30
Replace `-Z symbol-mangling-version=v0` with `-C symbol-mangling-version=v0`. Replace `-Z symbol-mangling-version=legacy` with `-Z unstable-options -C symbol-mangling-version=legacy`.
2022-01-01Rollup merge of #92468 - NieDzejkob:silent-cfg, r=petrochenkovMatthias Krüger-0/+5
Emit an error for `--cfg=)` Fixes #73026 See also: #64467, #89468 The issue stems from a `FatalError` being silently raised in `panictry_buffer`. Normally this is not a problem, because `panictry_buffer` emits the causes of the error, but they are not themselves fatal, so they get filtered out by the silent emitter. To fix this, we use a parser entrypoint which doesn't use `panictry_buffer`, and we handle the error ourselves.
2022-01-01Rollup merge of #92332 - GuillaumeGomez:where-clause-order, r=jshaMatthias Krüger-0/+15
Add test for where clause order I didn't use ``@snapshot`` because of the ` ` characters, it's much simpler doing it through rustdoc-gui testsuite. r? `@camelid`
2022-01-01Rollup merge of #92297 - bjorn3:smaller_bootstrap, r=Mark-SimulacrumMatthias Krüger-232/+247
Reduce compile time of rustbuild Best reviewed commit by commit. The `ignore` crate and it's dependencies are probably responsible for the majority of the compile time after this PR. cc `@jyn514` as you got a couple of open rustbuild PR.
2022-01-01Move `PatKind::Lit` checking from ast_validation to ast loweringAaron Hill-4/+75
Fixes #92074 This allows us to insert an `ExprKind::Err` when an invalid expression is used in a literal pattern, preventing later stages of compilation from seeing an unexpected literal pattern.
2022-01-01Remove some dead codebjorn3-31/+1
2022-01-01Remove the merge dependencybjorn3-3/+9
2022-01-01Make the rustc and rustdoc wrapper not depend on libbootstrapbjorn3-29/+39
This slightly improves compilation time by reducing linking time (saving about a 1/10 of the the total compilation time after changing rustbuild) and slightly reduces disk usage (from 16MB for the rustc wrapper to 4MB).
2022-01-01Avoid the merge derive macro in rustbuildbjorn3-166/+197
The task of the macro is simple enough that a decl macro is almost ten times shorter than the original proc macro. The proc macro is 159 lines while the decl macro is just 18 lines. This reduces the amount of dependencies of rustbuild from 45 to 37. It also slight reduces compilation time from 47s to 44s for debug builds.
2022-01-01Remove the lazy_static dependency from rustbuildbjorn3-5/+3
Rustbuild already depends on once_cell which in the future can be replaced with std::lazy::Lazy.
2022-01-01Auto merge of #92419 - erikdesjardins:coldland, r=nagisabors-0/+52
Mark drop calls in landing pads `cold` instead of `noinline` Now that deferred inlining has been disabled in LLVM (#92110), this shouldn't cause catastrophic size blowup. I confirmed that the test cases from https://github.com/rust-lang/rust/issues/41696#issuecomment-298696944 still compile quickly (<1s) after this change. ~Although note that I wasn't able to reproduce the original issue using a recent rustc/llvm with deferred inlining enabled, so those tests may no longer be representative. I was also unable to create a modified test case that reproduced the original issue.~ (edit: I reproduced it on CI by accident--the first commit timed out on the LLVM 12 builder, because I forgot to make it conditional on LLVM version) r? `@nagisa` cc `@arielb1` (this effectively reverts #42771 "mark calls in the unwind path as !noinline") cc `@RalfJung` (fixes #46515) edit: also fixes #87055
2022-01-01Rustdoc: use ThinVec for GenericArgs bindingsJakub Beránek-7/+9
2022-01-01Add test for where clause orderGuillaume Gomez-0/+15
2022-01-01Rollup merge of #92469 - joshtriplett:test-number-fix, r=Mark-SimulacrumMatthias Krüger-8/+23
Make tidy check for magic numbers that spell things Remove existing problematic cases. r? `@Mark-Simulacrum`
2022-01-01Rollup merge of #92460 - dwrensha:fix-92267, r=petrochenkovMatthias Krüger-0/+19
[rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape Fixes #92267. The problem was that the escape string "%%" does not need to appear at the very beginning of the format string, but the iterator implementation assumed that it did. The solution follows the pattern used by `format_foregin::shell::Subtitution::Escape`: https://github.com/rust-lang/rust/blob/8ed935e92dfb09ae388344b12284bf5110cf9265/compiler/rustc_builtin_macros/src/format_foreign.rs#L629
2022-01-01Rollup merge of #92420 - dtolnay:patrange, r=Mark-SimulacrumMatthias Krüger-12/+12
Fix whitespace in pretty printed PatKind::Range Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($pat:pat) => { stringify!($pat) }; } fn main() { println!("{}", repro!(0..=1)); } ``` Before:&ensp;`0 ..=1` After:&ensp;`0..=1` The canonical spacing applied by rustfmt has no space after the lower expr. Rustc's parser diagnostics also do not put a space there: https://github.com/rust-lang/rust/blob/df96fb166f59431e3de443835e50d5b8a7a4adb0/compiler/rustc_parse/src/parser/pat.rs#L754
2022-01-01Rollup merge of #92412 - dtolnay:tryspace, r=Mark-SimulacrumMatthias Krüger-1/+1
Fix double space in pretty printed TryBlock Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($expr:expr) => { stringify!($expr) }; } fn main() { println!("{}", repro!(try {})); } ``` Before:&ensp;<code>try&nbsp;&nbsp;{}</code> After:&ensp;<code>try&nbsp;{}</code> The `head` helper already appends a space: https://github.com/rust-lang/rust/blob/2b67c30bfece00357d5fc09d99b49f21066f04ba/compiler/rustc_ast_pretty/src/pprust/state.rs#L654-L664 so doing `head` followed by `space` resulted in a double space: https://github.com/rust-lang/rust/blob/2b67c30bfece00357d5fc09d99b49f21066f04ba/compiler/rustc_ast_pretty/src/pprust/state.rs#L2241-L2242
2022-01-01Rollup merge of #88310 - worldeva:bootstrap-locking, r=Mark-SimulacrumMatthias Krüger-0/+42
Lock bootstrap (x.py) build directory Closes #76661, closes #80849, `x.py` creates a lock file at `project_root/lock.db` r? `@jyn514` , because he was one that told me about this~
2021-12-31Make tidy check for magic numbers that spell thingsJosh Triplett-8/+23
Remove existing problematic cases.
2022-01-01Emit an error for `--cfg=)`Jakub Kądziołka-0/+5
Fixes #73026 See also: #64467, #89468 The issue stems from a `FatalError` being silently raised in `panictry_buffer`. Normally this is not a problem, because `panictry_buffer` emits the causes of the error, but they are not themselves fatal, so they get filtered out by the silent emitter. To fix this, we use a parser entrypoint which doesn't use `panictry_buffer`, and we handle the error ourselves.
2021-12-31Rollup merge of #92440 - GuillaumeGomez:fix-mobile-toggles, r=jshaMatthias Krüger-1/+21
Fix mobile toggles position Before: ![Screenshot from 2021-12-29 18-53-33](https://user-images.githubusercontent.com/3050060/147764842-082f6fa2-b631-4c47-ba34-ced76fe8494f.png) After: ![Screenshot from 2021-12-29 18-52-48](https://user-images.githubusercontent.com/3050060/147764853-13046330-2442-4fad-b26a-84c167711b54.png) r? `@jsha`
2021-12-31Rollup merge of #92405 - bjorn3:more_needs_inline_asm, r=lqdMatthias Krüger-0/+2
Add a couple needs-asm-support headers to tests This will allow them to be ignored by codegen backends that don't support inline asm.
2021-12-31Rollup merge of #91480 - jsha:fewer-colors, r=GuillaumeGomezMatthias Krüger-70/+82
rustdoc: use smaller number of colors to distinguish items This reduces visual distractions when reading method signatures. As discussed in https://github.com/rust-lang/rust/issues/59845#issuecomment-974757191, this categorizes items into one of six colors (down from thirteen): - method, function (ochre `#AD7C37`) - trait, trait alias (dark slate blue `#6E4FC9`) - enum, struct, type alias, union, primitive (maroon `#AD378A`) - static, module, keyword, associated type, foreign type (steel blue `#3873AD`) - macro (green `#068000`) - generic params, self, Self (unmarked black `#000000`) I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed"). The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types. Demo: https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html
2021-12-31Rollup merge of #91375 - Apteryks:per-target-default-linker, r=Mark-SimulacrumMatthias Krüger-2/+11
config.rs: Add support for a per-target default_linker option. * src/bootstrap/config.rs (Target) <default_linker>: New field. (TomlTarget): Likewise. * src/bootstrap/compile.rs (rustc_cargo_env): Prefer a target-specified default_linker over a global one if available. * config.toml.example: Adjust doc.
2021-12-31Rollup merge of #90383 - tmiasko:union-validity, r=RalfJungMatthias Krüger-0/+92
Extend check for UnsafeCell in consts to cover unions A validity companion to changes from #90373. `@rust-lang/wg-const-eval`
2021-12-31rustbuild: Add support for a per-target default-linker option.Maxim Cournoyer-2/+11
2021-12-31[rustc_builtin_macros] add indices to ↵David Renshaw-0/+19
format_foreign::printf::Substitution::Escape
2021-12-31Auto merge of #92175 - Aaron1011:fix-missing-source-file, r=cjgillotbors-0/+44
Import `SourceFile`s from crate before decoding foreign `Span` Fixes #92163 Fixes #92014 When writing to the incremental cache, we encode all `Span`s we encounter, regardless of whether or not their `SourceFile` comes from the local crate, or from a foreign crate. When we decode a `Span`, we use the `StableSourceFileId` we encoded to locate the matching `SourceFile` in the current session. If this id corresponds to a `SourceFile` from another crate, then we need to have already imported that `SourceFile` into our current session. This usually happens automatically during resolution / macro expansion, when we try to resolve definitions from other crates. In certain cases, however, we may try to load a `Span` from a transitive dependency without having ever imported the `SourceFile`s from that crate, leading to an ICE. This PR fixes the issue by enconding the `SourceFile`'s `CrateNum` when we encode a `Span`. During decoding, we call `imported_source_files()` when we encounter a foreign `CrateNum`, which ensure that all `SourceFile`s from that crate are imported into the current session.
2021-12-31Lock x.py build stateworldeva-0/+42
Prevent spurious build failures and other bugs caused by parallel runs of x.py. We back the lock with sqlite, so that we have a cross-platform locking strategy, and which can be done nearly first in the build process (from Python), which helps move the lock as early as possible.
2021-12-31Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednetbors-14/+15
Update pulldown-cmark version to 0.9 Fixes https://github.com/rust-lang/rust/issues/92206. r? `@camelid`
2021-12-31Extend check for UnsafeCell in consts to cover unionsTomasz Miąsko-0/+92
A validity companion to changes from #90373.
2021-12-31Auto merge of #92437 - flip1995:clippyup, r=Manishearthbors-439/+1493
Update Clippy r? `@Manishearth`
2021-12-30Auto merge of #92426 - calebcartwright:sync-rustfmt-subtree, r=calebcartwrightbors-410/+710
Sync rustfmt subtree r? `@ghost` Mostly refactoring and a few minor lint fixes, along with a couple small bug fixes
2021-12-30Fix display of toggles on mobileGuillaume Gomez-0/+20
2021-12-30Update browser-ui-test version to have assert-position commandGuillaume Gomez-1/+1
2021-12-30Auto merge of #92434 - matthiaskrgr:rollup-m8wuq0v, r=matthiaskrgrbors-13/+45
Rollup of 4 pull requests Successful merges: - #91519 (ast: Avoid aborts on fatal errors thrown from mutable AST visitor) - #92414 (Fix spacing of pretty printed const item without body) - #92423 (Add UI test for #92292) - #92427 (Use `UnsafeCell::get_mut()` in `core::lazy::OnceCell::get_mut()`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-30Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyupflip1995-439/+1493
2021-12-30Rollup merge of #92423 - weirane:ui-92292, r=fee1-deadMatthias Krüger-0/+32
Add UI test for #92292 Closes #92292
2021-12-30Rollup merge of #92414 - dtolnay:constnoexpr, r=oli-obkMatthias Krüger-13/+13
Fix spacing of pretty printed const item without body Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($item:item) => { stringify!($item) }; } fn main() { println!("{}", repro!(extern "C" { static S: i32; })); } ``` Before:&ensp;`extern "C" { static S: i32 ; }` After:&ensp;`extern "C" { static S: i32; }`
2021-12-30Auto merge of #89336 - Aaron1011:variance-struct-diag, r=cjgillotbors-0/+169
Refactor variance diagnostics to work with more types Instead of special-casing mutable pointers/references, we now support general generic types (currently, we handle `ty::Ref`, `ty::RawPtr`, and `ty::Adt`) When a `ty::Adt` is involved, we show an additional note explaining which of the type's generic parameters is invariant (e.g. the `T` in `Cell<T>`). Currently, we don't explain *why* a particular generic parameter ends up becoming invariant. In the general case, this could require printing a long 'backtrace' of types, so doing this would be more suitable for a follow-up PR. We still only handle the case where our variance switches to `ty::Invariant`.
2021-12-30Auto merge of #92377 - compiler-errors:rustdoc-lifetimes, r=camelid,jyn514bors-20/+19
remove in_band_lifetimes from librustdoc r? `@camelid` closes #92368
2021-12-30add test for noop drop in landing padErik Desjardins-3/+18
2021-12-30keep noinline for system llvm < 14Erik Desjardins-1/+2
2021-12-29Merge commit '4a053f206fd6799a25823c307f7d7f9d897be118' into ↵Caleb Cartwright-410/+710
sync-rustfmt-subtree
2021-12-29Add UI test for #92292Wang Ruochen-0/+32
Closes #92292