Commit Graph

93400 Commits

Author SHA1 Message Date
VeryTastyTomato
a759565763
Fix data types indication
Fix the data types indication in basic examples of the Trait std::fmt::LowerExp and std::fmt::UpperExp.
Since there aren’t any type annotation on the let statement using the number 42.0, they are of type f64 according to The Book:
https://doc.rust-lang.org/book/ch03-02-data-types.html#floating-point-types
2019-05-19 13:51:46 +00:00
bors
ce41e48362 Auto merge of #60937 - RalfJung:miri, r=oli-obk
update Miri

r? @oli-obk
2019-05-19 08:56:24 +00:00
bors
e0d2f7462b Auto merge of #60760 - GuillaumeGomez:generic-display, r=varkor,badboy
Fix display of const generics in rustdoc

<img width="745" alt="Screenshot 2019-05-18 at 15 45 22" src="https://user-images.githubusercontent.com/3050060/57970638-04854e80-7984-11e9-9f04-da6b51ec8bc7.png">

Part of #60737.

cc @varkor

r? @badboy
2019-05-19 06:06:12 +00:00
bors
26ab32499c Auto merge of #60949 - Centril:rollup-f918e1v, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #60370 (Mark core::alloc::Layout::from_size_align_unchecked const)
 - #60678 (Stabilize vecdeque_rotate)
 - #60924 (Explain that ? converts the error type using From)
 - #60931 (Use iter() for iterating arrays by slice)
 - #60934 (Declare DefIndex with the newtype_index macro)
 - #60943 (fix copy-paste typo in docs for ptr::read_volatile)
 - #60945 (Simplify BufRead::fill_buf doc example using NLL)
 - #60947 (Fix typos in docs of GlobalAlloc)

Failed merges:

r? @ghost
2019-05-19 01:56:14 +00:00
Mazdak Farrokhzad
9389c69415
Rollup merge of #60947 - blkerby:global_alloc_typo, r=jonas-schievink
Fix typos in docs of GlobalAlloc
2019-05-19 02:31:46 +02:00
Mazdak Farrokhzad
f9d58c7188
Rollup merge of #60945 - blkerby:fill_buf_nll_doc_example, r=shepmaster
Simplify BufRead::fill_buf doc example using NLL

With non-lexical lifetimes, in this example it is no longer necessary to use a block to end the borrow early.
2019-05-19 02:31:44 +02:00
Mazdak Farrokhzad
94da30728f
Rollup merge of #60943 - blkerby:master, r=Mark-Simulacrum
fix copy-paste typo in docs for ptr::read_volatile
2019-05-19 02:31:43 +02:00
Mazdak Farrokhzad
7cbca5931e
Rollup merge of #60934 - fabric-and-ink:defindex_with_newtype_macro, r=petrochenkov
Declare DefIndex with the newtype_index macro

See #60666
2019-05-19 02:31:42 +02:00
Mazdak Farrokhzad
de39eb81ed
Rollup merge of #60931 - cuviper:array-iter, r=KodrAus
Use iter() for iterating arrays by slice

These `into_iter()` calls will change from iterating references to
values if we ever get `IntoIterator` for arrays, which may break the
code using that iterator. Calling `iter()` is future proof.
2019-05-19 02:31:40 +02:00
Mazdak Farrokhzad
80d372f7cd
Rollup merge of #60924 - estebank:try-msg, r=petrochenkov
Explain that ? converts the error type using From

Fix #60917.
2019-05-19 02:31:39 +02:00
Mazdak Farrokhzad
dc7cbb697b
Rollup merge of #60678 - DutchGhost:master, r=scottmcm
Stabilize vecdeque_rotate

This PR stabilizes the vecdeque_rotate feature.
r? @scottmcm

Closes https://github.com/rust-lang/rust/issues/56686
2019-05-19 02:31:35 +02:00
Mazdak Farrokhzad
7885dfc623
Rollup merge of #60370 - Richard-W:const-layout-construction, r=sfackler
Mark core::alloc::Layout::from_size_align_unchecked const

Makes it possible (pending stabilization of #57563 (`const_fn`)) to rewrite code like

```rust
const BUFFER_SIZE: usize = 0x2000;
const BUFFER_ALIGN: usize = 0x1000;

fn foo() {
  let layout = std::alloc::Layout::from_size_align(BUFFER_SIZE, BUFFER_ALIGN)
    .unwrap();
  let buffer = std::alloc::alloc(layout);
}
```
to
```rust
const BUFFER_LAYOUT: std::alloc::Layout = unsafe {
  std::alloc::Layout::from_size_align_unchecked(0x2000, 0x1000)
};

fn foo() {
  let buffer = std::alloc::alloc(BUFFER_LAYOUT);
}
```

which (although `unsafe` is used) looks somewhat cleaner and is easier to read.
2019-05-19 02:31:32 +02:00
Brent Kerby
86cda2d48e Fix typos in docs of GlobalAlloc 2019-05-18 16:22:59 -06:00
bors
963184bbb6 Auto merge of #60093 - GuillaumeGomez:fix-attrs-pos, r=Manishearth
Fix attrs pos

Fixes #60042.

Screenshot:

<img width="438" alt="Screenshot 2019-05-12 at 15 02 25" src="https://user-images.githubusercontent.com/3050060/57582606-1455ec00-74c7-11e9-9d4e-5ec4da4de7dd.png">

r? @rust-lang/rustdoc
2019-05-18 20:49:22 +00:00
Brent Kerby
01cf36ebde Simplify BufRead doc example using NLL 2019-05-18 13:30:44 -06:00
bors
0f40ad9990 Auto merge of #60940 - Manishearth:clippyup, r=Manishearth
Update clippy

Contains https://github.com/rust-lang/rust-clippy/pull/4110

Should fix RLS

r? @ghost
2019-05-18 17:57:55 +00:00
Brent Kerby
13a00963a6
fix copy-paste typo in docs for ptr::read_volatile 2019-05-18 10:03:12 -06:00
Manish Goregaokar
0789091a68 Update clippy 2019-05-18 08:32:50 -07:00
bors
9a9df55f07 Auto merge of #60252 - davidtwco:issue-57672, r=Mark-Simulacrum
Don't suggest changing extern crate w/ alias to use.

Fixes #57672.
2019-05-18 15:07:38 +00:00
Guillaume Gomez
2caeaf54a1 Fix display of const generics in rustdoc 2019-05-18 15:44:19 +02:00
Ralf Jung
5f5e30fd54 update miri 2019-05-18 14:40:53 +02:00
Ralf Jung
a226b53b58 expand comment in StorageLive 2019-05-18 14:40:53 +02:00
Fabian Drinck
b18de52080 Declare DefIndex with the newtype_index macro 2019-05-18 13:19:33 +02:00
bors
b8aa422a78 Auto merge of #60386 - Goirad:sgx-ignore-tests, r=nikomatsakis
Added ignore-sgx for appropriate tests in src/test

These are all the tests that make sense to ignore when targeting fortanix-unknonw-sgx, at least in test/runpass. Other suites not yet covered.
2019-05-18 09:04:14 +00:00
Josh Stone
90dd35918d Use iter() for iterating arrays by slice
These `into_iter()` calls will change from iterating references to
values if we ever get `IntoIterator` for arrays, which may break the
code using that iterator. Calling `iter()` is future proof.
2019-05-17 19:56:35 -07:00
bors
548add7f61 Auto merge of #60910 - nnethercote:avoid-some-unnecessary-interning, r=petrochenkov
Avoid some unnecessary interning

r? @petrochenkov
2019-05-18 02:10:21 +00:00
bors
a614cee22e Auto merge of #49799 - hdhoang:46205_deny_incoherent_fundamental_impls, r=nikomatsakis
lint: convert incoherent_fundamental_impls into hard error

*Summary for affected authors:* If your crate depends on one of the following crates, please upgrade to a newer version:
- gtk-rs: upgrade to at least 0.4
- rusqlite: upgrade to at least 0.14
- nalgebra: upgrade to at least 0.15, or the last patch version of 0.14
- spade: upgrade or refresh the Cargo.lock file to use version 1.7
- imageproc: upgrade to at least 0.16 (newer versions no longer use nalgebra)

implement #46205

r? @nikomatsakis
2019-05-17 23:06:51 +00:00
bors
73a3a90d25 Auto merge of #60920 - Manishearth:rollup-p4xp4gk, r=Manishearth
Rollup of 4 pull requests

Successful merges:

 - #60791 (Update books)
 - #60891 (Allow claiming issues with triagebot)
 - #60901 (Handle more string addition cases with appropriate suggestions)
 - #60902 (Prevent Error::type_id overrides)

Failed merges:

r? @ghost
2019-05-17 20:02:13 +00:00
Esteban Küber
65b731908a Explain that ? converts the error type using From 2019-05-17 12:18:56 -07:00
Manish Goregaokar
f48f37b052
Rollup merge of #60902 - sfackler:fix-error-soudness, r=alexcrichton
Prevent Error::type_id overrides

type_id now takes an argument that can't be named outside of the
std::error module, which prevents any implementations from overriding
it. It's a pretty grody solution, and there's no way we can stabilize
the method with this API, but it avoids the soudness issue!

Closes #60784

r? @alexcrichton
2019-05-17 11:34:13 -07:00
Manish Goregaokar
ba0e2518c8
Rollup merge of #60901 - estebank:str-str-str, r=Centril
Handle more string addition cases with appropriate suggestions
2019-05-17 11:34:12 -07:00
Manish Goregaokar
7269117f13
Rollup merge of #60891 - jonas-schievink:triagebot-claim, r=Mark-Simulacrum
Allow claiming issues with triagebot

Not sure if this was intentionally left out, but it can probably be enabled now that https://github.com/rust-lang/triagebot/issues/3 is fixed (assuming that the deployed commit is recent enough). People have tried to use it already (https://github.com/rust-lang/rust/issues/60622#issuecomment-493212465).

r? @Mark-Simulacrum
2019-05-17 11:34:10 -07:00
Manish Goregaokar
5b1252bcc9
Rollup merge of #60791 - ehuss:update-books, r=Mark-Simulacrum
Update books

## nomicon

1 commits in fb29b147be4d9a1f8e24aba753a7e1de537abf61..c656171b749b7307f21371dd0d3278efee5573b8
2019-04-22 19:10:29 -0400 to 2019-04-25 15:31:26 -0400
- Lifetimes: Updates to incorporate NLL (rust-lang-nursery/nomicon#101)

## reference

5 commits in 2a2de9ce095979978ad7b582daecf94e4070b916..862b669c395822bb0938781d74f860e5762ad4fb
2019-04-22 10:25:52 -0700 to 2019-05-04 23:41:35 -0700
- Typo (rust-lang-nursery/reference#606)
- Added missing ? to Generics from InherentImpl and TraitImpl (rust-lang-nursery/reference#604)
- Add missing ( to ExternalFunctionItem (rust-lang-nursery/reference#603)
- Remove unneeded | from AssignmentExpression (rust-lang-nursery/reference#601)
- Remove unneeded ( from TypePathSegment (rust-lang-nursery/reference#602)

## book

6 commits in db919bc6bb9071566e9c4f05053672133eaac33e..29fe982990e43b9367be0ff47abc82fb2123fd03
2019-04-15 20:11:03 -0400 to 2019-05-15 17:48:40 -0400
- Ignore a non-compiling test listing and add code to fix a test listing
- Remove nostarch snapshots I've checked in layout
- Reword error messages to maybe not need to wrap lines in print
- This example doesn't compile but wasn't marked as such
- Update install instructions for VS 2019 (rust-lang/book#1923)
- Switch IRC to Discord

## rust-by-example

9 commits in 1ff0f8e018838a710ebc0cc1a7bf74ebe73ad9f1..811c697b232c611ed754d279ed20643a0c4096f6
2019-04-15 08:15:32 -0300 to 2019-04-28 18:56:42 -0300
- Fix typo in dsl.md (rust-lang/rust-by-example#1187)
- File read lines (rust-lang/rust-by-example#1186)
- For https://github.com/rust-lang/rust-by-example/issues/1184 closes rust-lang/rust-by-example#1184 (rust-lang/rust-by-example#1185)
- Link to Reference for macro_rules designators (rust-lang/rust-by-example#1182)
- Improve section Meta/Docs (rust-lang/rust-by-example#1183)
- Small improvements to various files (rust-lang/rust-by-example#1173)
- 19.2 Vectors Error in Code Example (rust-lang/rust-by-example#1178)
- For https://github.com/rust-lang/rust-by-example/issues/1175 (rust-lang/rust-by-example#1176)
- For https://github.com/rust-lang/rust-by-example/issues/1179 (rust-lang/rust-by-example#1180)

## rustc-guide

12 commits in 99e1b1d53656be08654df399fc200584aebb50e4..3cb727b62b953d59b4360d39aa68b6dc8f157655
2019-04-20 09:57:54 -0500 to 2019-05-07 09:53:32 -0500
- Fix typo, 'which' repeated twice
- [canonicalization] fix result canonicalization example (rust-lang/rustc-guide#304)
- Rename to RUSTC_LOG
- Added mention of universal ctags
- Fix link in walkthrough
- Remove IRC from discussion chats
- Bring the updating LLVM guide up to date
- use nightly rust for ci
- Fixed broken chalk links
- Add documentation for two-phase borrows
- Explain new powers of the `treat-err-as-bug` flag
- Update lowering-module test case

## edition-guide

3 commits in c413d42a207bd082f801ec0137c31b71e4bfed4c..581c6cccfaf995394ea9dcac362dc8e731c18558
2019-04-22 01:14:56 +0200 to 2019-05-06 12:47:44 -0700
- Fix typo in controlling-panics-with-std-panic.md (rust-lang-nursery/edition-guide#158)
- Fix links for book editions. (rust-lang-nursery/edition-guide#149)
- Update now that NLL is enabled in 2015. (rust-lang-nursery/edition-guide#157)

## embedded-book

3 commits in de3d55f521e657863df45260ebbca1b10527f662..9858872bd1b7dbba5ec27dc30d34eba00acd7ef9
2019-04-22 12:58:28 +0000 to 2019-05-02 18:56:54 +0000
- Update linux.md  (rust-embedded/book#167)
- Clarify list of available targets for installation  (rust-embedded/book#165)
- minor grammar fix  (rust-embedded/book#188)
2019-05-17 11:34:08 -07:00
Esteban Küber
8895fb945d Account for &String + String 2019-05-17 10:45:54 -07:00
bors
823a75d9ba Auto merge of #60841 - alexcrichton:update-compiler-builtins, r=RalfJung
Update the compiler_builtins crate

This updates to 0.1.13 for `compiler_builtins`, published to fix a few
issues. The feature changes here are updated because `compiler_builtins`
no longer enables the `c` feature by default but we want to do so
through our build still.

Closes #60747
Closes #60782
2019-05-17 16:11:20 +00:00
Alex Crichton
3c9790e429 Update the compiler_builtins crate
This updates to 0.1.13 for `compiler_builtins`, published to fix a few
issues. The feature changes here are updated because `compiler_builtins`
no longer enables the `c` feature by default but we want to do so
through our build still.

Closes #60747
Closes #60782
2019-05-17 07:17:15 -07:00
bors
b982867a73 Auto merge of #60171 - matthewjasper:full-nll-compare-mode, r=pnkfelix
Use -Zborrowck=mir for NLL compare mode

closes #56993

r? @pnkfelix
2019-05-17 13:01:23 +00:00
bors
39401465da Auto merge of #60892 - davidtwco:issue-60622, r=oli-obk
Checking generic args after late bound region err.

Fixes #60622.

This PR fixes an ICE that occurs when a late bound region error is
emitted and that resulted in the rest of the generic arguments of a
function not being checked.

For example, you could specify a generic type parameter `T` in a function
call `foo<'_, T>()` to a function that doesn't have a generic type
parameter.

Since an error wasn't emitted from the function, compilation
continued to parts of typeck that didn't expect a generic type argument
in a call for a function that didn't have any generic type arguments.
2019-05-17 10:14:19 +00:00
Nicholas Nethercote
4ab5fe3f97 Avoid unnecessary interning in DefPathData::as_interned_str(). 2019-05-17 20:10:52 +10:00
Nicholas Nethercote
86cc326d06 Avoid unnecessary interning in Ident::from_str() calls.
A lot of these static symbols are pre-interned.
2019-05-17 20:10:50 +10:00
Nicholas Nethercote
be3724fb7c Change rustc::util::common::FN_OUTPUT_NAME to a Symbol. 2019-05-17 20:04:20 +10:00
David Wood
bff8a86698
Checking generic args after late bound region err.
This commit fixes an ICE that occurs when a late bound region error is
emitted and that resulted in the rest of the generic arguments of a
function not being checked.

For example, you could specify a generic type parameter `T` in a function
call `foo<'_, T>()` to a function that doesn't have a generic type
parameter.

Since an error wasn't emitted from the function, compilation
continued to parts of typeck that didn't expect a generic type argument
in a call for a function that didn't have any generic type arguments.
2019-05-17 09:12:40 +01:00
bors
68fd80fa1e Auto merge of #60899 - cuviper:RawEntryMut-origin-story, r=Centril
doc: correct the origin of RawEntryMut
2019-05-17 07:24:16 +00:00
Esteban Küber
ee0bf5e6aa review comments 2019-05-16 21:09:39 -07:00
bors
c2e49bf1a2 Auto merge of #60817 - ecstatic-morse:issue-60779, r=Centril
Add stubs to keyword docs

Resolves #60779.

This commit gives each stable keyword a short entry in the "Keywords" section in the docs for `std`. The newly added entries are only a single line each and contain the main purpose of the keyword. I changed some of the existing summary lines for consistency's sake. Each line is either an imperative ("name the type of a trait object" for `dyn`), or an object ("An abstract data type" for `enum`). I tried to avoid using the keyword itself or the word "keyword" in the summary.

Later commits can flesh out each keyword with an example for each context in which it can appear as well as a link to the appropriate part of the rust book.

**edit:**
Here's the list of keywords and summaries (sans formatting) to ease reviewing. I'll try to keep this up to date as I make changes:

keyword | summary
-- | --
Self | The implementing type within a `trait` or `impl` block, or the current type within a type definition.
as | Cast between types, or rename an import.
async | ExperimentalReturn a Future instead of blocking the current thread.
await | ExperimentalSuspend execution until the result of a Future is ready.
break | Exit early from a loop.
const | Compile-time constants and deterministic functions.
continue | Skip to the next iteration of a loop.
crate | A Rust binary or library.
dyn | Name the type of a trait object.
else | What to do when an if condition does not hold.
enum | A type that can be any one of several variants.
extern | Link to or import external code.
false | A value of type bool representing logical false.
fn | A function or function pointer.
for | Iteration with in, trait implementation with impl, or higher-ranked trait bounds (for<'a>).
if | Evaluate a block if a condition holds.
impl | Implement some functionality for a type.
in | Iterate over a series of values with for.
let | Bind a value to a variable.
loop | Loop indefinitely.
match | Control flow based on pattern matching.
mod | Organize code into modules.
move | Capture a closure's environment by value.
mut | A mutable binding, reference, or pointer.
pub | Make an item visible to others.
ref | Bind by reference during pattern matching.
return | Return a value from a function.
self | The receiver of a method, or the current module.
static | A place that is valid for the duration of a program.
struct | A type that is composed of other types.
super | The parent of the current module.
trait | A common interface for a class of types.
true | A value of type bool representing logical true.
type | Define an alias for an existing type.
union | The Rust equivalent of a C-style union.
unsafe | Code or interfaces whose memory safety cannot be verified by the type system.
use | Import or rename items from other crates or modules.
where | Add constraints that must be upheld to use an item.
while | Loop while a condition is upheld.
2019-05-17 03:52:27 +00:00
Steven Fackler
686a611b9e
Update src/libstd/error.rs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-05-16 20:18:29 -07:00
Esteban Küber
2cb91816f2 Fix binop span 2019-05-16 19:56:11 -07:00
Steven Fackler
e836a4cd79 Prevent Error::type_id overrides
type_id now takes an argument that can't be named outside of the
std::error module, which prevents any implementations from overriding
it. It's a pretty grody solution, and there's no way we can stabilize
the method with this API, but it avoids the soudness issue!

Closes #60784
2019-05-16 19:48:13 -07:00
Esteban Küber
234adf84bd Handle more string addition cases with appropriate suggestions 2019-05-16 19:29:02 -07:00
Josh Stone
4d61fb1ba4 doc: correct the origin of RawEntryMut 2019-05-16 18:15:09 -07:00