]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoImprove recovery on malformed format call
Sasha [Mon, 31 Aug 2020 09:45:50 +0000 (11:45 +0200)]
Improve recovery on malformed format call

If a comma in a format call is replaced with a similar token, then we
emit an error and continue parsing, instead of stopping at this point.

3 years agoMerge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup
flip1995 [Fri, 28 Aug 2020 14:10:16 +0000 (16:10 +0200)]
Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup

3 years agoUnbreak the clippy test
Scott McMurray [Mon, 24 Aug 2020 21:28:01 +0000 (14:28 -0700)]
Unbreak the clippy test

3 years agoCapture tokens for Pat used in macro_rules! argument
Aaron Hill [Mon, 27 Jul 2020 22:02:29 +0000 (18:02 -0400)]
Capture tokens for Pat used in macro_rules! argument

This extends PR #73293 to handle patterns (Pat). Unlike expressions,
patterns do not support custom attributes, so we only need to capture
tokens during macro_rules! argument parsing.

3 years agoAuto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk
bors [Mon, 17 Aug 2020 23:16:08 +0000 (23:16 +0000)]
Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obk

rust_ast::ast => rustc_ast

Rework of #71199 which is a rework #70621

Still working on this but just made the PR to track progress

r? @Dylan-DPC

3 years agorust_ast::ast => rustc_ast
Ujjwal Sharma [Mon, 27 Apr 2020 17:56:11 +0000 (23:26 +0530)]
rust_ast::ast => rustc_ast

3 years agoclippy: support `QPath::LangItem`
David Wood [Tue, 4 Aug 2020 13:24:13 +0000 (14:24 +0100)]
clippy: support `QPath::LangItem`

This commit updates clippy with the introduction of `QPath::LangItem` so
that it still compiles.

Signed-off-by: David Wood <david@davidtw.co>
3 years agomerge `as_local_hir_id` with `local_def_id_to_hir_id`
Bastian Kauschke [Wed, 12 Aug 2020 10:22:56 +0000 (12:22 +0200)]
merge `as_local_hir_id` with `local_def_id_to_hir_id`

3 years agoAuto merge of #75405 - flip1995:clippyup, r=Manishearth
bors [Wed, 12 Aug 2020 00:34:19 +0000 (00:34 +0000)]
Auto merge of #75405 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update (2 days late, since I wanted to wait for https://github.com/rust-lang/rust/pull/75098)

r? @Manishearth

3 years agoMerge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup
flip1995 [Tue, 11 Aug 2020 13:43:21 +0000 (15:43 +0200)]
Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup

3 years agoRollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung
Yuki Okushi [Tue, 11 Aug 2020 07:23:47 +0000 (16:23 +0900)]
Rollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung

Miri: Renamed "undef" to "uninit"

Renamed remaining references to "undef" to "uninit" when referring to Miri.

Impacted directories are:

- `src/librustc_codegen_llvm/consts.rs`
- `src/librustc_middle/mir/interpret/`
- `src/librustc_middle/ty/print/pretty.rs`
- `src/librustc_mir/`
- `src/tools/clippy/clippy_lints/src/consts.rs`

Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project.

Related issue #71193

3 years agoRollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:30 +0000 (01:56 +0200)]
Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk

Clippy pointer cast lint experiment

This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.

This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).

r? @oli-obk

3 years agoadd allow unused_unsafe and allow dead_code
Ryan1729 [Sun, 9 Aug 2020 06:39:14 +0000 (00:39 -0600)]
add allow unused_unsafe and allow dead_code

3 years agofix unary minus on usize and unused variable errors in .fixed file
Ryan1729 [Sun, 9 Aug 2020 06:28:56 +0000 (00:28 -0600)]
fix unary minus on usize and unused variable errors in .fixed file

3 years agoadd a test example of where transmutes_expressible_as_ptr_casts should not suggest...
Ryan1729 [Sun, 9 Aug 2020 06:15:56 +0000 (00:15 -0600)]
add a test example of where transmutes_expressible_as_ptr_casts should not suggest anything

3 years agoupdate stderr for transmutes_expressible_as_ptr_casts
Ryan1729 [Sun, 9 Aug 2020 03:03:41 +0000 (21:03 -0600)]
update stderr for transmutes_expressible_as_ptr_casts

3 years agoMiri: Renamed "undef" to "uninit"
Philippe Nadon [Sat, 8 Aug 2020 13:53:47 +0000 (07:53 -0600)]
Miri: Renamed "undef" to "uninit"

Renamed remaining references to "undef" to "uninit" when referring to Miri.

Impacted directories are:

- src/librustc_codegen_llvm/consts.rs
- src/librustc_middle/mir/interpret/
- src/librustc_middle/ty/print/pretty.rs
- src/librustc_mir/
- src/tools/clippy/clippy_lints/src/consts.rs

Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project.

Related issue #71193

3 years agoEliminate the `SessionGlobals` from `librustc_ast`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:27:50 +0000 (11:27 +1000)]
Eliminate the `SessionGlobals` from `librustc_ast`.

By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.

All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.

`contains_feature_attr()` was dead, and is removed.

Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`

3 years agoAuto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser
bors [Fri, 7 Aug 2020 15:28:07 +0000 (15:28 +0000)]
Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser

Check whether locals are too large instead of whether accesses into them are too large

Essentially this stops const prop from attempting to optimize

```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```

I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).

r? @wesleywiser

3 years agocopy over *.fixed file
Ryan1729 [Fri, 7 Aug 2020 02:28:29 +0000 (20:28 -0600)]
copy over *.fixed file

3 years agoAdd some comments for magic numbers + Add tests
Vadim Petrochenkov [Tue, 4 Aug 2020 21:26:23 +0000 (00:26 +0300)]
Add some comments for magic numbers + Add tests

3 years agoFix clippy
Vadim Petrochenkov [Wed, 22 Jul 2020 14:59:17 +0000 (17:59 +0300)]
Fix clippy

3 years agoApply suggestions from code review
Ryan Wiedemann [Thu, 6 Aug 2020 13:57:31 +0000 (07:57 -0600)]
Apply suggestions from code review

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agorun clippy_dev fmt
Ryan1729 [Thu, 6 Aug 2020 12:15:57 +0000 (06:15 -0600)]
run clippy_dev fmt

This seemed to overdo it a bit, affecting multiple submodules, and changing a file I didn't touch, so I didn't commit those changes

3 years agorun clippy_dev update_lints
Ryan1729 [Thu, 6 Aug 2020 12:11:23 +0000 (06:11 -0600)]
run clippy_dev update_lints

3 years agoadd newline to transmutes_expressible_as_ptr_casts.rs
Ryan1729 [Thu, 6 Aug 2020 10:49:06 +0000 (04:49 -0600)]
add newline to transmutes_expressible_as_ptr_casts.rs

3 years agochange filter to assert, and update comments
Ryan1729 [Thu, 6 Aug 2020 10:18:14 +0000 (04:18 -0600)]
change filter to assert, and update comments

3 years agoadd extra error message to the expected stderr for transmutes_expressible_as_ptr_cast...
Ryan1729 [Thu, 6 Aug 2020 03:28:22 +0000 (21:28 -0600)]
add extra error message to the expected stderr for transmutes_expressible_as_ptr_casts test

3 years agoadd documentation to functions that call `do_check` and add a test against lint order...
Ryan1729 [Thu, 6 Aug 2020 02:23:29 +0000 (20:23 -0600)]
add documentation to functions that call `do_check` and add a test against lint ordering changing

3 years agoadd description to assert
Ryan1729 [Tue, 4 Aug 2020 22:45:47 +0000 (16:45 -0600)]
add description to assert

3 years agoaddress some review comments
Ryan1729 [Tue, 4 Aug 2020 01:00:38 +0000 (19:00 -0600)]
address some review comments

3 years agoget the expected number of errors by acknowledging that other lints are covering...
Ryan1729 [Mon, 3 Aug 2020 08:47:25 +0000 (02:47 -0600)]
get the expected number of errors by acknowledging that other lints are covering the same ground

3 years agotry putting the can_be_expressed_as_pointer_cast at the top and find that we still...
Ryan1729 [Mon, 3 Aug 2020 06:54:03 +0000 (00:54 -0600)]
try putting the can_be_expressed_as_pointer_cast at the top and find that we still get an ICE

3 years agoaccidentally cause an ICE by putting the TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS handling...
Ryan1729 [Mon, 3 Aug 2020 06:16:11 +0000 (00:16 -0600)]
accidentally cause an ICE by putting the TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS handling after the match

The reason I did this in the first place was to try and figure out why I don't see my expected 7 error messages

3 years agowrite currently failing test for transmutes_expressible_as_ptr_casts
Ryan1729 [Mon, 3 Aug 2020 05:17:11 +0000 (23:17 -0600)]
write currently failing test for transmutes_expressible_as_ptr_casts

There are 5 errors, when there should be 7.

3 years agoinitial compiling version of TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS
Ryan1729 [Mon, 3 Aug 2020 04:00:51 +0000 (22:00 -0600)]
initial compiling version of TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS

3 years agorun cargo dev new_lint then move transmutes_expressible_as_ptr_casts into transmute...
Ryan1729 [Mon, 3 Aug 2020 00:41:50 +0000 (18:41 -0600)]
run cargo dev new_lint then move transmutes_expressible_as_ptr_casts into transmute module

3 years agorustc_ast: `(Nested)MetaItem::check_name` -> `has_name`
Vadim Petrochenkov [Sun, 2 Aug 2020 10:17:20 +0000 (13:17 +0300)]
rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`

For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.

Replace all uses of `check_name` with `has_name` outside of rustc

3 years agofix typos
liuzhenyu [Sun, 2 Aug 2020 15:20:00 +0000 (23:20 +0800)]
fix typos

3 years agoRename HAIR to THIR (Typed HIR).
Valentin Lazureanu [Tue, 21 Jul 2020 09:09:27 +0000 (09:09 +0000)]
Rename HAIR to THIR (Typed HIR).

3 years agoUpdate clippy ui test.
Oliver Scherer [Wed, 29 Jul 2020 11:45:20 +0000 (13:45 +0200)]
Update clippy ui test.

The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.

3 years agoclippy
Bastian Kauschke [Mon, 27 Jul 2020 19:17:28 +0000 (21:17 +0200)]
clippy

3 years agointroduce PredicateAtom
Bastian Kauschke [Wed, 8 Jul 2020 22:35:55 +0000 (00:35 +0200)]
introduce PredicateAtom

3 years agothis might be unqualified, but at least it's now quantified
Bastian Kauschke [Wed, 24 Jun 2020 15:40:28 +0000 (17:40 +0200)]
this might be unqualified, but at least it's now quantified

3 years agoclippy
Bastian Kauschke [Fri, 19 Jun 2020 08:22:25 +0000 (10:22 +0200)]
clippy

3 years agoMerge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup
flip1995 [Sun, 26 Jul 2020 19:07:07 +0000 (21:07 +0200)]
Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup

3 years agotrait_sel: only test predicates w/ no substs
David Wood [Mon, 22 Jun 2020 12:22:45 +0000 (13:22 +0100)]
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>
3 years agoRename TypeckTables to TypeckResults.
Valentin Lazureanu [Fri, 17 Jul 2020 08:47:04 +0000 (08:47 +0000)]
Rename TypeckTables to TypeckResults.

3 years agoAvoid storing `SymbolStr` in a struct.
Nicholas Nethercote [Mon, 13 Jul 2020 06:45:35 +0000 (16:45 +1000)]
Avoid storing `SymbolStr` in a struct.

It's intended only for very temporary use.

3 years agoWithOptConstParam::dummy -> WithOptConstParam::unknown
Bastian Kauschke [Wed, 15 Jul 2020 08:55:41 +0000 (10:55 +0200)]
WithOptConstParam::dummy -> WithOptConstParam::unknown

3 years agoimprove naming
Bastian Kauschke [Wed, 15 Jul 2020 08:50:54 +0000 (10:50 +0200)]
improve naming

3 years agoconst_eval_resolve
Bastian Kauschke [Thu, 2 Jul 2020 21:56:17 +0000 (23:56 +0200)]
const_eval_resolve

3 years agoRemove lots of `Symbol::as_str()` calls.
Nicholas Nethercote [Wed, 8 Jul 2020 10:03:37 +0000 (20:03 +1000)]
Remove lots of `Symbol::as_str()` calls.

In various ways, such as changing functions to take a `Symbol` instead
of a `&str`.

3 years agoMerge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
flip1995 [Tue, 14 Jul 2020 12:59:59 +0000 (14:59 +0200)]
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup

3 years agoRollup merge of #72920 - oli-obk:const_transmute, r=RalfJung
Manish Goregaokar [Sat, 11 Jul 2020 15:53:06 +0000 (08:53 -0700)]
Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung

Stabilize `transmute` in constants and statics but not const fn

cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)

Previous attempt: #64011

r? @RalfJung

cc @rust-lang/wg-const-eval

3 years agoStabilize `transmute` in constants and statics but not const fn
Oliver Scherer [Fri, 30 Aug 2019 00:01:04 +0000 (02:01 +0200)]
Stabilize `transmute` in constants and statics but not const fn

3 years agoAvoid "whitelist"
Tamir Duberstein [Tue, 7 Jul 2020 15:12:44 +0000 (11:12 -0400)]
Avoid "whitelist"

Other terms are more inclusive and precise.

3 years agoAuto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearth
bors [Tue, 7 Jul 2020 00:56:44 +0000 (00:56 +0000)]
Auto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearth

Rollup of 14 pull requests

Successful merges:

 - #70563 ([rustdoc] Page hash handling)
 - #73856 (Edit librustc_lexer top-level docs)
 - #73870 (typeck: adding type information to projection)
 - #73953 (Audit hidden/short code suggestions)
 - #73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)])
 - #73969 (mir: mark mir construction temporaries as internal)
 - #73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr))
 - #74067 (rustdoc: Restore underline text decoration on hover for FQN in header)
 - #74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.)
 - #74078 (Always resolve type@primitive as a primitive, not a module)
 - #74089 (Add rust-analyzer to the build manifest)
 - #74090 (Remove unused RUSTC_DEBUG_ASSERTIONS)
 - #74102 (Fix const prop ICE)
 - #74112 (Expand abbreviation in core::ffi description)

Failed merges:

r? @ghost

3 years agoRollup merge of #73870 - sexxi-goose:projection-ty, r=nikomatsakis
Manish Goregaokar [Tue, 7 Jul 2020 00:45:20 +0000 (17:45 -0700)]
Rollup merge of #73870 - sexxi-goose:projection-ty, r=nikomatsakis

typeck: adding type information to projection

This commit modifies the Place as follow:
* remove 'ty' from ProjectionKind
* add type information into to Projection
* replace 'ty' in Place with 'base_ty'
* introduce 'ty()' in `Place` to return the final type of the `Place`
* introduce `ty_before_projection()` in `Place` to return the type of
  a `Place` before i'th projection is applied

Closes https://github.com/rust-lang/project-rfc-2229/issues/5

3 years agoAuto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercote
bors [Mon, 6 Jul 2020 20:44:16 +0000 (20:44 +0000)]
Auto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercote

Shrink ParamEnv to 16 bytes

r? @nnethercote

x.py check passes but I haven't tried running perf or tests

3 years agoShrink ParamEnv to 16 bytes
Mark Rousskov [Fri, 3 Jul 2020 00:52:40 +0000 (20:52 -0400)]
Shrink ParamEnv to 16 bytes

3 years agoUse 'tcx for references to AccessLevels wherever possible.
Eduard-Mihai Burtescu [Thu, 25 Jun 2020 20:41:36 +0000 (23:41 +0300)]
Use 'tcx for references to AccessLevels wherever possible.

4 years agorustc_lint: avoid using TypeckTables::empty for LateContext.
Eduard-Mihai Burtescu [Fri, 26 Jun 2020 02:55:23 +0000 (05:55 +0300)]
rustc_lint: avoid using TypeckTables::empty for LateContext.

4 years agotypeck: adding type information to projection
Azhng [Wed, 24 Jun 2020 20:33:31 +0000 (16:33 -0400)]
typeck: adding type information to projection

This commit modifies the Place as follow:
* remove 'ty' from ProjectionKind
* add type information into to Projection
* replace 'ty' in Place with 'base_ty'
* introduce 'ty()' in `Place` to return the final type of the `Place`
* introduce `ty_before_projection()` in `Place` to return the type of
  a `Place` before i'th projection is applied

Closes https://github.com/rust-lang/project-rfc-2229/issues/5

4 years agoUpdate tests
Dylan MacKenzie [Fri, 26 Jun 2020 00:43:48 +0000 (17:43 -0700)]
Update tests

4 years agoAuto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth
bors [Fri, 26 Jun 2020 10:11:43 +0000 (10:11 +0000)]
Auto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth

Rollup of 13 pull requests

Successful merges:

 - #72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - #72967 (Don't move cursor in search box when using arrows to navigate results)
 - #73102 (proc_macro: Stop flattening groups with dummy spans)
 - #73297 (Support configurable deny-warnings for all in-tree crates.)
 - #73507 (Cleanup MinGW LLVM linkage workaround)
 - #73588 (Fix handling of reserved registers for ARM inline asm)
 - #73597 (Record span of `const` kw in GenericParamKind)
 - #73629 (Make AssocOp Copy)
 - #73681 (Update Chalk to 0.14)
 - #73707 (Fix links in `SliceIndex` documentation)
 - #73719 (emitter: column width defaults to 140)
 - #73729 (disable collectionbenches for android)
 - #73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost

4 years agoRollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse
Manish Goregaokar [Fri, 26 Jun 2020 07:39:08 +0000 (00:39 -0700)]
Rollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse

Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated :slightly_smiling_face:

4 years agorustc_lint: only query `typeck_tables_of` when a lint needs it.
Eduard-Mihai Burtescu [Thu, 25 Jun 2020 23:56:23 +0000 (02:56 +0300)]
rustc_lint: only query `typeck_tables_of` when a lint needs it.

4 years agoRecord span of `const` kw in GenericParamKind
Ayaz Hafiz [Sun, 21 Jun 2020 22:49:56 +0000 (15:49 -0700)]
Record span of `const` kw in GenericParamKind

Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated :slightly_smiling_face:

4 years agoMerge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup
flip1995 [Tue, 23 Jun 2020 15:05:22 +0000 (17:05 +0200)]
Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup

4 years agoRollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink
Dylan DPC [Tue, 23 Jun 2020 01:16:22 +0000 (03:16 +0200)]
Rollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink

Make is_freeze and is_copy_modulo_regions take TyCtxtAt

Make is_freeze and is_copy_modulo_regions take TyCtxtAt instead of separately taking TyCtxt and Span. This is consistent with is_sized.

4 years agoStop using old version of `syn` in `rustc-workspace-hack`
Aaron Hill [Mon, 22 Jun 2020 17:29:04 +0000 (13:29 -0400)]
Stop using old version of `syn` in `rustc-workspace-hack`

None of the tools seem to need syn 0.15.35, so we can just build syn
1.0.

This was causing an issue with clippy's `compile-test` program: since
multiple versions of `syn` would exist in the build directory, we would
non-deterministically pick one based on filesystem iteration order. If
the pre-1.0 version of `syn` was picked, a strange build error would
occur (see
https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463)

To prevent this kind of issue from happening again, we now panic if we
find multiple versions of a crate in the build directly, instead of
silently picking the first version we find.

4 years agoMake is_freeze and is_copy_modulo_regions take TyCtxtAt
Ralf Jung [Sun, 21 Jun 2020 09:20:48 +0000 (11:20 +0200)]
Make is_freeze and is_copy_modulo_regions take TyCtxtAt

4 years agoRefactor hir::Place
Aman Arora [Wed, 17 Jun 2020 22:13:05 +0000 (18:13 -0400)]
Refactor hir::Place

For the following code
```rust
let c = || bar(foo.x, foo.x)
```

We generate two different `hir::Place`s for both `foo.x`.
Handling this adds overhead for analysis we need to do for RFC 2229.

We also want to store type information at each Projection to support
analysis as part of the RFC. This resembles what we have for
`mir::Place`

This commit modifies the Place as follows:
- Rename to `PlaceWithHirId`, where there `hir_id` is that of the
expressioin.
- Move any other information that describes the access out to another
struct now called `Place`.
- Removed `Span`, it can be accessed using the [hir
API](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.span)
- Modify `Projection` to be a strucutre of its own, that currently only
contains the `ProjectionKind`.

Adding type information to projections wil be completed as part of https://github.com/rust-lang/project-rfc-2229/issues/5

Closes https://github.com/rust-lang/project-rfc-2229/issues/3

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
4 years agoRollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay
Ralf Jung [Mon, 15 Jun 2020 10:01:03 +0000 (12:01 +0200)]
Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay

Stabilize Option::zip

This PR stabilizes the following API:

```rust
impl<T> Option<T> {
    pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>;
}
```

This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E&regexp=true&filter[lang][0]=Rust>.

The `zip_with` method is left unstably as this API is kinda niche
and it hasn't received much usage in Rust repositories on GitHub.

cc #70086

4 years agoAuto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
bors [Mon, 15 Jun 2020 04:10:24 +0000 (04:10 +0000)]
Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis

Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc #69323
cc #63063
Closes #57188
Closes #62988
Closes #69136
Closes #73061

4 years agoStabilize Option::zip
Lzu Tao [Sat, 13 Jun 2020 01:27:14 +0000 (01:27 +0000)]
Stabilize Option::zip

4 years agoRollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay
Dylan DPC [Fri, 12 Jun 2020 10:28:23 +0000 (12:28 +0200)]
Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay

Migrate to numeric associated consts

The deprecation PR is #72885

cc #68490
cc rust-lang/rfcs#2700

4 years agoRemove ImplItemKind::OpaqueTy from clippy
Matthew Jasper [Sun, 10 May 2020 14:05:06 +0000 (15:05 +0100)]
Remove ImplItemKind::OpaqueTy from clippy

4 years agoRemove associated opaque types
Matthew Jasper [Sun, 10 May 2020 11:15:51 +0000 (12:15 +0100)]
Remove associated opaque types

They're unused now.

4 years agoClippy fixes
Aaron Hill [Wed, 10 Jun 2020 03:45:32 +0000 (23:45 -0400)]
Clippy fixes

4 years agoUpdate Clippy for MethodCall changes
Aaron Hill [Tue, 9 Jun 2020 21:44:04 +0000 (17:44 -0400)]
Update Clippy for MethodCall changes

4 years agoMigrate to numeric associated consts
Lzu Tao [Tue, 2 Jun 2020 07:59:11 +0000 (07:59 +0000)]
Migrate to numeric associated consts

4 years agoMerge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy
Lzu Tao [Tue, 9 Jun 2020 14:36:01 +0000 (14:36 +0000)]
Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy

4 years agoRollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakis
Ralf Jung [Sat, 6 Jun 2020 19:57:38 +0000 (21:57 +0200)]
Rollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakis

Make `PolyTraitRef::self_ty` return `Binder<Ty>`

This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.

4 years agoAuto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrum
bors [Sat, 6 Jun 2020 09:00:51 +0000 (09:00 +0000)]
Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrum

Rename all remaining compiler crates to use the `rustc_foo` pattern

libarena -> librustc_arena
libfmt_macros -> librustc_parse_format
libgraphviz -> librustc_graphviz
libserialize -> librustc_serialize

Closes https://github.com/rust-lang/rust/issues/71177 in particular.

4 years agoBump to 1.46
Mark Rousskov [Wed, 3 Jun 2020 19:15:53 +0000 (15:15 -0400)]
Bump to 1.46

4 years agoUpdate fulldeps tests and clippy
Vadim Petrochenkov [Tue, 2 Jun 2020 19:46:42 +0000 (22:46 +0300)]
Update fulldeps tests and clippy

4 years agoRename the crates in source code
Vadim Petrochenkov [Tue, 2 Jun 2020 17:19:49 +0000 (20:19 +0300)]
Rename the crates in source code

4 years agoCall `skip_binder` or `no_bound_vars` before `self_ty`
Dylan MacKenzie [Sat, 23 May 2020 18:12:06 +0000 (11:12 -0700)]
Call `skip_binder` or `no_bound_vars` before `self_ty`

4 years agoReturn early to avoid ICE
Yuki Okushi [Sat, 30 May 2020 09:48:54 +0000 (18:48 +0900)]
Return early to avoid ICE

4 years agoAuto merge of #72671 - flip1995:clippyup, r=Xanewok
bors [Fri, 29 May 2020 11:16:45 +0000 (11:16 +0000)]
Auto merge of #72671 - flip1995:clippyup, r=Xanewok

Update Clippy, RLS, and rustfmt

r? @Dylan-DPC

This makes Clippy test-pass again: 3089c3b

Otherwise this includes bugfixes and a few new lints.

Fixes #72231
Fixes #72232

4 years agoRollup merge of #72466 - lzutao:stabilize_str-strip, r=dtolnay
Dylan DPC [Fri, 29 May 2020 00:33:11 +0000 (02:33 +0200)]
Rollup merge of #72466 - lzutao:stabilize_str-strip, r=dtolnay

Stabilize str_strip feature

This PR stabilizes these APIs:

```rust
impl str {
    /// Returns a string slice with the prefix removed.
    ///
    /// If the string starts with the pattern `prefix`, `Some` is returned with the substring where
    /// the prefix is removed. Unlike `trim_start_matches`, this method removes the prefix exactly
    /// once.
    pub fn strip_prefix<'a, P: Pattern<'a>>(&'a self, prefix: P) -> Option<&'a str>;

    /// Returns a string slice with the suffix removed.
    ///
    /// If the string ends with the pattern `suffix`, `Some` is returned with the substring where
    /// the suffix is removed. Unlike `trim_end_matches`, this method removes the suffix exactly
    /// once.
    pub fn strip_suffix<'a, P>(&'a self, suffix: P) -> Option<&'a str>
    where
        P: Pattern<'a>,
        <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>;
}
```

Closes  #67302

4 years agoTemp fix: don't run cargo lint tests in rustc test suite
flip1995 [Thu, 28 May 2020 15:19:30 +0000 (17:19 +0200)]
Temp fix: don't run cargo lint tests in rustc test suite

4 years agoMerge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2
flip1995 [Thu, 28 May 2020 13:45:24 +0000 (15:45 +0200)]
Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2

4 years agoiterate List by value
Bastian Kauschke [Sat, 23 May 2020 09:49:24 +0000 (11:49 +0200)]
iterate List by value

4 years agoUse `OnceCell` instead of `Once`
Dylan MacKenzie [Sat, 16 May 2020 04:44:28 +0000 (21:44 -0700)]
Use `OnceCell` instead of `Once`

4 years agoStabilize str_strip feature
Lzu Tao [Fri, 22 May 2020 15:29:47 +0000 (15:29 +0000)]
Stabilize str_strip feature

4 years agointroduce newtype'd `Predicate<'tcx>`
Bastian Kauschke [Mon, 11 May 2020 20:06:41 +0000 (22:06 +0200)]
introduce newtype'd `Predicate<'tcx>`

4 years agorename `Predicate` to `PredicateKind`, introduce alias
Bastian Kauschke [Mon, 11 May 2020 19:09:57 +0000 (21:09 +0200)]
rename `Predicate` to `PredicateKind`, introduce alias