Commit Graph

137208 Commits

Author SHA1 Message Date
Benoît du Garreau
9880560a1c Inline methods of Path and OsString 2021-01-22 18:46:00 +01:00
Dániel Buga
aa4f5833e1 Only query associated_items once 2021-01-22 18:36:33 +01:00
Dániel Buga
ee639de007 Only guess span if absolutely necessary 2021-01-22 18:36:33 +01:00
Dániel Buga
d63b278c2f Only scan through assoc items once in check_impl_items_against_trait 2021-01-22 18:36:30 +01:00
b-naber
3ba6cf13f4 bless tests 2021-01-22 18:31:25 +01:00
Yoshua Wuyts
7d102383f9 Add doc aliases for memory allocations
- Vec::with_capacity / Box::new -> alloc + malloc
- Box::new_zeroed -> calloc
- Vec::{reserve,reserve_exact,try_reserve_exact,shrink_to_fit,shrink_to} -> realloc
2021-01-22 18:15:28 +01:00
flip1995
e25959b417
Make more traits of the From/Into family diagnostic items
Following traits are now diagnostic items:
- `From` (unchanged)
- `Into`
- `TryFrom`
- `TryInto`

This also adds symbols for those items:
- `into_trait`
- `try_from_trait`
- `try_into_trait`
2021-01-22 18:07:00 +01:00
Yoshua Wuyts
0c8db16a67 Add core::stream::Stream
This patch adds the `core::stream` submodule and implements `core::stream::Stream` in accordance with RFC2996.

Add feedback from @camelid
2021-01-22 17:41:56 +01:00
b-naber
5ddad99a56 add and update tests 2021-01-22 17:07:27 +01:00
b-naber
728d257839 improve diagnostics for angle args 2021-01-22 17:07:27 +01:00
bors
b814b63983 Auto merge of #81271 - m-ou-se:rollup-xv7gq3w, r=m-ou-se
Rollup of 10 pull requests

Successful merges:

 - #80573 (Deny rustc::internal lints for rustdoc and clippy)
 - #81173 (Expand docs on Iterator::intersperse)
 - #81194 (Stabilize std::panic::panic_any.)
 - #81202 (Don't prefix 0x for each segments in `dbg!(Ipv6)`)
 - #81225 (Make 'docs' nullable in rustdoc-json output)
 - #81227 (Remove doctree::StructType)
 - #81233 (Document why not use concat! in dbg! macro)
 - #81236 (Gracefully handle loop labels missing leading `'` in different positions)
 - #81241 (Turn alloc's force_expr macro into a regular macro_rules.)
 - #81242 (Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-22 16:04:36 +00:00
Mara Bos
9c2a5776b2
Rollup merge of #81242 - jyn514:const-cap, r=sfackler
Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time

Previously, it would usually get computed by LLVM, but this enforces it. This removes the need for the comment saying "LLVM is smart enough".

I don't expect this to make a performance difference, but I do think it makes the performance properties easier to reason about.
2021-01-22 14:30:22 +00:00
Mara Bos
70597f28f6
Rollup merge of #81241 - m-ou-se:force-expr-macro-rules, r=oli-obk
Turn alloc's force_expr macro into a regular macro_rules.

This turns `alloc`'s `force_expr` macro into a regular `macro_rules`.

Otherwise rust-analyzer doesn't understand `vec![]`. See https://github.com/rust-analyzer/rust-analyzer/issues/7349 and https://github.com/rust-lang/rust/pull/81080#issuecomment-764741721

Edit: See https://github.com/rust-lang/rust/pull/81241#issuecomment-764812660 for a discussion of alternatives.
2021-01-22 14:30:21 +00:00
Mara Bos
3682a06dcf
Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk
Gracefully handle loop labels missing leading `'` in different positions

Fix #81192.

* Account for labels when suggesting `loop` instead of `while true`
* Suggest `'a` when given `a` only when appropriate
* Add loop head span to hir
* Tweak error for invalid `break expr`
* Add more misspelled label tests
* Avoid emitting redundant "unused label" lint
* Parse loop labels missing a leading `'`

Each commit can be reviewed in isolation.
2021-01-22 14:30:19 +00:00
Mara Bos
81a60b7aa8
Rollup merge of #81233 - lzutao:dbg, r=KodrAus
Document why not use concat! in dbg! macro

Original title: Reduce code generated by `dbg!` macro
The expanded code before/after: <https://rust.godbolt.org/z/hE3j95>.

---

We cannot use `concat!` since `file!` could contains `{` or the expression is a block (`{ .. }`).
Using it will generated malformed format strings.
So let's document this reason why we don't use `concat!` macro at all.
2021-01-22 14:30:17 +00:00
Mara Bos
2ceee72427
Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514
Remove doctree::StructType

Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`.

r? `@jyn514`
2021-01-22 14:30:16 +00:00
Mara Bos
1cc13b4f5a
Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514
Make 'docs' nullable in rustdoc-json output

Matches the backing better, and makes it so there's a difference between 'empty docs' and 'no docs'.
2021-01-22 14:30:14 +00:00
Mara Bos
950ed27e8b
Rollup merge of #81202 - lzutao:dbg_ipv6, r=Amanieu
Don't prefix 0x for each segments in `dbg!(Ipv6)`

Fixes #81182
2021-01-22 14:30:12 +00:00
Mara Bos
b59f6e05ef
Rollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se
Stabilize std::panic::panic_any.

This stabilizes `std::panic::panic_any`.
2021-01-22 14:30:11 +00:00
Mara Bos
226fe55057
Rollup merge of #81173 - lukaslueg:intersperse_docs, r=m-ou-se
Expand docs on Iterator::intersperse

Unstable feature in #79524. This expands on the docs to bring them more in line with how other methods of `Iterator` are demonstrated.
2021-01-22 14:30:09 +00:00
Mara Bos
98c03644b1
Rollup merge of #80573 - jyn514:tool-lints, r=GuillaumeGomez
Deny rustc::internal lints for rustdoc and clippy

- Fix rustc::internal lints for rustdoc
- Deny internal lints only for rustdoc and clippy (previously the lints were ignored for clippy because -Zunstable-options didn't get passed)
2021-01-22 14:30:03 +00:00
bors
f2de221b00 Auto merge of #81101 - tmiasko:combine-now, r=nagisa
Combine instructions immediately
2021-01-22 13:10:48 +00:00
bors
bbc01bb624 Auto merge of #80558 - lcnr:gat-variance, r=matthewjasper
require gat substs to be invariant

fixes #69184, fixes #80766

r? `@matthewjasper` probably
2021-01-22 10:12:05 +00:00
Arlie Davis
59855e0bbf Remove delay-binding for Win XP and Vista
The minimum supported Windows version is now Windows 7. Windows XP
and Windows Vista are no longer supported; both are already broken, and
require extra steps to use.

This commit removes the delayed-binding support for Windows API
functions that are present on all supported Windows targets. This has
several benefits: Removes needless complexity. Removes a load and
dynamic call on hot paths in mutex acquire / release. This may have
performance benefits.

* "Drop official support for Windows XP"
  https://github.com/rust-lang/compiler-team/issues/378

* "Firefox has ended support for Windows XP and Vista"
  https://support.mozilla.org/en-US/kb/end-support-windows-xp-and-vista
2021-01-22 02:02:39 -08:00
Ralf Jung
ccaabc9479 re-bless ui tests 2021-01-22 10:56:28 +01:00
Ralf Jung
0c7fd2c685 expand successful-promotion test a bit 2021-01-22 10:36:30 +01:00
Ralf Jung
f62cecd807 do promote array indexing if we know it is in-bounds 2021-01-22 10:36:25 +01:00
Ralf Jung
69a997bef2 update const_err description 2021-01-22 10:21:52 +01:00
Ralf Jung
5be27b7a70 avoid promoting division, modulo and indexing operations that could fail 2021-01-22 10:21:49 +01:00
Dániel Buga
9988821a04 Move missing_item check inside condition 2021-01-22 08:22:15 +01:00
Dániel Buga
58a90de9ad No peeking 2021-01-22 08:14:25 +01:00
Dániel Buga
3e9f27dadf Remove unnecessary closure 2021-01-22 08:06:01 +01:00
slo1
a4db851302 Update src/test/ui/command/command-setgroups.rs to ignore windows 2021-01-21 22:42:38 -08:00
slo1
23f9314327 Update src/test/ui/command/command-setgroups.rs
Co-authored-by: Ashley Mannix <kodraus@hey.com>
2021-01-21 22:42:38 -08:00
slo1
41e6b23000 Add setgroups to std::os::unix::process::CommandExt 2021-01-21 22:42:38 -08:00
bors
25f39fe802 Auto merge of #81135 - jyn514:no-backticks, r=flip1995
Fix formatting for removed lints

- Don't add backticks for the reason a lint was removed. This is almost
never a code block, and when it is the backticks should be in the reason
itself.
- Don't assume clippy is the only tool that needs to be checked for
backwards compatibility

I split this out of https://github.com/rust-lang/rust/pull/80527/ because it kept causing tests to fail, and it's a good change to have anyway.

r? `@flip1995`
2021-01-22 06:13:19 +00:00
Esteban Küber
9e82329c8f Do not suggest using a break label when one is already present 2021-01-21 21:43:29 -08:00
Esteban Küber
7698807770 Fix clippy and comment 2021-01-21 21:43:28 -08:00
Esteban Küber
8c5dafdcb8 Parse loop labels missing a leading '
When encountering the following typo:

```rust
a: loop { break 'a; }
```

provide an appropriate suggestion.
2021-01-21 21:41:47 -08:00
Esteban Küber
74ddaf000c Avoid emitting redundant "unused label" lint 2021-01-21 21:41:46 -08:00
Esteban Küber
c065234b34 Add more misspelled label tests 2021-01-21 21:41:46 -08:00
Esteban Küber
8a13abba1d Tweak error for invalid break expr
Point at loop head on invalid `break expr`.
Suggest removing `expr` or using label if available.
2021-01-21 21:41:46 -08:00
Esteban Küber
060dba67b7 Add loop head span to hir 2021-01-21 21:41:46 -08:00
Esteban Küber
a701ff981d Suggest 'a when given a only when appropriate
When encountering a name `a` that isn't resolved, but a label `'a` is
found in the current ribs, only suggest `'a` if this name is the value
expression of a `break` statement.

Solve FIXME.
2021-01-21 21:41:46 -08:00
Esteban Küber
707ce2b798 Account for labels when suggesting loop instead of while true 2021-01-21 21:41:46 -08:00
Aaron Hill
ccfc292999
Refactor token collection to capture trailing token immediately 2021-01-22 00:33:03 -05:00
Joshua Nelson
0797ffec09 Deny internal lints for rustdoc 2021-01-21 23:05:52 -05:00
Joshua Nelson
a194881991 Fix rustc::internal lints on rustdoc 2021-01-21 22:25:59 -05:00
bors
dc1eee2f25 Auto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkov
Force token collection to run when parsing nonterminals

Fixes #81007

Previously, we would fail to collect tokens in the proper place when
only builtin attributes were present. As a result, we would end up with
attribute tokens in the collected `TokenStream`, leading to duplication
when we attempted to prepend the attributes from the AST node.

We now explicitly track when token collection must be performed due to
nomterminal parsing.
2021-01-22 02:42:38 +00:00
Rune Tynan
26565f05c0
Bump format version 2021-01-21 21:18:31 -05:00