Commit Graph

77614 Commits

Author SHA1 Message Date
bors
725c9b0ede Auto merge of #49779 - oli-obk:const_err_regression, r=eddyb
Don't report compile-time errors for promoteds

Fixes the regression part of #49760, the missing warnings still are missing

r? @eddyb
2018-04-23 22:58:00 +00:00
Guillaume Gomez
f33af5c4de fix search bar bug 2018-04-23 23:55:36 +02:00
Matthias Krüger
5d37ba1990 mark std::str::replacen and std::str::replace as #[must_use]. 2018-04-23 21:44:44 +02:00
bors
0135bf647c Auto merge of #49368 - matthewjasper:feature-gate-where-clause, r=nikomatsakis
Feature gate where clauses on associated types

Fixes #49365. Requires crater: these have been usable since 1.24.
2018-04-23 19:29:25 +00:00
Stjepan Glavina
29e9de85d6 Assign the tracking issue 2018-04-23 20:34:49 +02:00
Daiki Mizukami
104c64dc36 core: Minor cleanup 2018-04-24 03:32:40 +09:00
Stjepan Glavina
1c0db245e0 Clarify the docs for Cell::update 2018-04-23 20:23:04 +02:00
Niko Matsakis
2c5fbe2058 sort strings on output 2018-04-23 13:28:15 -04:00
Niko Matsakis
7fa3c8f445 eliminate the Lrc of a slice and just return the slice
Also, introduce `Clauses` and `Goals` type alises for readability.
2018-04-23 13:28:14 -04:00
Niko Matsakis
294cae22ee first draft of program_clauses_for_env
This computes the transitive closure of traits that appear in the
environment and then appends their clauses. It needs some work, but
it's in the right direction.
2018-04-23 13:28:14 -04:00
Niko Matsakis
7173fd78c6 in unit tests, use note to dump multiple program clauses
(rather than issuing multiple errors)

Also, reorder so that the annotations are considered "used" when the
lint runs.
2018-04-23 13:28:14 -04:00
Niko Matsakis
94639ca406 rustfmt lowering.rs 2018-04-23 13:28:14 -04:00
Niko Matsakis
09bd6f3ee7 introduce new DefPathData variants for traits, assoc types 2018-04-23 13:28:14 -04:00
Niko Matsakis
cfbf62f7df add Goal::CannotProve and extract ProgramClause struct 2018-04-23 13:28:14 -04:00
Niko Matsakis
c8a52850cf create a QueryRegionConstraint type
Chalk wants to be able to pass these constraints around. Also, the
form we were using in our existing queries was not as general as we
are going to need.
2018-04-23 13:28:14 -04:00
Niko Matsakis
3aa1085cfc add a -Zchalk command-line option 2018-04-23 13:28:13 -04:00
Daiki Mizukami
fbb1c280bf core: Fix overflow in int::mod_euc when self < 0 && rhs == MIN 2018-04-24 01:53:40 +09:00
steveklabnik
ac79c41edc review nits 2018-04-23 11:58:11 -04:00
est31
edee60d872 Add tests 2018-04-23 17:53:18 +02:00
Andreas Jonson
ed318dd991 make rustdoc test follow the jobserver limit of threadsfix that to many threads is executing at the same timewhen rustdoc test is executed. 2018-04-23 17:02:01 +02:00
Russell Cohen
14e5e0e9c9 Don't allow #[should_panic] with non-() tests 2018-04-23 07:13:29 -07:00
bors
4640615ce7 Auto merge of #49372 - Phlosioneer:inherent-impl-default-error-message, r=nagisa
Better error message when trying to write default impls

Previously, if you tried to write this (using the specialization
feature flag):

default impl PartialEq<MyType> {
...
}

The compiler would give you the mysterious warning "inherent impls
cannot be default". What it really means is that you're trying to
write an impl for a Structure or *Trait Object*, and that cannot
be "default". However, one of the ways to encounter this error
(as shown by the above example) is when you forget to write "for
MyType".

This PR adds a help message that reads "maybe missing a `for`
keyword?" This is useful, actionable advice that will help any user
identify their mistake, and doesn't get in the way or mislead any
user that really meant to use the "default" keyword for this weird
purpose. In particular, this help message will be useful for any
users who don't know the "inherent impl" terminology, and/or users
who forget that inherent impls CAN be written for traits (they apply
to the trait objects). Both of these are somewhat confusing, seldom-
used concepts; a one-line error message without any error number for
longer explanation is NOT the place to introduce these ideas.

I wasn't quite sure what grammar / wording to use. I'm open to suggestions. CC @rust-lang/docs (I hope I'm doing that notation right)

(Apparently not. :( )
2018-04-23 10:40:08 +00:00
Oliver Schneider
3084c066e4
Fix the miri tool 2018-04-23 11:38:13 +02:00
est31
40f2ca2c95 'label can start expressions
let foo = 'label: loop { break 'label 42; };

is valid Rust code.
2018-04-23 11:17:59 +02:00
Nicholas Nethercote
f7d4c976a2 Use FxHashMap in syntax_pos::symbol::Interner::intern.
Because it's faster than HashMap.

This change reduces the time taken for a few of the rustc-perf
benchmarks, mostly the small ones, by up to 5%.
2018-04-23 19:15:31 +10:00
Oliver Schneider
bb367c4720
always optimize test
The error messages differ between optimized and nonoptimized mode
2018-04-23 11:12:33 +02:00
bors
1fac3ca9c4 Auto merge of #50129 - wesleywiser:clean_up1, r=michaelwoerister
Clean up `IsolatedEncoder::encode_info_for_impl_item()` a bit

Suggested in the [comments of #49991](4a77d35c1e (r183048939))
2018-04-23 08:26:23 +00:00
bors
f5cf1a8419 Auto merge of #50171 - mattico:update-mdbook, r=Mark-Simulacrum
Update MDBook

Updates MDBook to get some CSS fixes.

#50147, updated to resolve licensing issue.

r? @Mark-Simulacrum
2018-04-23 04:23:42 +00:00
bors
2c57826b92 Auto merge of #48946 - PramodBisht:issues/48636, r=estebank
Doc comments present after a particular syntax error cause an unhelpful error message to be output.

fixed: #48636

r? @estebank
2018-04-23 01:36:51 +00:00
Matt Ickstadt
0ab516fdfc Update MDBook 2018-04-22 20:35:22 -05:00
Aaron Aaeng
91aa267eda Make must_use lint cover all binary/unary operators 2018-04-22 17:16:33 -06:00
bors
e02868793b Auto merge of #50144 - sfackler:oom-lang-item, r=alexcrichton
Replace {Alloc,GlobalAlloc}::oom with a lang item.

The decision of what to do after an allocation fails is orthogonal to the decision of how to allocate the memory, so this PR splits them apart. `Alloc::oom` and `GlobalAlloc::oom` have been removed, and a lang item has been added:

```rust
#[lang = "oom"]
fn oom() -> !;
```

It is specifically a weak lang item, like panic_fmt, except that it is required when you depend on liballoc rather than libcore. libstd provides an implementation that aborts with the message `fatal runtime error: memory allocation failed`, matching the current behavior.

The new implementation is also significantly simpler - it's "just another weak lang item". [RFC 2070](https://github.com/rust-lang/rfcs/blob/master/text/2070-panic-implementation.md) specifies a path towards stabilizing panic_fmt, so any complexities around stable weak lang item definition are already being solved.

To bootstrap, oom silently aborts in stage0. alloc_system no longer has a bunch of code to print to stderr, and alloc_jemalloc no longer depends on alloc_system to pull in that code.

One fun note: System's GlobalAlloc implementation didn't override the default implementation of oom, so it currently aborts silently!

r? @alexcrichton
2018-04-22 19:38:32 +00:00
Steven Fackler
5969712c3f Remove unused AllocatorTy::Bang 2018-04-22 10:08:49 -07:00
Steven Fackler
9e8f683476 Remove Alloc::oom 2018-04-22 10:08:49 -07:00
Steven Fackler
e513c1bd31 Replace GlobalAlloc::oom with a lang item 2018-04-22 10:08:17 -07:00
bors
ff48277add Auto merge of #50152 - petrochenkov:nooverhyg, r=alexcrichton
parser: Do not override syntactic context for dummy spans

Fixes https://github.com/rust-lang/rust/issues/50061

e2afefd80b seemingly did everything right, but uncovered a preexisting bug.
2018-04-22 16:58:12 +00:00
bors
8887396513 Auto merge of #50135 - matklad:update-cargo, r=kennytm
Update Cargo

Some noteble changes:

 * ~~regression fix: https://github.com/rust-lang/cargo/pull/5390~~
  * ~~potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5389~~
  * ~~Cargo now caches the result of `rustc -vV`. It checks `rustc` binary
    mtime and rustup toolchain settings, so it should probably "just work"
    with rustbuild.~~

potentially breaking bug-fix: https://github.com/rust-lang/cargo/pull/5390
2018-04-22 13:23:49 +00:00
bors
28193e873c Auto merge of #49954 - GuillaumeGomez:doc-settings, r=ollie27,QuietMisdreavus
Add rustdoc settings menu

Fixes #18167.

r? @QuietMisdreavus
2018-04-22 11:04:41 +00:00
bors
0cbd310fa7 Auto merge of #50123 - kennytm:do-not-test-rls-if-build-failed, r=alexcrichton
Do not test RLS/Rustfmt if build failed
2018-04-22 08:48:32 +00:00
Pramod Bisht
1bed654053 1) Addresses #48636
2) Changed position of help message, incase comma is missing
3) added few missing spaces and handled span_suggestion for vscode
4) updated stderr file
2018-04-22 11:43:25 +05:30
bors
835b8648c6 Auto merge of #50109 - SimonSapin:copy, r=sfackler
Implement Copy for std::alloc::Layout

Fixes https://github.com/rust-lang/rust/issues/48458
2018-04-22 06:03:20 +00:00
bors
bbdd1cf744 Auto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavus
Add specific never search

Fixes #49529.

r? @QuietMisdreavus
2018-04-22 02:18:41 +00:00
Vadim Petrochenkov
6a4e0b3fae parser: Do not override syntactic context for dummy spans 2018-04-22 04:33:30 +03:00
bors
d5616e1f18 Auto merge of #49896 - SimonSapin:inherent, r=alexcrichton
Add inherent methods in libcore for [T], [u8], str, f32, and f64

# Background

Primitive types are defined by the language, they don’t have a type definition like `pub struct Foo { … }` in any crate. So they don’t “belong” to any crate as far as `impl` coherence is concerned, and on principle no crate would be able to define inherent methods for them, without a trait. Since we want these types to have inherent methods anyway, the standard library (with cooperation from the compiler) bends this rule with code like [`#[lang = "u8"] impl u8 { /*…*/ }`](https://github.com/rust-lang/rust/blob/1.25.0/src/libcore/num/mod.rs#L2244-L2245). The `#[lang]` attribute is permanently-unstable and never intended to be used outside of the standard library.

Each lang item can only be defined once. Before this PR there is one impl-coherence-rule-bending lang item per primitive type (plus one for `[u8]`, which overlaps with `[T]`). And so one `impl` block each. These blocks for `str`, `[T]` and `[u8]` are in liballoc rather than libcore because *some* of the methods (like `<[T]>::to_vec(&self) -> Vec<T> where T: Clone`) need a global memory allocator which we don’t want to make a requirement in libcore. Similarly, `impl f32` and `impl f64` are in libstd because some of the methods are based on FFI calls to C’s `libm` and we want, as much as possible, libcore not to require “runtime support”.

In libcore, the methods of `str` and `[T]` that don’t allocate are made available through two **unstable traits** `StrExt` and `SliceExt` (so the traits can’t be *named* by programs on the Stable release channel) that have **stable methods** and are re-exported in the libcore prelude (so that programs on Stable can *call* these methods anyway). Non-allocating `[u8]` methods are not available in libcore: https://github.com/rust-lang/rust/issues/45803. Some `f32` and `f64` methods are in an unstable `core::num::Float` trait with stable methods, but that one is **not in the libcore prelude**. (So as far as Stable programs are concerns it doesn’t exist, and I don’t know what the point was to mark these methods `#[stable]`.)

https://github.com/rust-lang/rust/issues/32110 is the tracking issue for these unstable traits.

# High-level proposal

Since the standard library is already bending the rules, why not bend them *a little more*? By defining a few additional lang items, the compiler can allow the standard library to have *two* `impl` blocks (in different crates) for some primitive types.

The `StrExt` and `SliceExt` traits still exist for now so that we can bootstrap from a previous-version compiler that doesn’t have these lang items yet, but they can be removed in next release cycle. (`Float` is used internally and needs to be public for libcore unit tests, but was already `#[doc(hidden)]`.) I don’t know if https://github.com/rust-lang/rust/issues/32110 should be closed by this PR, or only when the traits are entirely removed after we make a new bootstrap compiler.

# Float methods

Among the methods of the `core::num::Float` trait, three are based on LLVM intrinsics: `abs`, `signum`, and `powi`. PR https://github.com/rust-lang/rust/pull/27823 “Remove dependencies on libm functions from libcore” moved a bunch of `core::num::Float` methods back to libstd, but left these three behind. However they aren’t specifically discussed in the PR thread. The `compiler_builtins` crate defines `__powisf2` and `__powidf2` functions that look like implementations of `powi`, but I couldn’t find a connection with the `llvm.powi.f32` and `llvm.powi.f32` intrinsics by grepping through LLVM’s code.

In discussion starting at https://github.com/rust-lang/rust/issues/32110#issuecomment-370647922 Alex says that we do not want methods in libcore that require “runtime support”, but it’s not clear whether that applies to these `abs`, `signum`, or `powi`. In doubt, I’ve **removed** them for the trait and moved them to inherent methods in libstd for now. We can move them back later (or in this PR) if we decide that’s appropriate.

# Change details

For users on the Stable release channel:

* I believe this PR does not make any breaking change
* Some methods for `[u8]`, `f32`, and `f64` are newly available to `#![no_std]` users (fixes https://github.com/rust-lang/rust/issues/45803)
* There should be no visible change for `std` users in terms of what programs compile or what their behavior is. (Only in compiler error messages, possibly.)

For Nightly users, additionally:

* The unstable `StrExt` and `SliceExt` traits are gone
* Their methods are now inherent methods of `str` and `[T]` (so only code that explicitly named the traits should be affected, not "normal" method calls)
* The `abs`, `signum` and `powi` methods of the `Float` trait are gone
* The `Float` trait’s unstable feature name changed to `float_internals` with no associated tracking issue, to reflect it being a permanently unstable implementation detail rather than a public API on a path to stabilization.
* Its remaining methods are now inherent methods of `f32` and `f64`.

-----

CC @rust-lang/libs for the API changes, @rust-lang/compiler for the new lang items
2018-04-22 00:01:29 +00:00
Guillaume Gomez
1ed3e77b8a Add doc about doc alias feature 2018-04-22 00:30:48 +02:00
Guillaume Gomez
48ab422be4 Add tracking issue number for doc alias feature 2018-04-22 00:30:48 +02:00
bors
aa7ce896f2 Auto merge of #50121 - pnkfelix:revert-stabilization-of-never-type-et-al, r=alexcrichton
Revert stabilization of never_type (!) et al

Fix #49691

I *think* this correctly adopts @nikomatsakis 's desired fix of:
 * reverting stabilization of `!` and `TryFrom`, and
 * returning to the previous fallback semantics (i.e. it is once again dependent on whether the crate has opted into `#[feature(never_type)]`,
 * **without** attempting to put back in the previous future-proofing warnings regarding the change in fallback semantics.

(I'll be away from computers for a week starting now, so any updates to this PR should be either pushed into it, or someone else should adopt the task of polishing this fix and put up their own PR.)
2018-04-21 21:14:53 +00:00
Guillaume Gomez
d0e2d26ceb remove unused condition 2018-04-21 22:02:54 +02:00
Guillaume Gomez
d5eade2b94 Add alias tests 2018-04-21 22:02:54 +02:00
Guillaume Gomez
31e7cc4ba4 update tester 2018-04-21 22:02:54 +02:00