about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-11-28Move `src/test/rustdoc` intra-doc link tests into a subdirectoryJoshua Nelson-258/+254
They were starting to get unwieldy.
2020-11-28Rollup merge of #79486 - camelid:E0591-code-cleanup, r=lcnrJonas Schievink-5/+13
Slightly improve code samples in E0591 * Improve formatting * Don't hide `unsafe` block - it's important!
2020-11-28Rollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-SimulacrumJonas Schievink-1/+5
Convert UNC path to local path to satisfy install script on Windows `mkdir` with the `-p` flag attempts to create `//?` if passed a UNC path. This fails on both MSYS2 and Git Bash. The UNC paths come from [canonicalizing](https://github.com/rust-lang/rust/blob/32da90b431919eedb3e281a91caea063ba4edb77/src/bootstrap/install.rs#L79) the install prefix path. `mkdir -p` gets invoked on the [install script](https://github.com/rust-lang/rust-installer/blob/d66f476b4d5e7fdf1ec215c9ac16c923dc292324/install-template.sh#L149).
2020-11-28Rollup merge of #79234 - ortem:fix-hashmap-pretty-printers, r=Mark-SimulacrumJonas Schievink-2/+2
Resolve typedefs in HashMap gdb/lldb pretty-printers `GetTypedefedType` (LLDB) and `strip_typedefs` (GDB) calls are needed to resolve key and value types completely. Without these calls, debugger doesn't show the actual type. **Before** (without `GetTypedefedType`): ``` (lldb) frame variable hm[0] (T) hm[0] = { ... } ``` **After** (with `GetTypedefedType`): ``` (lldb) frame variable hm[0] ((i32, alloc::string::String)) hm[0] = { ... } ``` Based on https://github.com/intellij-rust/intellij-rust/pull/6258
2020-11-28Auto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkovbors-119/+376
Properly handle attributes on statements We now collect tokens for the underlying node wrapped by `StmtKind` nstead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-27Slightly improve code samples in E0591Camelid-5/+13
* Improve formatting * Don't hide `unsafe` block - it's important!
2020-11-28Auto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514bors-0/+3
Revert "Normalize `<X as Y>::T` for rustdoc" Reverts rust-lang/rust#77467 by disabling normalization. See https://github.com/rust-lang/rust/issues/79459; I intend to reland normalization once that's fixed. r? `@Aaron1011` cc `@oli-obk` `@GuillaumeGomez`
2020-11-27Auto merge of #79372 - jyn514:more-cleanup, r=GuillaumeGomezbors-67/+49
Cleanup more of rustdoc - Use `Item::from_def_id` for StructField - Use `from_def_id_and_parts` for primitives and keywords - Take `String` instead of `Symbol` in `from_def_id` - this avoids having to intern then immediately stringify the existing string. - Remove unused `get_stability` and `get_deprecation` - Remove unused `attrs` field from `primitives` - Remove unused `attrs` field from `keywords` This will probably conflict with https://github.com/rust-lang/rust/pull/79335 and I would prefer for that PR to land first - I'm anxious for https://github.com/rust-lang/rust/pull/77467 to land :) Makes https://github.com/rust-lang/rust/issues/76998 easier to add. r? `@GuillaumeGomez`
2020-11-27Revert the effect of #77467 by disabling normalization in rustdocoli-0/+3
2020-11-27Auto merge of #77484 - ↵bors-1/+2
terhechte:support-ios-catalyst-macabi-arm64-target-triple, r=nikomatsakis Add support for Arm64 Catalyst on ARM Macs This is an iteration on https://github.com/rust-lang/rust/pull/63467 which was merged a while ago. In the aforementioned PR, I added support for the `X86_64-apple-ios-macabi` target triple, which is Catalyst, iOS apps running on macOS. Very soon, Apple will launch ARM64 based Macs which will introduce `aarch64_apple_darwin.rs`, macOS apps using the Darwin ABI running on ARM. This PR adds support for Catalyst apps on ARM Macs: iOS apps compiled for the darwin ABI. I don't have access to a Apple Developer Transition Kit (DTK), so I can't really test if the generated binaries work correctly. I'm vaguely hopeful that somebody with access to a DTK could give this a spin.
2020-11-27Don't lint on redundant semicolons after item statementsAaron Hill-0/+10
This preserves the current lint behavior for now. Linting after item statements currently prevents the compiler from bootstrapping. Fixing this is blocked on fixing this upstream in Cargo, and bumping the Cargo submodule.
2020-11-27Auto merge of #79318 - cjgillot:fitem, r=lcnrbors-109/+85
Store HIR ForeignItem in a side table In a similar fashion to Item, ImplItem and TraitItem.
2020-11-26Use custom macro instead of printlnAaron Hill-141/+152
Loading a macro from libstd causes us to load serialized `SyntaxContext`s in a platform-dependent way, causing the printed spans to differ between platforms.
2020-11-27Auto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkovbors-32/+346
Generic Associated Types in Trait Paths - Ast part The Ast part of https://github.com/rust-lang/rust/pull/78978 r? `@petrochenkov`
2020-11-26Fix new 'unnecessary trailing semicolon' warningsAaron Hill-20/+20
2020-11-26Add additional semicolon testAaron Hill-108/+126
2020-11-26Only eat semicolons for statements that need themAaron Hill-6/+1
When parsing a statement (e.g. inside a function body), we now consider `struct Foo {};` and `$stmt;` to each consist of two statements: `struct Foo {}` and `;`, and `$stmt` and `;`. As a result, an attribute macro invoke as `fn foo() { #[attr] struct Bar{}; }` will see `struct Bar{}` as its input. Additionally, the 'unused semicolon' lint now fires in more places.
2020-11-26Properly handle attributes on statementsAaron Hill-74/+297
We now collect tokens for the underlying node wrapped by `StmtKind` instead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-26Auto merge of #79338 - Aaron1011:fix/token-reparse-cache, r=petrochenkovbors-0/+50
Cache pretty-print/retokenize result to avoid compile time blowup Fixes #79242 If a `macro_rules!` recursively builds up a nested nonterminal (passing it to a proc-macro at each step), we will end up repeatedly pretty-printing/retokenizing the same nonterminals. Unfortunately, the 'probable equality' check we do has a non-trivial cost, which leads to a blowup in compilation time. As a workaround, we cache the result of the 'probable equality' check, which eliminates the compilation time blowup for the linked issue. This commit only touches a single file (other than adding tests), so it should be easy to backport. The proper solution is to remove the pretty-print/retokenize hack entirely. However, this will almost certainly break a large number of crates that were relying on hygiene bugs created by using the reparsed `TokenStream`. As a result, we will definitely not want to backport such a change.
2020-11-26Bless test.Camille GILLOT-8/+8
2020-11-26Update test.Camille GILLOT-78/+53
2020-11-26Remove ForeignMod struct.Camille GILLOT-5/+5
2020-11-26Store ForeignItem in a side table.Camille GILLOT-18/+19
2020-11-26Update coverage output now that primitives have proper spansJoshua Nelson-2/+1
2020-11-26Remove unused `attrs` field from `keywords`Joshua Nelson-23/+17
2020-11-26Use `from_def_id_and_parts` for primitives and keywordsJoshua Nelson-44/+35
- Take `String` instead of `Symbol` - this avoids having to intern then immediately stringify the existing string. - Remove unused `get_stability` and `get_deprecation` - Remove unused `attrs` field from `primitives`
2020-11-26Use `Item::from_def_id` for StructFieldJoshua Nelson-9/+7
2020-11-26Auto merge of #77671 - flip1995:lint_list_always_plugins, r=oli-obk,Manishearthbors-3104/+1
Always print lints from plugins, if they're available Currently you can get a list of lints and lint groups by running `rustc -Whelp`. This prints an additional line at the end: ``` Compiler plugins can provide additional lints and lint groups. To see a listing of these, re-run `rustc -W help` with a crate filename. ``` Clippy is such a "compiler plugin", that provides additional lints. Running `clippy-driver -Whelp` (`rustc` wrapper) still only prints the rustc lints with the above message at the end. But when running `clippy-driver -Whelp main.rs`, where `main.rs` is any rust file, it also prints Clippy lints. I don't think this is a good approach from a UX perspective: Why is a random file necessary to print a help message? This PR changes this behavior: Whenever a compiler callback registers lints, it is assumed that these lints come from a plugin and are printed without having to specify a Rust source file. Fixes rust-lang/rust-clippy#6122 cc `@Manishearth` `@ebroto` for the Clippy changes.
2020-11-26Auto merge of #77467 - jyn514:query-docs, r=oli-obkbors-284/+435
Normalize `<X as Y>::T` for rustdoc - Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved The first commit is a pure refactor and should probably be reviewed by `@GuillaumeGomez.` I recommend reviewing the second commit on its own. Fixes https://github.com/rust-lang/rust/issues/77459. r? `@eddyb` cc `@danielhenrymantilla` , `@lcnr`
2020-11-26Auto merge of #79441 - jonas-schievink:rollup-l9v00bl, r=jonas-schievinkbors-49/+146
Rollup of 10 pull requests Successful merges: - #77758 (suggest turbofish syntax for uninferred const arguments) - #79000 (Move lev_distance to rustc_ast, make non-generic) - #79362 (Lower patterns before using the bound variable) - #79365 (Upgrades the coverage map to Version 4) - #79402 (Fix typos) - #79412 (Clean up rustdoc tests by removing unnecessary features) - #79413 (Fix persisted doctests on Windows / when using workspaces) - #79420 (Fixes a word typo in librustdoc) - #79421 (Fix docs formatting for `thir::pattern::_match`) - #79428 (Fixup compiler docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-26Remove redundant `lift_to_tcx`Joshua Nelson-4/+4
... and fix some fuzzy wording in the debug logging.
2020-11-26Rollup merge of #79420 - njasm:patch_rustdoc, r=GuillaumeGomezJonas Schievink-1/+1
Fixes a word typo in librustdoc Fixes a word typo in librustdoc
2020-11-26Rollup merge of #79413 - Swatinem:rustdoc-persist-crate, r=GuillaumeGomezJonas Schievink-4/+5
Fix persisted doctests on Windows / when using workspaces When using the unstable `--persist-doctests` option, Windows path separators were not escaped properly. Also when running the command in a workspace, crate files can overwrite each other. Before: `src\lib_rs_1_0\rust_out` After: `\crate_a_src_lib_rs_1_0\rust_out`, `\crate_b_src_lib_rs_1_0\rust_out`
2020-11-26Rollup merge of #79412 - GuillaumeGomez:cleanup-rustdoc-tests, r=jyn514Jonas Schievink-36/+15
Clean up rustdoc tests by removing unnecessary features r? ``@jyn514``
2020-11-26Rollup merge of #79365 - richkadel:llvm-cov-map-version-4, r=wesleywiserJonas Schievink-3/+40
Upgrades the coverage map to Version 4 Changes the coverage map injected into binaries compiled with `-Zinstrument-coverage` to LLVM Coverage Mapping Format, Version 4 (from Version 3). Note, binaries compiled with this version will require LLVM tools from at least LLVM Version 11. r? ``@wesleywiser``
2020-11-26Rollup merge of #79000 - sivadeilra:user/ardavis/lev_distance, r=wesleywiserJonas Schievink-2/+2
Move lev_distance to rustc_ast, make non-generic rustc_ast currently has a few dependencies on rustc_lexer. Ideally, an AST would not have any dependency its lexer, for minimizing design-time dependencies. Breaking this dependency would also have practical benefits, since modifying rustc_lexer would not trigger a rebuild of rustc_ast. This commit does not remove the rustc_ast --> rustc_lexer dependency, but it does remove one of the sources of this dependency, which is the code that handles fuzzy matching between symbol names for making suggestions in diagnostics. Since that code depends only on Symbol, it is easy to move it to rustc_span. It might even be best to move it to a separate crate, since other tools such as Cargo use the same algorithm, and have simply contain a duplicate of the code. This changes the signature of find_best_match_for_name so that it is no longer generic over its input. I checked the optimized binaries, and this function was duplicated for nearly every call site, because most call sites used short-lived iterator chains, generic over Map and such. But there's no good reason for a function like this to be generic, since all it does is immediately convert the generic input (the Iterator impl) to a concrete Vec<Symbol>. This has all of the costs of generics (duplicated method bodies) with no benefit. Changing find_best_match_for_name to be non-generic removed about 10KB of code from the optimized binary. I know it's a drop in the bucket, but we have to start reducing binary size, and beginning to tame over-use of generics is part of that.
2020-11-26Rollup merge of #77758 - Stupremee:turbofish-help-for-const, r=varkorJonas Schievink-3/+83
suggest turbofish syntax for uninferred const arguments When not providing a const generic value, and it can not be inferred, the following suggestion is suggested: ![image](https://user-images.githubusercontent.com/39732259/95616180-af127b80-0a69-11eb-8877-551c815f9627.png) Resolves #76737 r? ``@varkor``
2020-11-26Auto merge of #79427 - Aaron1011:fix/const-array-index, r=oli-obkbors-0/+11
Resolve inference variables before trying to remove overloaded indexing Fixes #79152 This code was already set up to handle indexing an array. However, it appears that we never end up with an inference variable for the slice case, so the missing call to `resolve_vars_if_possible` had no effect until now.
2020-11-26Add to platform-support.mdBenedikt Terhechte-1/+1
2020-11-26Add support for Arm64 Catalyst on ARM MacsBenedikt Terhechte-0/+1
2020-11-25Mirror centos vault to S3Mark Rousskov-3/+5
2020-11-25Resolve inference variables before trying to remove overloaded indexingAaron Hill-0/+11
Fixes #79152 This code was already set up to handle indexing an array. However, it appears that we never end up with an inference variable for the slice case, so the missing call to `resolve_vars_if_possible` had no effect until now.
2020-11-25Auto merge of #79411 - tmiasko:naked-params, r=Amanieubors-49/+100
Validate use of parameters in naked functions * Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings. Closes issues below by considering input to be ill-formed. Closes #75922. Closes #77848. Closes #79350.
2020-11-25fixes a word typo in librustdocNelson J Morais-1/+1
2020-11-25add testsb-naber-32/+346
2020-11-25Auto merge of #79326 - Aaron1011:fix/builtin-macro-stmt, r=petrochenkovbors-4/+524
Always invoke statement attributes on the statement itself This is preparation for PR #78296, which will require us to handle statement items in addition to normal items.
2020-11-25Fix persisted doctests on Windows / when using workspacesArpad Borsos-4/+5
When using the unstable `--persist-doctests` option, Windows path separators were not escaped properly. Also when running the command in a workspace, crate files can overwrite each other. Before: `src\lib_rs_1_0\rust_out` After: `\crate_a_src_lib_rs_1_0\rust_out`, `\crate_b_src_lib_rs_1_0\rust_out`
2020-11-25Auto merge of #79400 - camelid:rustdoc-summary_opts, r=GuillaumeGomezbors-6/+8
Add `summary_opts()` for Markdown summary rendering options We have a similar function `opts()` that is for rendering the main body of the documentation, but until now we just constructed the options for rendering summaries on the fly. This is a problem if/when we change the enabled options since the different places can get out-of-sync.
2020-11-25Clean up rustdoc tests by removing unnecessary featuresGuillaume Gomez-36/+15
2020-11-25Auto merge of #79388 - tmiasko:naked-def-only, r=lcnrbors-13/+94
Validate that `#[naked]` is applied to a function definition