Commit Graph

136780 Commits

Author SHA1 Message Date
CPerezz
9abd80c076
Fix internal rustdoc broken links
As it was suggested in #81037 `SpecFromIter` is not
in the scope and therefore (even it should fail),
we get a warning when we try do document private
intems in `rust/library/alloc/`.

This fixes #81037 by adding the trait in the scope
and also adding an `allow(unused_imports)` flag so that
the compiler does not complain, Since the trait is not used
per se in the code, it's just needed to have properly documented
docs.
2021-01-18 23:47:01 +01:00
bors
d98d2f57d9 Auto merge of #80707 - oli-obk:stability_hole_const_intrinsics, r=RalfJung
Stability oddity with const intrinsics

cc `@RalfJung`

In https://github.com/rust-lang/rust/pull/80699#discussion_r551495670 `@usbalbin` realized we accepted some intrinsics as `const` without a `#[rustc_const_(un)stable]` attribute. I did some digging, and that example works because intrinsics inherit their stability from their parents... including `#[rustc_const_(un)stable]` attributes. While we may want to fix that (not sure, wasn't there just a MCPed PR that caused this on purpose?), we definitely want tests for it, thus this PR adding tests and some fun tracing statements.
2021-01-18 20:54:36 +00:00
bors
73f233b3ad Auto merge of #81159 - ssomers:btree_cleanup_search, r=Mark-Simulacrum
BTreeMap: convert search functions to methods

And further tweak the signature of `search_linear`, in preparation of a better #81094.

r? `@Mark-Simulacrum`
2021-01-18 17:30:38 +00:00
Stein Somers
4775334f36 BTreeMap: prefer bulk_steal functions over specialized ones 2021-01-18 17:23:26 +01:00
soniasingla
47c2476c68 Fixes #81109 - Typo in pointer::wrapping_sub
Signed-off-by: soniasingla <soniasingla.1812@gmail.com>
2021-01-18 20:31:47 +05:30
bors
5e91c4ecc0 Auto merge of #81165 - KodrAus:rollup-s7llxis, r=KodrAus
Rollup of 12 pull requests

Successful merges:

 - #81038 (Update Clippy)
 - #81071 (rustc_parse_format: Fix character indices in find_skips)
 - #81100 (prevent potential bug in `encode_with_shorthand`.)
 - #81105 (Initialize a few variables directly)
 - #81116 (ConstProp: Copy body span instead of querying it)
 - #81121 (Avoid logging the whole MIR body in SimplifyCfg)
 - #81123 (Update cmp.rs)
 - #81125 (Add track_caller to .steal())
 - #81128 (validation test: turn some const_err back into validation failures)
 - #81131 (Edit rustc_middle::ty::cast docs)
 - #81142 (Replace let Some(..) = with .is_some())
 - #81153 (Remove unused linkcheck exceptions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-18 14:36:30 +00:00
Ryan Levick
38b77420e9 Add tests for resolution changes 2021-01-18 14:01:09 +01:00
Daiki Ihara
8b041cd8f9 Add test case for suggestion E0283 2021-01-18 21:57:15 +09:00
Daiki Ihara
db95b5ca9b Add suggestion for impl_candidates with E0283
Update compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-01-18 21:57:15 +09:00
Ralf Jung
712d065061 remove some outdated comments regarding debug assertions 2021-01-18 13:06:01 +01:00
Ashley Mannix
33d184bfd0
Rollup merge of #81153 - jyn514:linkcheck, r=Manishearth
Remove unused linkcheck exceptions

Found while working on https://github.com/deadlinks/cargo-deadlinks/issues/133.

r? `@Manishearth`
2021-01-18 21:53:43 +10:00
Ashley Mannix
0068358ba4
Rollup merge of #81142 - wcampbell0x2a:replace-Some-with-is-some, r=jonas-schievink
Replace let Some(..) = with .is_some()
2021-01-18 21:53:41 +10:00
Ashley Mannix
d3cc598a02
Rollup merge of #81131 - pierwill:edit-rustc_middle-cast, r=varkor
Edit rustc_middle::ty::cast docs

Link to RFC 401 and add missing punctuation.
2021-01-18 21:53:40 +10:00
Ashley Mannix
8f1716c1f9
Rollup merge of #81128 - RalfJung:validation-testing, r=oli-obk
validation test: turn some const_err back into validation failures

This resolves the problem I raised at https://github.com/rust-lang/rust/pull/78407#discussion_r556732926.
r? `@oli-obk`
2021-01-18 21:53:37 +10:00
Ashley Mannix
f82100eeed
Rollup merge of #81125 - jyn514:track-caller, r=lcnr
Add track_caller to .steal()

Before:

```
thread 'rustc' panicked at 'attempt to read from stolen value', /home/joshua/rustc/compiler/rustc_data_structures/src/steal.rs:43:15
```

After:

```
thread 'rustc' panicked at 'attempt to steal from stolen value', compiler/rustc_mir/src/transform/mod.rs:423:25
```

r? `@lcnr`
2021-01-18 21:53:35 +10:00
Ashley Mannix
0654e20195
Rollup merge of #81123 - sirh3e:sirh3e-patch-1, r=sfackler
Update cmp.rs

Fixed space
2021-01-18 21:53:33 +10:00
Ashley Mannix
e1d70bc697
Rollup merge of #81121 - tmiasko:simplify-cfg-no-dbg, r=jonas-schievink
Avoid logging the whole MIR body in SimplifyCfg
2021-01-18 21:53:31 +10:00
Ashley Mannix
064e47b99e
Rollup merge of #81116 - bugadani:body-span, r=wesleywiser
ConstProp: Copy body span instead of querying it
2021-01-18 21:53:30 +10:00
Ashley Mannix
b4defec768
Rollup merge of #81105 - LingMan:init_directly, r=nagisa
Initialize a few variables directly

Currently they are declared as `mut`, get initialized to a default value, and
then possibly overwritten.

By initializing to the final value directly, they don't need to be `mut` and
it's clear that they don't get mutated elsewhere later on.
2021-01-18 21:53:28 +10:00
Ashley Mannix
d3ff9ac8e8
Rollup merge of #81100 - lcnr:encode_with_shorthand, r=oli-obk
prevent potential bug in `encode_with_shorthand`.

see https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Remove.20PredicateKind.20in.20favor.20of.20only.20Bin.E2.80.A6.20compiler-team.23397/near/223012169
2021-01-18 21:53:26 +10:00
Ashley Mannix
c7ca540da2
Rollup merge of #81071 - osa1:fix_81006, r=estebank
rustc_parse_format: Fix character indices in find_skips

Fixes #81006
2021-01-18 21:53:24 +10:00
Ashley Mannix
090ab8c02e
Rollup merge of #81038 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update

r? ``@Manishearth``
2021-01-18 21:53:22 +10:00
Ikko Ashimine
222e0e4fe2
Fix typo in simplify.rs
prexisting -> preexisting
2021-01-18 20:52:10 +09:00
bors
66eb982166 Auto merge of #81015 - jyn514:feature-gate-ptr, r=camelid
Feature-gate `pointer` and `reference` in intra-doc links

r? `@camelid`

Addresses (but does not close) https://github.com/rust-lang/rust/issues/80896.
2021-01-18 11:35:19 +00:00
oli
5bac1c9229 Only inherit const stability for methods of impl const Trait blocks 2021-01-18 11:07:35 +00:00
Ryan Levick
d829e40c7b Improve unknown external crate error 2021-01-18 12:05:07 +01:00
Guillaume Gomez
1d1ab21ad9 Remove inline script tags 2021-01-18 12:03:53 +01:00
bors
86e0ff47a0 Auto merge of #80995 - tmandry:instrument-method-checker, r=lcnr
Add tracing instrumentation to method typeck

I was recently digging into how this code works, and this instrumentation was helpful.
2021-01-18 08:39:31 +00:00
Stein Somers
de6e53a327 BTreeMap: convert search functions to methods 2021-01-18 09:31:14 +01:00
bors
0677d97293 Auto merge of #80865 - oliviacrain:proj_based, r=RalfJung
Use PlaceRef projection abstractions more consistently in rustc_mir

PlaceRef contains abstractions for dealing with the `projections` array. This PR uses these abstractions more consistently within the `rustc_mir` crate.

See associated issue: rust-lang/rust#80647.

r? `@RalfJung`
2021-01-18 05:44:40 +00:00
Joshua Nelson
d5570c2fcb Remove unused linkcheck exceptions 2021-01-17 22:36:39 -05:00
bors
93e0aedb07 Auto merge of #81090 - ssomers:btree_drainy_refactor_2, r=Mark-Simulacrum
BTreeMap: offer merge in variants with more clarity

r? `@Mark-Simulacrum`
2021-01-18 02:43:19 +00:00
Esteban Küber
70a43e07f6 Fix structured suggestion for explicit drop call 2021-01-17 16:48:52 -08:00
wcampbell
e23acc341c
Replace let Some(..) = with .is_some()
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2021-01-17 19:06:12 -05:00
Tomasz Miąsko
96e9562a7e Visit only terminators when removing landing pads
No functional changes intended
2021-01-18 00:00:00 +00:00
bors
c4df63f47f Auto merge of #80537 - ehuss:macos-posix-spawn-chdir, r=dtolnay
Don't use posix_spawn_file_actions_addchdir_np on macOS.

There is a bug on macOS where using `posix_spawn_file_actions_addchdir_np` with a relative executable path will cause `posix_spawnp` to return ENOENT, even though it successfully spawned the process in the given directory.

`posix_spawn_file_actions_addchdir_np` was introduced in macOS 10.15 first released in Oct 2019.  I have tested macOS 10.15.7 and 11.0.1.

Example offending program:

```rust
use std::fs;
use std::os::unix::fs::PermissionsExt;
use std::process::*;

fn main() {
    fs::create_dir_all("bar").unwrap();
    fs::create_dir_all("foo").unwrap();
    fs::write("foo/foo.sh", "#!/bin/sh\necho hello ${PWD}\n").unwrap();
    let perms = fs::Permissions::from_mode(0o755);
    fs::set_permissions("foo/foo.sh", perms).unwrap();
    let c = Command::new("../foo/foo.sh").current_dir("bar").spawn();
    eprintln!("{:?}", c);
}
```

This prints:

```
Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
hello /Users/eric/Temp/bar
```

I wanted to open this PR to get some feedback on possible solutions.  Alternatives:
* Do nothing.
* Document the bug.
* Try to detect if the executable is a relative path on macOS, and avoid using `posix_spawn_file_actions_addchdir_np` only in that case.

I looked at the [XNU source code](https://opensource.apple.com/source/xnu/xnu-6153.141.1/bsd/kern/kern_exec.c.auto.html), but I didn't see anything obvious that would explain the behavior.  The actual chdir succeeds, it is something else further down that fails, but I couldn't see where.

EDIT: I forgot to mention, relative exe paths with `current_dir` in general are discouraged (see #37868).  I don't know if #37868 is fixable, since normalizing it would change the semantics for some platforms. Another option is to convert the executable to an absolute path with something like joining the cwd with the new cwd and the executable, but I'm uncertain about that.
2021-01-17 23:44:46 +00:00
Eric Huss
6e467b74cd Fix test to work with remote-test-server.
remote-test-server does not set the current_dir, and leaves it
as `/`.
2021-01-17 14:03:23 -08:00
bors
4253153db2 Auto merge of #80679 - jackh726:predicate-kind-take2, r=lcnr
Remove PredicateKind and instead only use Binder<PredicateAtom>

Originally brought up in https://github.com/rust-lang/rust/pull/76814#discussion_r546858171

r? `@lcnr`
2021-01-17 20:49:11 +00:00
Joshua Nelson
fc53594756 Feature-gate pointer and reference in intra-doc links
- Only feature gate associated items
- Add docs to unstable book
2021-01-17 15:27:35 -05:00
pierwill
34debb640b Edit rustc_middle::ty::cast docs
Link to RFC 401 and add missing punctuation.
2021-01-17 11:30:18 -08:00
Ralf Jung
514543a8b7 validation test: turn some const_err back into validation failures 2021-01-17 19:49:20 +01:00
bors
1f0fc02cc8 Auto merge of #80524 - jyn514:unknown-tool-lints, r=flip1995,matthewjasper
Don't make tools responsible for checking unknown and renamed lints

Previously, clippy (and any other tool emitting lints) had to have their
own separate UNKNOWN_LINTS pass, because the compiler assumed any tool
lint could be valid. Now, as long as any lint starting with the tool
prefix exists, the compiler will warn when an unknown lint is present.

This may interact with the unstable `tool_lint` feature, which I don't entirely understand, but it will take the burden off those external tools to add their own lint pass, which seems like a step in the right direction to me.

- Don't mark `ineffective_unstable_trait_impl` as an internal lint
- Use clippy's more advanced lint suggestions
- Deprecate the `UNKNOWN_CLIPPY_LINTS` pass (and make it a no-op)
- Say 'unknown lint `clippy::x`' instead of 'unknown lint x'

This is tested by existing clippy tests. When https://github.com/rust-lang/rust/pull/80527 merges, it will also be tested in rustdoc tests. AFAIK there is no way to test this with rustc directly.
2021-01-17 17:52:01 +00:00
Eric Huss
fcbcc97576 Add test for Command::current_dir behavior. 2021-01-17 09:51:02 -08:00
Eric Huss
a938725ef7 Don't use posix_spawn_file_actions_addchdir_np on macOS. 2021-01-17 09:51:02 -08:00
Jack Huey
c4376ba24a
Whitespace and typo 2021-01-17 12:50:04 -05:00
Jack Huey
d797a85491 Add comment about Encodable/Decodable impl 2021-01-17 12:32:05 -05:00
Joshua Nelson
394d7018b9 Add track_caller to .steal()
Before:

```
thread 'rustc' panicked at 'attempt to read from stolen value', /home/joshua/rustc/compiler/rustc_data_structures/src/steal.rs:43:15
```

After:

```
thread 'rustc' panicked at 'attempt to steal from stolen value', compiler/rustc_mir/src/transform/mod.rs:423:25
```
2021-01-17 12:27:20 -05:00
LeSeulArtichaut
2136a5cfad Fix unused_unsafe label with `unsafe_block_in_unsafe_fn 2021-01-17 16:42:27 +01:00
Marvin Huber
7276b6c328
Update cmp.rs
Fixed space
2021-01-17 16:11:48 +01:00
Tomasz Miąsko
c7bad7ba5d Avoid logging the whole MIR body in SimplifyCfg 2021-01-17 15:57:21 +01:00