Commit Graph

91297 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
5abd9c7d15
Rollup merge of #58812 - jonhoo:floor_v_trunc, r=alexcrichton
Clarify distinction between floor() and trunc()

`floor()` rounds towards `-INF`, `trunc()` rounds towards 0.
This PR clarifies this in the examples.
2019-03-19 15:16:50 +01:00
Mazdak Farrokhzad
fff8586193
Rollup merge of #58778 - xfix:exact_size_case_mapping_iter, r=SimonSapin
Implement ExactSizeIterator for ToLowercase and ToUppercase
2019-03-19 15:16:49 +01:00
Mazdak Farrokhzad
d4ef74b2da
Rollup merge of #57847 - clarcharr:dbg_no_params, r=Centril
dbg!() without parameters

Fixes #57845.
2019-03-19 15:16:46 +01:00
Mazdak Farrokhzad
c1975dbd34
Rollup merge of #57729 - pnkfelix:issue-55748-pat-types-are-constraints-on-bindings-too, r=nikomatsakis
extra testing of how NLL handles wildcard type `_`

test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X);` and potentially instantiated at different types when used in type ascriptions in let bindings.

(NLL's handling of this for the type ascription *expression form* is currently broken, or at least differs from what AST-borrowck does. I'll file a separate bug about that. Its not something critical to address since that expression is guarded by `#![feature(type_ascription)]`.)

cc #55748
2019-03-19 15:16:45 +01:00
Mazdak Farrokhzad
d4dd8604eb
Rollup merge of #56348 - matklad:todo-macro, r=withoutboats
Add todo!() macro

The primary use-case of `todo!()` macro is to be a much easier to type
alternative to `unimplemented!()` macro.

EDIT: hide unpopular proposal about re-purposing unimplemented

<details>
However, instead of just replacing `unimplemented!()`, it gives it a
more nuanced meaning: a thing which is intentionally left
unimplemented and which should not be called at runtime. Usually,
you'd like to prevent such cases statically, but sometimes you, for
example, have to implement a trait only some methods of which are
applicable. There are examples in the wild of code doing this thing,
and in this case, the current message of `unimplemented`, "not *yet*
implemented" is slightly misleading.

With the addition of TODO, you have three nuanced choices for a
`!`-returning macro (in addition to a good-old panic we all love):

  * todo!()
  * unreachable!()
  * unimplemented!()

Here's a rough guideline what each one means:

- `todo`: use it during development, as a "hole" or placeholder. It
  might be a good idea to add a pre-commit hook which checks that
  `todo` is not accidentally committed.

- `unreachable!()`: use it when your code can statically guarantee
  that some situation can not happen. If you use a library and hit
  `unreachable!()` in the library's code, it's definitely a bug in the
  library. It's OK to have `unreachable!()` in the code base,
  although, if possible, it's better to replace it with
  compiler-verified exhaustive checks.

- `unimplemented!()`: use it when the type checker forces you to
  handle some situation, but there's a contract that a callee must not
  actually call the code. If you use a library and hit
  `unimplemented!()`, it's probably a bug in your code, though
  it *could* be a bug in the library (or library docs) as well. It is
  ok-ish to see an `unimplemented!()` in real code, but it usually
  signifies a clunky, eyebrow-rising API.
</details>
2019-03-19 15:16:43 +01:00
Simon Sapin
8cf720bd19 Make Option<ThreadId> no larger than ThreadId, with NonZeroU64 2019-03-19 14:00:13 +01:00
gnzlbg
144bdc6830 Directly reference the roadmap upstream 2019-03-19 13:58:48 +01:00
gnzlbg
cf5c360064 Export stats::Summary from libtest 2019-03-19 13:58:48 +01:00
gnzlbg
a5e7f0c75b Add missing explicit imports 2019-03-19 13:58:48 +01:00
gnzlbg
25c8f61a9f Move black_box back to rust-lang/libtest and use explicit imports 2019-03-19 13:58:48 +01:00
gnzlbg
008ce99028 Add a README to libtest with a roadmap 2019-03-19 13:58:48 +01:00
gnzlbg
4c38f1928e Allow the staged_api 2019-03-19 13:58:47 +01:00
gnzlbg
6dbb5f7104 Update Cargo.lock 2019-03-19 13:58:47 +01:00
gnzlbg
f2915a6f62 Use feature(test) 2019-03-19 13:58:47 +01:00
gnzlbg
3a9e30f6c9 Use libtest from crates.io 2019-03-19 13:58:47 +01:00
gnzlbg
2957c4c42e Re-export libtest 2019-03-19 13:58:47 +01:00
gnzlbg
95f79380ca Move libtest out of rust-lang/rust 2019-03-19 13:58:47 +01:00
Oliver Scherer
ab41023fd4 Run branch cleanup after copy prop 2019-03-19 12:38:18 +01:00
Saleem Jaffer
776407e4e6 tidy checks 2019-03-19 13:35:50 +05:30
Konrad Borowski
8f261a6abe Update since annotation for ExactSizeIterator for ToUppercase/Lowercase
This functionality was added in 1.35.0, not 1.34.0.
2019-03-19 08:50:02 +01:00
Mazdak Farrokhzad
37789c4a1d
Update src/librustc/hir/mod.rs
Co-Authored-By: llogiq <bogusandre@gmail.com>
2019-03-19 06:10:59 +01:00
bors
ef4d1c4195 Auto merge of #59279 - mati865:clippy, r=Xanewok
Update clippy

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

cc @Xanewok
2019-03-19 00:48:06 +00:00
Joshua Liebow-Feeser
de4be2cd85 Stabilize refcell_map_split feature
- Closes #51476
2019-03-18 15:06:34 -07:00
bors
3bf064beaa Auto merge of #56462 - Zoxc:query-macro, r=oli-obk
Define queries using a proc macro

cc @rust-lang/compiler
2019-03-18 21:24:12 +00:00
varkor
9bc58118fc Rebase over LazyConst changes 2019-03-18 19:46:59 +00:00
varkor
f93ad414ab Rename first_ty_sty to ty_sty 2019-03-18 19:44:52 +00:00
varkor
b39e664ee8 Make clean::Constant display respect f.alternate() 2019-03-18 19:44:52 +00:00
varkor
9925d9b3b6 Fix indentation issue 2019-03-18 19:44:52 +00:00
varkor
38d98a1b22 Implement const generics in generics_to_path_params
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18 19:44:51 +00:00
varkor
cd9a2c0b54 Refactor GenericArgs to include const generics
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18 19:44:51 +00:00
varkor
29ed491743 Add GenericArg
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18 19:38:23 +00:00
varkor
14913159e0 Implement Clean for const generics
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18 19:38:23 +00:00
varkor
c915fe0245 Rename external_typarams to external_param_names
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18 19:38:23 +00:00
varkor
ec6f983e24 Rename typarams to param_names
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18 19:38:23 +00:00
Mateusz Mikuła
986f88b86e Update Clippy, RLS and Rustfmt 2019-03-18 18:34:18 +01:00
Aleksey Kladov
9d408d972f Add todo!() macro
The use-case of `todo!()` macro is to be a much easier to type
alternative to `unimplemented!()` macro.
2019-03-18 19:27:31 +03:00
Andy Russell
a9108ebb76
filter suggestions from extern prelude 2019-03-18 11:13:15 -04:00
John Kåre Alsaker
198dfceb80 Preprocess query modifiers 2019-03-18 14:19:52 +01:00
Vincent Esche
698bbe5253 Replaced self-reflective explicit types with clearer Self or Self::… in stdlib docs 2019-03-18 13:57:51 +01:00
bors
0f88167f89 Auto merge of #58847 - bjorn3:remove_metadata_only_cg, r=alexcrichton
Remove metadata only codegen backend

It is unused and probably broken at the moment.
2019-03-18 11:28:12 +00:00
Saleem Jaffer
23c87a1f53 fixed all compilation errors 2019-03-18 15:03:30 +05:30
Saleem Jaffer
a837b8a368 cleaner code as per review 2019-03-18 15:03:30 +05:30
Saleem Jaffer
7fb1c22da1 promoted is still left in 2 places 2019-03-18 15:03:29 +05:30
bors
cd45b19bd2 Auto merge of #58872 - rep-nop:diagnostic-fix-56031, r=petrochenkov
Adds help message in error for invalid `impl for T` syntax

Fixes #56031.
2019-03-18 08:03:05 +00:00
Andre Bogus
bb832c2560 some small HIR doc improvements 2019-03-18 09:02:57 +01:00
John Kåre Alsaker
4f49fff019 Clean up parsing code and split out codegen for the QueryDescription impl 2019-03-18 08:20:10 +01:00
John Kåre Alsaker
9e9d03fd66 Add load_cached query modifier and keep dep node names consistent with query names 2019-03-18 08:20:09 +01:00
John Kåre Alsaker
7d90547532 Define queries using a proc macro 2019-03-18 08:20:06 +01:00
Esteban Küber
6007e6f649 Do not complain about non-existing fields after parse recovery
When failing to parse struct-like enum variants, the ADT gets recorded
as having no fields. Record that we have actually recovered during
parsing of this variant to avoid complaing about non-existing fields
when actually using it.
2019-03-17 20:09:53 -07:00
bors
03dafa7da3 Auto merge of #58824 - euclio:intra-link-ambiguity, r=petrochenkov
overhaul intra-doc-link ambiguity warning

Fixes #52784.

- Makes the warning part of the `intra_doc_link_resolution_failure`
lint.
- Tightens the span to just the ambiguous link.
- Reports ambiguities across all three namespaces.
- Uses structured suggestions for disambiguation.
- Adds a test for the warnings.

r? @QuietMisdreavus
2019-03-18 02:56:35 +00:00