Commit graph

155493 commits

Author SHA1 Message Date
Esteban Kuber
5c70f25f8c Detect when negative literal indices are used and suggest appropriate code 2021-09-26 16:52:10 +00:00
Fabian Wolff
65eb381dec Do not suggest importing inaccessible items 2021-09-26 18:43:58 +02:00
Joshua Nelson
6f087aedb6 Use the correct edition when syntax highlighting doctests
Previously it would unconditionally use edition 2015, which was
incorrect.
2021-09-26 16:36:33 +00:00
Joshua Nelson
f4aa3b544f Preserve the whole LangSyntax when parsing doctests
Previously, only the raw string and the `is_ignore` field were
preserved, which made it hard to recover anything else.
2021-09-26 16:28:36 +00:00
Loïc BRANSTETT
88ff75c6cc Fix populate of union.impls 2021-09-26 18:22:07 +02:00
antoyo
64c561dc22
Fix global initialization (#91)
* Make define_global() return a RValue directly
* Return LValue in functions declaring a global variable
* Remove useless cast
* Fix bytes_in_context to use an array rvalue
* Remove global_names which is unused
* Make const_struct create a constant struct
* Correctly initialize global in static_addr_of_mut
* Fix global variable initialization
* Remove workaround for ARGV
2021-09-26 12:20:02 -04:00
Takayuki Maeda
3bab36357c test suggesting immutable or mutable trait implementations 2021-09-27 00:59:57 +09:00
Takayuki Maeda
3e41397ef2 fix test error 2021-09-27 00:50:46 +09:00
bors
c09d637432 Auto merge of #88316 - est31:remove_box_tests, r=Mark-Simulacrum
Remove most box syntax uses from the testsuite except for src/test/ui/issues

Removes most box syntax uses from the testsuite outside of the src/test/ui/issues directory. The goal was to only change tests where box syntax is an implementation detail instead of the actual feature being tested. So some tests were left out, like the regression test for #87935, or tests where the obtained error message changed significantly.

Mostly this replaces box syntax with `Box::new`, but there are some minor drive by improvements, like formatting improvements or `assert_eq` instead of `assert!( == )`.

Prior PR that removed box syntax from the compiler and tools: #87781
2021-09-26 15:48:10 +00:00
Takayuki Maeda
620f480e64 better suggestions 2021-09-27 00:30:39 +09:00
Commeownist
4e7e822f39
Impove handling of registers in inline asm (#82)
* Correctly handle st(0) register in the clobbers list
* Gate the clobbers based on enabled target features
2021-09-26 09:30:45 -04:00
bors
ac8dd1b2f2 Auto merge of #89101 - ehuss:compiletest-incremental-build, r=Mark-Simulacrum
Support incremental in compiletest for non-incremental modes.

This adds first-class support for using incremental builds in non-incremental-mode tests.  These tests previously manually passed `-C incremental=tmp/foo` which resulted in reusing the same tmp folder between runs.  This means that these tests could fail whenever the on-disk incremental format changed (such as when updating one's local source tree).  This changes it so that these tests can pass a `// incremental-build` header which instructs compiletest to create a set aside a dedicated incremental directory which will be cleared before the test starts to ensure it has a clean slate.
2021-09-26 08:09:12 +00:00
Takayuki Maeda
e2aad3fe60 fix the relevant tests 2021-09-26 16:43:47 +09:00
Takayuki Maeda
0661c2de24 suggest both immutable and mutable trait implementations 2021-09-26 16:43:44 +09:00
David Tolnay
e63d69244e
Stop suggesting a float truncation that is not shorter 2021-09-25 22:55:23 -07:00
bors
f6e6ddc09d Auto merge of #88680 - ehuss:more-attr-validation, r=petrochenkov
Validate builtin attributes for macro args.

This adds some validation for `path`, `crate_type`, and `recursion_limit` attributes so that they will now return an error if you attempt to pass a macro into them (such as `#[path = foo!()]`). Previously, the attribute would be completely ignored. These attributes are special because their values need to be known before/during expansion.

cc #87681
2021-09-26 05:15:11 +00:00
antoyo
0f4b616a08
Add notes for cross-compilation to gcc-only targets (#68) 2021-09-26 00:06:42 -04:00
bors
4da89a180f Auto merge of #89262 - Manishearth:rollup-vtkbetm, r=Manishearth
Rollup of 7 pull requests

Successful merges:

 - #88895 (rustdoc: Cleanup `clean` part 2)
 - #88973 (Expose the std_detect env_override feature)
 - #89010 (Add some intra doc links)
 - #89198 (rustdoc: Don't show hidden trait methods)
 - #89216 (Consistent big O notation)
 - #89224 (Change the order of imports suggestions)
 - #89256 (Fix typo in release notes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-26 02:31:12 +00:00
est31
6550021124 Remove box syntax from most places in src/test outside of the issues dir 2021-09-26 04:07:44 +02:00
Manish Goregaokar
7d9a0e5da9
Rollup merge of #89256 - danielg1111:fix_typo, r=Mark-Simulacrum
Fix typo in release notes
2021-09-25 18:22:22 -07:00
Manish Goregaokar
04d3f93a2b
Rollup merge of #89224 - TaKO8Ki:change-the-order-of-suggestions, r=joshtriplett
Change the order of imports suggestions

closes #83564
2021-09-25 18:22:21 -07:00
Manish Goregaokar
067bfe3618 Rollup merge of #89216 - r00ster91:bigo, r=dtolnay
Consistent big O notation

This makes the big O time complexity notation in places with markdown support more consistent.
Inspired by #89210
2021-09-25 18:22:20 -07:00
Manish Goregaokar
653dcaac2b
Rollup merge of #89216 - r00ster91:bigo, r=dtolnay
Consistent big O notation

This makes the big O time complexity notation in places with markdown support more consistent.
Inspired by #89210
2021-09-25 18:22:20 -07:00
Manish Goregaokar
c118d8b79b
Rollup merge of #89198 - hkmatsumoto:hide-hidden-methods, r=jyn514
rustdoc: Don't show hidden trait methods

Fix #89186.

By skipping trait items whose attributes include `hidden`, we avoid showing such trait methods.
2021-09-25 18:22:19 -07:00
Manish Goregaokar
b8c3a6cfb9
Rollup merge of #89010 - est31:intra_doc_links, r=m-ou-se
Add some intra doc links
2021-09-25 18:22:19 -07:00
Manish Goregaokar
f9d4eb0ae3
Rollup merge of #88973 - lu-zero:std_detect-env_override, r=Amanieu
Expose the std_detect env_override feature
2021-09-25 18:22:18 -07:00
Manish Goregaokar
7777f952f0
Rollup merge of #88895 - camelid:cleanup-pt2, r=jyn514
rustdoc: Cleanup `clean` part 2

Split out from #88379. This contains the following commits from that PR:

- Remove `Type::ResolvedPath.is_generic`
- Rename `is_generic()` to `is_assoc_ty()`

r? `@jyn514`
2021-09-25 18:22:17 -07:00
Nadrieril
b7e358ee17 Trivialize tracking of unreachable subpatterns
Phew it had been very had to make it work without a good way to identify
patterns. Now it's dead easy.
2021-09-26 00:30:39 +01:00
Nadrieril
b6062bda4c Avoid double-deref in Fields 2021-09-26 00:30:39 +01:00
Nadrieril
71abc9565f Replace Pat with a new intermediate representation 2021-09-26 00:30:38 +01:00
Nadrieril
fde45e96b8 Remove dependency of SubPatSet on Pat 2021-09-26 00:07:18 +01:00
Nadrieril
5853399aee Move special &str handling to Constructor and Fields 2021-09-26 00:05:52 +01:00
Nadrieril
035c5213ae Use usize for slice arity 2021-09-26 00:05:52 +01:00
Nadrieril
3175409682 Rework Fields internals.
Now `Fields` is just a `Vec` of patterns, with some extra info on the
side to reconstruct patterns when needed. This emphasizes that this
extra info is not central to the algorithm.
2021-09-26 00:05:52 +01:00
Nadrieril
87a0a25b38 A for loop is a lot faster apparently 2021-09-26 00:05:52 +01:00
Nadrieril
ff90c6353b Cleanup the reporting of unreachable patterns 2021-09-26 00:05:52 +01:00
Nadrieril
003bbcb799 Always report reachability for user-supplied patterns 2021-09-26 00:05:52 +01:00
Nadrieril
2bf6e7880d Remove some unreachable code 2021-09-26 00:05:52 +01:00
Nadrieril
2e78c6bd99 Remove premature shortcutting 2021-09-26 00:05:50 +01:00
Matthias Krüger
d888b4b98c clippy lints: update doctest ranges to inclusive ones 2021-09-25 22:40:58 +02:00
Matthias Krüger
c3515c301d bump clippy crates to edition 2021 2021-09-25 22:40:58 +02:00
Daniel Giger
b51897f604
Fix typo in release notes 2021-09-25 16:34:39 -04:00
bors
addb4da686 Auto merge of #88343 - steffahn:fix_code_spacing, r=jyn514
Fix spacing of links in inline code.

Similar to #80733, but the focus is different. This PR eliminates all occurrences of pieced-together inline code blocks like [`Box`]`<`[`Option`]`<T>>` and replaces them with good-looking ones (using HTML-syntax), like <code>[Box]<[Option]\<T>></code>. As far as I can tell, I should’ve found all of these in the standard library (regex search with `` r"`\]`|`\[`" ``) \[except for in `core::convert` where I’ve noticed other things in the docs that I want to fix in a separate PR]. In particular, unlike #80733, I’ve added almost no new instance of inline code that’s broken up into multiple links (or some link and some link-free part). I also added tooltips (the stuff in quotes for the markdown link listings) in places that caught my eye, but that’s by no means systematic, just opportunistic.

[Box]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box"
[`Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box"
[Option]: https://doc.rust-lang.org/std/option/enum.Option.html "Option"
[`Option`]: https://doc.rust-lang.org/std/option/enum.Option.html "Option"

Context: I got annoyed by repeatedly running into new misformatted inline code while reading the standard library docs. I know that once issue #83997 (and/or related ones) are resolved, these changes become somewhat obsolete, but I fail to notice much progress on that end right now.

r? `@jyn514`
2021-09-25 20:08:11 +00:00
Fabian Wolff
3d08ff1c19 Fix incorrect disambiguation suggestion for associated items 2021-09-25 21:47:33 +02:00
Luca Barbato
160b93903c Expose the std_detect env_override feature 2021-09-25 20:30:25 +02:00
Frank Steffahn
67065fe933 Apply 16 commits (squashed)
----------

Fix spacing for links inside code blocks, and improve link tooltips in alloc::fmt

----------

Fix spacing for links inside code blocks, and improve link tooltips in alloc::{rc, sync}

----------

Fix spacing for links inside code blocks, and improve link tooltips in alloc::string

----------

Fix spacing for links inside code blocks in alloc::vec

----------

Fix spacing for links inside code blocks in core::option

----------

Fix spacing for links inside code blocks, and improve a few link tooltips in core::result

----------

Fix spacing for links inside code blocks in core::{iter::{self, iterator}, stream::stream, poll}

----------

Fix spacing for links inside code blocks, and improve a few link tooltips in std::{fs, path}

----------

Fix spacing for links inside code blocks in std::{collections, time}

----------

Fix spacing for links inside code blocks in and make formatting of `&str`-like types consistent in std::ffi::{c_str, os_str}

----------

Fix spacing for links inside code blocks, and improve link tooltips in std::ffi

----------

Fix spacing for links inside code blocks, and improve a few link tooltips
in std::{io::{self, buffered::{bufreader, bufwriter}, cursor, util}, net::{self, addr}}

----------

Fix typo in link to `into` for `OsString` docs

----------

Remove tooltips that will probably become redundant in the future

----------

Apply suggestions from code review

Replacing `…std/primitive.reference.html` paths with just `reference`

Co-authored-by: Joshua Nelson <github@jyn.dev>

----------

Also replace `…std/primitive.reference.html` paths with just `reference` in `core::pin`
2021-09-25 20:04:35 +02:00
Aaron Hill
78013f296a
Don't anonymize bound region names during typeck
Once this anonymization has performed, we have no
way of recovering the original names during NLL
borrow checking. Keeping the original names allows
error messages in full NLL mode to contain the original
bound region names.

As a result, the typeck results may contain types that
differ only in the names used for their bound regions. However,
anonimization of bound regions does not guarantee that
all distinct types are unqual (e.g. not subtypes of each other).
For example, `for<'a> fn(&'a u32, &'a u32)` and
`for<'b, 'c> fn(&'b u32, &'c u32)` are subtypes of each other,
as explained here:

63cc2bb3d0/compiler/rustc_infer/src/infer/nll_relate/mod.rs (L682-L690)

Therefore, any code handling types with higher-ranked regions already
needs to handle the case where two distinct `Ty`s are 'actually'
equal.
2021-09-25 13:04:00 -05:00
bors
9620f3a84b Auto merge of #87584 - adamgemmell:dev/asm-tests, r=Amanieu
Add inline asm! tests for aarch64

Port many of the x86-only UI tests for inline asm! over to aarch64.
2021-09-25 17:14:38 +00:00
Noah Lev
dace2ee674 rustdoc: Document is_assoc_ty()
It's adapted from the old documentation for the `is_generic` field.
2021-09-25 09:50:12 -07:00
Hirochika Matsumoto
195f752109
Elaborate comment
Co-authored-by: Joshua Nelson <github@jyn.dev>
2021-09-26 01:07:10 +09:00