Commit Graph

8495 Commits

Author SHA1 Message Date
Ryan1729 42f3d39a54 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
2020-08-06 06:15:57 -06:00
Ryan1729 0d2a378547 run clippy_dev update_lints 2020-08-06 06:11:23 -06:00
Ryan1729 b0c8c7af16 add newline to transmutes_expressible_as_ptr_casts.rs 2020-08-06 04:49:06 -06:00
Ryan1729 8997c558d8 change filter to assert, and update comments 2020-08-06 04:24:25 -06:00
Ryan1729 ded2d6c233 add extra error message to the expected stderr for transmutes_expressible_as_ptr_casts test 2020-08-06 04:24:25 -06:00
Ryan1729 94340d6e17 add documentation to functions that call `do_check` and add a test against lint ordering changing 2020-08-06 04:24:25 -06:00
Ryan1729 19f36bc2f3 add description to assert 2020-08-06 04:24:25 -06:00
Ryan1729 d38766ed96 address some review comments 2020-08-06 04:24:25 -06:00
Ryan1729 ccc4747f46 get the expected number of errors by acknowledging that other lints are covering the same ground 2020-08-06 04:24:25 -06:00
Ryan1729 de05212987 try putting the can_be_expressed_as_pointer_cast at the top and find that we still get an ICE 2020-08-06 04:24:24 -06:00
Ryan1729 34d3a0086c 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
2020-08-06 04:24:24 -06:00
Ryan1729 46ef4e8651 write currently failing test for transmutes_expressible_as_ptr_casts
There are 5 errors, when there should be 7.
2020-08-06 04:24:24 -06:00
Ryan1729 069f851671 initial compiling version of TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS 2020-08-06 04:24:24 -06:00
Ryan1729 5e84b8c2fb run cargo dev new_lint then move transmutes_expressible_as_ptr_casts into transmute module 2020-08-06 04:24:24 -06:00
liuzhenyu 24a6130da2 fix typos 2020-08-02 23:20:00 +08:00
Valentin Lazureanu aa3d9ca0e9 Rename HAIR to THIR (Typed HIR). 2020-07-31 22:15:12 +00:00
Bastian Kauschke 133e1d6773 clippy 2020-07-27 21:17:28 +02:00
Bastian Kauschke 6ce37fab95 introduce PredicateAtom 2020-07-27 21:07:37 +02:00
Bastian Kauschke 88787083f4 this might be unqualified, but at least it's now quantified 2020-07-27 21:06:36 +02:00
Bastian Kauschke dfa1af2059 clippy 2020-07-27 21:06:36 +02:00
flip1995 d164ab65f7 Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup 2020-07-26 21:07:07 +02:00
David Wood b7c8b96e66 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>
2020-07-20 11:23:26 +01:00
Valentin Lazureanu 5a20489c5c Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
Nicholas Nethercote 62db617e40 Avoid storing `SymbolStr` in a struct.
It's intended only for very temporary use.
2020-07-17 08:28:22 +10:00
Bastian Kauschke bf3104ec24 WithOptConstParam::dummy -> WithOptConstParam::unknown 2020-07-15 13:06:47 +02:00
Bastian Kauschke c5b9463d26 improve naming 2020-07-15 13:06:47 +02:00
Bastian Kauschke 29de25b8a2 const_eval_resolve 2020-07-15 12:58:32 +02:00
Nicholas Nethercote f2f99be2ff Remove lots of `Symbol::as_str()` calls.
In various ways, such as changing functions to take a `Symbol` instead
of a `&str`.
2020-07-15 09:01:35 +10:00
flip1995 6f25adbd5a Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup 2020-07-14 14:59:59 +02:00
Manish Goregaokar b57ceb45b0 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
2020-07-11 08:53:06 -07:00
Oliver Scherer 1eb0053dcd Stabilize `transmute` in constants and statics but not const fn 2020-07-11 09:22:17 +02:00
Tamir Duberstein cf91c54cc6 Avoid "whitelist"
Other terms are more inclusive and precise.
2020-07-10 07:39:28 -04:00
bors c41fcad908 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
2020-07-07 00:56:44 +00:00
Manish Goregaokar 245b006a2e 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
2020-07-06 17:45:20 -07:00
bors 4705037374 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
2020-07-06 20:44:16 +00:00
Mark Rousskov 3503247c11 Shrink ParamEnv to 16 bytes 2020-07-05 09:51:42 -04:00
Eduard-Mihai Burtescu 30c046ede4 Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
Eduard-Mihai Burtescu 590e07bbc2 rustc_lint: avoid using TypeckTables::empty for LateContext. 2020-07-02 16:51:04 +03:00
Azhng dfecaef914 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
2020-06-29 16:46:52 -04:00
Dylan MacKenzie 3c5ee3300f Update tests 2020-06-28 10:08:12 -07:00
bors 81810fa8f4 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
2020-06-26 10:11:43 +00:00
Manish Goregaokar a671ea4d3f 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 🙂
2020-06-26 00:39:08 -07:00
Eduard-Mihai Burtescu f5ce0e5fe9 rustc_lint: only query `typeck_tables_of` when a lint needs it. 2020-06-26 02:56:23 +03:00
Ayaz Hafiz 7c1b3aa0dd 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 🙂
2020-06-23 09:25:46 -07:00
flip1995 80bcbf521c Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup 2020-06-23 17:05:22 +02:00
Dylan DPC 1d077f6109 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.
2020-06-23 03:16:22 +02:00
Aaron Hill e11b873c70 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.
2020-06-22 13:29:39 -04:00
Ralf Jung b92602ba69 Make is_freeze and is_copy_modulo_regions take TyCtxtAt 2020-06-21 11:47:19 +02:00
Aman Arora 922ff8e485 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>
2020-06-18 18:59:38 -04:00
Ralf Jung 93696f45ff 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
2020-06-15 12:01:03 +02:00