Commit Graph

106593 Commits

Author SHA1 Message Date
Dylan DPC
ae0bb2489a
Rollup merge of #68832 - GuillaumeGomez:clean-up-3-err-codes, r=estebank
Clean up E0264, E0267 and E0268 explanations

r? @Dylan-DPC
2020-02-05 13:14:30 +01:00
Dylan DPC
16555ac861
Rollup merge of #68809 - ecstatic-morse:const-int-functions, r=oli-obk
Make more arithmetic functions unstably const

This is a smaller version of #66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from #53718 that were blocked on #49146.

This makes the following things unstably const.

- `feature = const_int_unchecked_arith`
  - `intrinsics::unchecked_add`
  - `intrinsics::unchecked_sub`
  - `intrinsics::unchecked_mul`
  - `intrinsics::unchecked_div`
  - `intrinsics::unchecked_rem`

- `feature = const_checked_int_methods`
  - `checked_add`
  - `checked_sub`
  - `checked_mul`
  - `checked_div` (Uses `intrinsics::unchecked_div` internally)
  - `checked_rem` (Uses `intrinsics::unchecked_rem` internally)
  - `checked_neg`
  - `checked_shl`
  - `checked_shr`
  - `checked_abs`

- `feature = const_saturating_int_methods`
  - `saturating_mul`
  - `saturating_neg`  (Uses `intrinsics::unchecked_sub` internally)
  - `saturating_abs` (Uses `intrinsics::unchecked_sub` internally)

- `feature = const_wrapping_int_methods`
  - `wrapping_div`
  - `wrapping_rem`

- `feature = const_overflowing_int_methods`
  - `overflowing_div`
  - `overflowing_rem`

- `feature = const_euclidean_int_methods`
  - `checked_div_euclid`
  - `checked_rem_euclid`
  - `wrapping_div_euclid`
  - `wrapping_rem_euclid`
  - `overflowing_div_euclid`
  - `overflowing_rem_euclid`

Exponentiation and operations on the `NonZero` types are left to a later PR.

r? @oli-obk
cc @rust-lang/wg-const-eval @rust-lang/libs
2020-02-05 13:14:28 +01:00
Dylan DPC
c1779412fa
Rollup merge of #68790 - nnethercote:improve-merge_from_succ, r=nikomatsakis
Improve `merge_from_succ`

A couple of small performance wins.

r? @nikomatsakis
2020-02-05 13:14:25 +01:00
Dylan DPC
d694f22521
Rollup merge of #68762 - ForNeVeR:patch-1, r=alexcrichton
Strip unnecessary subexpression

It became unnecessary since a06baa56b9 reformatted the file. The comment is currently a bit misleading.
2020-02-05 13:14:22 +01:00
Camille GILLOT
735d664e74 Move EvaluationCache::clear. 2020-02-05 12:43:01 +01:00
Camille GILLOT
551cc5ebe6 Move ExpectedFound::new to ty::error. 2020-02-05 12:42:00 +01:00
Camille GILLOT
c851db9495 Move specialization_graph definition in traits::types. 2020-02-05 12:41:02 +01:00
Camille GILLOT
9444975e96 Split traits::structural_impls in two. 2020-02-05 12:40:47 +01:00
Josh White
82684ad30a Added long error description & modifed error_codes.rs 2020-02-05 06:28:31 -05:00
Mazdak Farrokhzad
9a4eac3944 ast_validation: fix visiting bug. 2020-02-05 12:27:45 +01:00
bors
eda1a7adfc Auto merge of #68755 - Tyg13:update_stdarch, r=alexcrichton
Update `rust-lang/stdarch` submodule

Update submodule [rust-lang/stdarch](https://github.com/rust-lang/stdarch/)
2020-02-05 10:39:01 +00:00
ljedrz
e8b72f44b0 move item reference comment 2020-02-05 11:29:07 +01:00
ljedrz
28b0ed020a merge item id stable hashing functions 2020-02-05 11:11:34 +01:00
Brian Anderson
db9b578b71 Reorder declarations of Result::expect_err/unwrap_err to match Option 2020-02-05 16:31:12 +08:00
Brian Anderson
c00d8aa517 Reorder declarations of Result::export/unwrap to match Option 2020-02-05 16:28:13 +08:00
Camille GILLOT
b3f13b00f5 Move implementation of UnifyKey to unify_key.rs. 2020-02-05 08:48:09 +01:00
Camille GILLOT
005f14d518 Move infer::canonical datatypes to infer::types. 2020-02-05 08:47:08 +01:00
Camille GILLOT
9c07dad725 Move infer::region_constraints::MemberConstraint to infer::types module. 2020-02-05 08:46:09 +01:00
Camille GILLOT
4e42f388c3 Move traits::query datatypes to traits::types. 2020-02-05 08:45:09 +01:00
Camille GILLOT
a77da35ed4 Move traits::select datatypes to traits::types. 2020-02-05 08:44:07 +01:00
Camille GILLOT
a2cd0715fd Move traits::Reveal to traits::types. 2020-02-05 08:42:49 +01:00
Camille GILLOT
369f360159 Move rustc::traits datatypes to module traits::types. 2020-02-05 08:38:08 +01:00
Yuki Okushi
df7d9f3838 Fix issue number of capacity method 2020-02-05 15:34:33 +09:00
king6cong
9713b5696b doc fix on doc attribute 2020-02-05 12:56:24 +08:00
Dylan MacKenzie
78f8ad3640 Implement remaining unchecked arithmetic intrinsics 2020-02-04 20:36:18 -08:00
Dylan MacKenzie
040d9873aa Fix test 2020-02-04 20:36:18 -08:00
Dylan MacKenzie
09160d1b84 Use consistent feature naming 2020-02-04 20:36:18 -08:00
David Renshaw
9ac68e128b stop using BytePos for computing spans in librustc_parse/parser/mod.rs 2020-02-04 23:04:29 -05:00
bors
4ff8fb9cb2 Auto merge of #68831 - Dylan-DPC:rollup-j6x15y9, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #68282 (Instrument C / C++ in MemorySanitizer example)
 - #68758 (Fix 59191 - ICE when macro replaces crate root with non-module item)
 - #68805 (bootstrap: fix clippy warnings)
 - #68810 (Remove Copy impl from OnceWith)
 - #68815 (remove redundant imports (clippy::single_component_path_imports))
 - #68818 (fix couple of perf related clippy warnings)
 - #68819 (Suggest `split_at_mut` on multiple mutable index access)

Failed merges:

r? @ghost
2020-02-05 03:20:43 +00:00
Mazdak Farrokhzad
ce6cd6709f or_patterns: add regression test for 68785 2020-02-05 03:58:41 +01:00
Mazdak Farrokhzad
01dd376ded #![recursion_limit = "X"]: note current crate name. 2020-02-05 03:24:43 +01:00
Esteban Küber
319dd6f139 When suggesting associated fn with type parameters, include in the structured suggestion 2020-02-04 18:20:10 -08:00
Mazdak Farrokhzad
67c29ed8fc lowering: add recursion_limit = 256 2020-02-05 03:05:30 +01:00
Jonas Schievink
4fc4b951f1 Make associated item lookup a query 2020-02-05 01:43:03 +01:00
Mazdak Farrokhzad
b2c6eeb713 parser: merge fn grammars wrt. bodies & headers
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-05 01:27:09 +01:00
Mazdak Farrokhzad
c0b7b41cff parse_ty_common: use enums instead of bools. 2020-02-05 01:27:08 +01:00
bors
002287d25f Auto merge of #68544 - Aaron1011:remove-overlapping-traits, r=estebank
Remove the `overlapping_marker_traits` feature

See #29864

This has been replaced by `#[feature(marker_trait_attr)]`

A few notes:

* Due to PR #68057 not yet being in the bootstrap compiler, it's
  necessary to continue using `#![feature(overlapping_marker_traits)]`
  under `#[cfg(bootstrap)]` to work around type inference issues.
* I've updated tests that used `overlapping_marker_traits` to now use
  `marker_trait_attr` where applicable

The test `src/test/ui/overlap-marker-trait.rs` doesn't make any sense
now that `overlapping_marker_traits`, so I removed it.

The test `src/test/ui/traits/overlap-permitted-for-marker-traits-neg.rs`
now fails, since it's no longer possible to have multiple overlapping
negative impls of `Send`. I believe that this is the behavior we want
(assuming that `Send` is not going to become a `#[marker]` trait, so I
renamed the test to `overlap-permitted-for-marker-traits-neg`
2020-02-04 23:56:49 +00:00
Mateusz Mikuła
1fad337f79 Prefer system MinGW libs when available 2020-02-04 23:20:24 +01:00
Andy Russell
c0a110f7e6
use def_path_str for missing_debug_impls message
The lint message will now use the full, correct path to the `Debug`
trait, even in `no_std`.
2020-02-04 17:08:50 -05:00
Stein Somers
fa9bfebfc9 Fix and test implementation of BTreeMap's first_entry, last_entry, pop_first, pop_last 2020-02-04 22:35:43 +01:00
Guillaume Gomez
11eee614f0 Clean up E0264, E0267 and E0268 explanations 2020-02-04 22:03:54 +01:00
Dylan DPC
793a5e68b4
Rollup merge of #68819 - estebank:split_at_mut, r=oli-obk
Suggest `split_at_mut` on multiple mutable index access

cc #58792.
2020-02-04 21:51:58 +01:00
Dylan DPC
a25ce40bc9
Rollup merge of #68818 - matthiaskrgr:misc_perf, r=Mark-Simulacrum
fix couple of perf related clippy warnings

librustc: don't clone a type that is copy
librustc_incremental: use faster vector initialization
librustc_typeck: don't clone a type that is copy
librustdoc: don't create a vector where a slice will do
2020-02-04 21:51:56 +01:00
Dylan DPC
3fe4c0ddf9
Rollup merge of #68815 - matthiaskrgr:redundant_imports, r=alexcrichton
remove redundant imports (clippy::single_component_path_imports)
2020-02-04 21:51:55 +01:00
Dylan DPC
94d6a96189
Rollup merge of #68810 - ollie27:once_with_copy, r=Dylan-DPC
Remove Copy impl from OnceWith

Iterators typically don't implement `Copy` and this shouldn't be an exception.
2020-02-04 21:51:53 +01:00
Dylan DPC
4d6e2d81b8
Rollup merge of #68805 - matthiaskrgr:cleanup_bootstrap, r=Mark-Simulacrum
bootstrap: fix clippy warnings

r? @oli-obk
2020-02-04 21:51:52 +01:00
Dylan DPC
48ea0fa416
Rollup merge of #68758 - daboross:fix-59191, r=petrochenkov
Fix 59191 - ICE when macro replaces crate root with non-module item

Hi,

This should fix #59191! My friend and I are working on learning the rustc codebase through contributions, so please feel free to mention anything amiss or that could be done better.

The code adds an explicit case for when a macro applied to the crate root (via an inner attribute) replaces it with something nonsensical, like a function. The crate root must be a module, and the error message reflects this.

---

I should note that there are a few other weird edge cases here, like if they do output a module, it succeeds but uses that module's name as a prefix for all names in the crate. I'm assuming that's an issue for stabilizing #54726, though.
2020-02-04 21:51:50 +01:00
Dylan DPC
1921fc0994
Rollup merge of #68282 - tmiasko:sanitizer-example, r=steveklabnik
Instrument C / C++ in MemorySanitizer example

Modify the example to instrument C / C++ in addition to Rust, since it
will be generally required (e.g., when using libbacktrace for symbolication).
2020-02-04 21:51:48 +01:00
bors
c9290dceee Auto merge of #68558 - HeroicKatora:buf-writer-capacity, r=alexcrichton
Add a method to query the capacity of a BufWriter and BufReader

Besides the obvious of retrieving the parameter used to construct the writer, this method allows consumers to control the number of `flush` calls during write operations. For `BufReader` it gives an upper bound on the returned buffer in `fill_buf` which might influence the allocation behaviour of a consumer.
2020-02-04 20:30:53 +00:00
Dylan MacKenzie
3e9fd80bd7 Add tests for newly const arithmetic fns
Co-Authored-By: 9999years <rbt@sent.as>
2020-02-04 11:04:04 -08:00