Commit graph

123887 commits

Author SHA1 Message Date
Jethro Beekman
c8cdcc8e51 Fix duplicate maybe_uninit_extra attribute 2020-07-20 12:44:37 +02:00
David Wood
47756bb0fa
shim: adjust valid shim asserts
This commit makes valid shim asserts more specific - checking for the
specific types that are valid for a given type of shim - and removes
asserts for types which require substitutions.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:32 +01:00
David Wood
19e849516e
debuginfo: add type metadata for params
This commit adds type metadata for generic parameters (that arise from
polymorphization). Generic parameter metadata is considered zero-sized
and named after the generic parameter.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:31 +01:00
David Wood
5bf2c7d4fe
debuginfo: no type metadata if substs reqd
This commit skips generating debuginfo type metadata if substitutions
are required by the type. This avoids ICEs that result from layouts
of types with substitutions being computed.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:29 +01:00
David Wood
842fa0ce3e
ty: add doc comments to Generics methods
This commit adds doc comments to the `param_at`, `region_param` and
`const_param` methods on the `Generics` struct.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:27 +01:00
David Wood
ce7c48fa15
trait_sel: only test predicates w/ no substs
This commit modifies the `substitute_normalize_and_test_predicates`
query, renaming it to `impossible_predicates` and only checking
predicates which do not require substs. By making this change,
polymorphization doesn't have to explicitly support vtables.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:26 +01:00
David Wood
c6ed442f40
ty: STILL_FURTHER_SPECIALIZABLE w/out prnt subst
This commit modifies the `STILL_FURTHER_SPECIALIZABLE` flag so that the
flag isn't set by the parent substs of closures or generators.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:25 +01:00
David Wood
576deef691
mir: rename should_monomorphize_locally
This commit renames `should_monomorphize_locally` to
`should_codegen_locally` which better describes what the function
determines once polymorphization is added.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:24 +01:00
David Wood
996bc9abb5
mir: avoid double substitution
This commit avoids a natural, free-range double substitution error by
monomorphizing the projection element before getting the type.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 11:23:22 +01:00
bors
71384101ea Auto merge of #74010 - pierwill:pierwill-o-notation, r=GuillaumeGomez
Use italics for O notation

In documentation, I think it makes sense to italicize O notation (*O(n)*) as opposed to using back-ticks (`O(n)`). Visually, back-ticks focus the reader on the literal characters being used, making them ideal for representing code. Using italics, as far I can tell, more closely follows typographic conventions in mathematics and computer science.

Just a suggestion, of course! 😇
2020-07-20 10:19:58 +00:00
David Wood
ceac273e60
wf: check foreign fn decls for well-formedness
This commit extends current well-formedness checking to apply to foreign
function declarations, re-using the existing machinery for regular
functions. In doing this, later parts of the compiler (such as the
`improper_ctypes` lint) can rely on being operations not failing as a
result of invalid code which would normally be caught earlier.

Signed-off-by: David Wood <david@davidtw.co>
2020-07-20 10:28:12 +01:00
bors
05630b06fd Auto merge of #74540 - alexcrichton:std-no-backtrace, r=Mark-Simulacrum
std: Fix compilation without backtrace feature

This should hopefully handle #74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
2020-07-20 06:09:42 +00:00
pierwill
76b8420168 Use italics for O notation
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2020-07-19 21:43:39 -07:00
bors
891e6fee57 Auto merge of #74543 - Manishearth:rollup-m5w6hyg, r=Manishearth
Rollup of 9 pull requests

Successful merges:

 - #73618 (Documentation for the false keyword)
 - #74486 (Improve Read::read_exact documentation)
 - #74514 (Do not clobber RUSTDOCFLAGS)
 - #74516 (do not try fetching the ancestors of errored trait impls)
 - #74520 (include backtrace folder in rust-src component)
 - #74523 (Improve documentation for `core::fmt` internals)
 - #74527 (Add myself to toolstate change notifications for rustfmt)
 - #74534 (Only skip impls of foreign unstable traits)
 - #74536 (fix documentation surrounding the `in` and `for` keywords)

Failed merges:

r? @ghost
2020-07-20 02:43:31 +00:00
Manish Goregaokar
27947b69f9
Rollup merge of #74536 - Nicholas-Baron:master, r=joshtriplett
fix documentation surrounding the `in` and `for` keywords

Addresses #74529

The `in` keyword incorrectly referenced the `Iterator` trait. This reference was changed to `IntoIterator` without changing the underlying link.

Additionally, the `IntoIterator` trait was referenced towards the end of the documentation for `for`. An additional reference was added earlier and broadened the existing documentation from any iterator to anything that can be turned into an iterator.
2020-07-19 19:12:45 -07:00
Manish Goregaokar
e8fc993409
Rollup merge of #74534 - Mark-Simulacrum:rustdoc-stability, r=Manishearth
Only skip impls of foreign unstable traits

Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.

Fixes #74531.
2020-07-19 19:12:43 -07:00
Manish Goregaokar
42273f6537
Rollup merge of #74527 - calebcartwright:rustfmt-toolstate-maintainers, r=Mark-Simulacrum
Add myself to toolstate change notifications for rustfmt

I'd like to get the toolstate change notifications for rustfmt as well so that I'll know when things break.

Have spoken with @topecongiro about this offline already.
2020-07-19 19:12:42 -07:00
Manish Goregaokar
e762f978e1
Rollup merge of #74523 - sollyucko:patch-1, r=Mark-Simulacrum
Improve documentation for `core::fmt` internals

The public interface of `core::fmt` is well-documented, but the internals have very minimal documentation.
2020-07-19 19:12:40 -07:00
Manish Goregaokar
42f6ed40e8
Rollup merge of #74520 - RalfJung:backtrace-src, r=Mark-Simulacrum
include backtrace folder in rust-src component

libstd has a [mandatory dependency on this code](https://github.com/rust-lang/rust/pull/73441/files#diff-242481015141f373dcb178e93cffa850), ergo we need to include it in rust-src.

r? @oli-obk
Fixes https://github.com/rust-lang/rust/issues/74506
2020-07-19 19:12:38 -07:00
Manish Goregaokar
55c4057f55
Rollup merge of #74516 - lcnr:min-specialization-ice, r=matthewjasper
do not try fetching the ancestors of errored trait impls

fixes #74483

While building the specialization graph, we use `tcx.all_impls` which discards impls with incorrect self types,
we do however call `trait_def.ancestors` with these impls which caused an ICE as they aren't part of the
specialization graph.
2020-07-19 19:12:37 -07:00
Manish Goregaokar
3981386b8e
Rollup merge of #74514 - Mark-Simulacrum:nightly-rustc-docs, r=ollie27
Do not clobber RUSTDOCFLAGS

We were setting these in both Builder::cargo and here, which ended up only setting the first of the two.

Fixes #74511
2020-07-19 19:12:35 -07:00
Manish Goregaokar
03a47279d3
Rollup merge of #74486 - poliorcetics:read-exact-doc-point-to-read, r=Mark-Simulacrum
Improve Read::read_exact documentation

Fixes #72186.

For now I simply added a link to `Read::read` and held off changing the text in `Read::read_exact`. I can do it if it is deemed necessary.

@rustbot modify labels: C-enhancement, T-libs
2020-07-19 19:12:33 -07:00
Manish Goregaokar
d527c7db67
Rollup merge of #73618 - poliorcetics:false-keyword, r=jyn514
Documentation for the false keyword

Partial fix of #34601.

Short documentation for the false keyword mainly pointing to the `true` keyword.
2020-07-19 19:12:32 -07:00
Alex Crichton
028f8d7b85 std: Fix compilation without backtrace feature
This should hopefully handle #74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
2020-07-19 17:30:29 -07:00
Nicholas Baron
09d55292ed
Update src/libstd/keyword_docs.rs
Clear up wording regarding the iterator and usage of `break`.

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2020-07-19 17:01:36 -07:00
bors
2c21a6f3a8 Auto merge of #74495 - shepmaster:bootstrap-dist-target-files, r=Mark-Simulacrum
Teach bootstrap install and dist commands about TargetSelection

With this, we can now use a target JSON file to build a
cross-compiler:

```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```

r? @Mark-Simulacrum
2020-07-19 22:50:46 +00:00
Gary Guo
4fb260bb32 Guard against non-monomorphized type_id intrinsic call 2020-07-19 23:33:12 +01:00
Nicholas-Baron
f268525d96 Linked the earlier mention of IntoIterator in the keyword 'for' docs 2020-07-19 14:06:55 -07:00
Nicholas-Baron
6c493df0f8 Mentioned IntoIterator in keyword 'in' docs 2020-07-19 14:05:45 -07:00
Nicholas-Baron
940ceb1a43 Mentioned IntoIterator earlier in keyword 'for' docs 2020-07-19 14:03:52 -07:00
Mark Rousskov
e24a0172b0 Only skip impls of foreign unstable traits
Previously unstable impls were skipped, which meant that any impl with an
unstable method would get skipped.
2020-07-19 16:39:20 -04:00
Alexis Bourget
471dd52d77 Fix merge conflict with recent PR 2020-07-19 22:15:44 +02:00
Dylan MacKenzie
6100b74fbc Advertise correct stable version for const control flow 2020-07-19 12:10:13 -07:00
Caleb Cartwright
7dba34fd6b tools: update rustfmt toolstate maintainers 2020-07-19 13:10:38 -05:00
Jake Goulding
57614da715 Teach bootstrap install and dist commands about TargetSelection
With this, we can now use a target JSON file to build a
cross-compiler:

```
x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin
```
2020-07-19 13:04:33 -04:00
Gabriel Smith
c60a035658 Add test for an explicit non-'static lifetime in a const argument 2020-07-19 12:53:51 -04:00
Gabriel Smith
69d5dd6a50 disallow non-static lifetimes in const generics
This has been put in place to patch over an ICE caused when we encounter
a non-static lifetime in a const generic during borrow checking. This
restriction may be relaxed in the future, but we need more discussion
before then, and in the meantime we should still deal with this ICE.

Fixes issue #60814
2020-07-19 12:52:36 -04:00
Solomon Ucko
a462e7c1d0 Document core::fmt::rt::v1::Count 2020-07-19 11:24:24 -04:00
Tomasz Miąsko
58b862072c Document AddressSanitizer memory leak detection defaults 2020-07-19 17:12:44 +02:00
Tomasz Miąsko
251878ebc4 Remove CC & CFLAGS from MemorySanitizer example
They are now unnecessary for projects written in Rust, since
backtrace-rs used by the standard library has only Rust dependencies.
2020-07-19 17:11:33 +02:00
Lzu Tao
1314d31fb5 Rewrite extract_version_range 2020-07-19 15:08:35 +00:00
Ralf Jung
d7a36d8964 include backtrace folder in rust-src component 2020-07-19 16:53:53 +02:00
Mark Rousskov
be43319b17 Do not clobber RUSTDOCFLAGS
We were setting these in both Builder::cargo and here, which ended up only
setting the first of the two.
2020-07-19 10:42:06 -04:00
Poliorcetics
a459fc4e31
Apply suggestions from review
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-07-19 16:28:18 +02:00
bors
d7f9451634 Auto merge of #74518 - Manishearth:rollup-jfmnh1r, r=Manishearth
Rollup of 4 pull requests

Successful merges:

 - #74333 (Deny unsafe operations in unsafe functions in libstd/alloc.rs)
 - #74356 (Remove combine function)
 - #74419 (Add a thumbv4t-none-eabi target)
 - #74485 (More intra-doc links, add explicit exception list to linkchecker)

Failed merges:

 - #74486 (Improve Read::read_exact documentation)

r? @ghost
2020-07-19 14:17:08 +00:00
Manish Goregaokar
1636961a0e
Rollup merge of #74485 - Manishearth:more-intra-doc, r=jyn514
More intra-doc links, add explicit exception list to linkchecker

Fixes the broken links behind #32553

Progress on #32130 and #32129 except for a small number of links. Instead of whitelisting entire files, I've changed the code to whitelist specific links in specific files, and added a comment requesting people explain the reasons they add exceptions. I'm not sure if we should close those issues in favor of the already filed intra-doc link issues.
2020-07-19 07:02:27 -07:00
Manish Goregaokar
90164587dc
Rollup merge of #74419 - Lokathor:gba-target, r=jonas-schievink
Add a thumbv4t-none-eabi target

(cc @ketsuban, one of the few other Rust users who programs for GBA.)

---

**EDIT:** This is now a more general `thumbv4t-none-eabi` PR! See [this comment](https://github.com/rust-lang/rust/pull/74419#issuecomment-660391579)

---

Now that the PSP officially has an official target within Rust, well as the lead of the `gba` crate I can't _not_ add a GBA target as well.

I know that the [target tier policy](https://github.com/rust-lang/rfcs/pull/2803) isn't ratified and official, but I'll use it as an outline (cc @joshtriplett):
* Designated Developer: Lokathor
* Naming consistent with any existing targets
* Doesn't create Rust project legal issues.
* No license issues
* Uses the standard Apache/mit license.
* Rust tooling users don't have to accept any new licensing requirements
* Does not support hosting rust tooling.
* Doesn't require linking in proprietary code to obtain a functional binary. However, you will need to do some post-build steps to turn the ELF file into a usable GBA ROM (either for an emulator or for the actual hardware).
* This is a `no_std` environment, without even a standard global allocator, so this adds no new code to `alloc` or `std`.
* The process of building for this target is documented in the `gba` crate ([link](https://rust-console.github.io/gba/development-setup.html)). Well, the docs there are currently a little out of date, they're back on using `cargo-xbuild`, but the crate docs there will get updated once this target is available.
* This places no new burden on any other targets
* Does not break any existing targets.

I'm not fully confident in specifying the same linker script for all possible projects, so I'm currently just not giving a linker script at all, and users can continue to select their own linker script by using `-C` to provide a linker arg.

I added the file, and added it to the `supported_targets!` macro usage, and I think that's all there is to do.
2020-07-19 07:02:26 -07:00
Manish Goregaokar
cc4e880c62
Rollup merge of #74356 - lzutao:rm_combine, r=LukasKalbertodt
Remove combine function

Comparing two array directly helps generate better assert message.
Resolve https://github.com/rust-lang/rust/pull/74271/files#r454538514
2020-07-19 07:02:24 -07:00
Manish Goregaokar
2f3d64fc2f
Rollup merge of #74333 - poliorcetics:std-alloc-unsafe-op-in-unsafe-fn, r=LukasKalbertodt
Deny unsafe operations in unsafe functions in libstd/alloc.rs

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/alloc.rs`.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn
2020-07-19 07:02:22 -07:00
Alexis Bourget
b7bf3c83c4 Remove useless link to bool primitive 2020-07-19 15:58:41 +02:00