Commit graph

252 commits

Author SHA1 Message Date
Camille GILLOT
437a46ddfa Use () for lang items. 2021-05-12 13:58:45 +02:00
Camille GILLOT
9849327384 Use () for privacy. 2021-05-12 13:58:45 +02:00
Camille GILLOT
829a9d33a9 Use () for entry_fn. 2021-05-12 13:58:42 +02:00
Camille GILLOT
3a729915da Use () in reachable_set. 2021-05-12 13:58:42 +02:00
Yuki Okushi
649b385471
Rollup merge of #85018 - hi-rustin:rustin-patch-84637, r=estebank
shrinking the deprecated method span

close https://github.com/rust-lang/rust/issues/84637
2021-05-12 07:18:00 +09:00
LeSeulArtichaut
6e8d0dbe11 Add documentation 2021-05-10 18:38:09 +02:00
LeSeulArtichaut
f2077c728c Error on conflicting #[doc(inline)]/#[doc(no_inline)] attributes 2021-05-08 17:22:26 +02:00
LeSeulArtichaut
245f582139 Emit invalid_doc_attributes warnings in more cases 2021-05-08 16:42:22 +02:00
hi-rustin
f6dd332820 shrinking the deprecated method span 2021-05-07 10:41:04 +08:00
Charles Lew
d261df4a72 Implement RFC 1260 with feature_name imported_main. 2021-04-29 08:35:08 +08:00
bors
8212de8eb1 Auto merge of #84546 - CohenArthur:fix-liveness-typo, r=jyn514
Fix typo  in report_unsed_assign

The function was called `report_unsed_assign`, which I assume is a typo, considering the rest of the file.
This replaces `report_unsed_assign` with `report_unused_assign`.
2021-04-26 11:18:25 +00:00
CohenArthur
ba9d143118 liveness: Fix typo report_unsed_assign -> report_unused_assign 2021-04-25 14:10:57 +02:00
bors
b56b175c6c Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk
further split up const_fn feature flag

This continues the work on splitting up `const_fn` into separate feature flags:
* `const_fn_trait_bound` for `const fn` with trait bounds
* `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here)

I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more.

`@oli-obk` are you currently able to do reviews?
2021-04-24 23:16:03 +00:00
Dylan DPC
2f438e31f5
Rollup merge of #84343 - camsteffen:closure-tree, r=varkor
Remove `ScopeTree::closure_tree`

Seems to be dead code since #50649.
2021-04-22 18:14:32 +02:00
Cameron Steffen
98a11e01e5 Remove closure_tree 2021-04-19 15:40:20 -05:00
bors
1a6c98e4d6 Auto merge of #84091 - tmiasko:check-attrs-sym, r=davidtwco
Match against attribute name when validating attributes

Extract attribute name once and match it against symbols that are being
validated, instead of using `Session::check_name` for each symbol
individually.

Assume that all validated attributes are used, instead of marking them
as such, since the attribute check should be exhaustive.
2021-04-19 18:05:44 +00:00
Ralf Jung
bd9556956a fix feature use in rustc libs 2021-04-18 22:05:45 +02:00
Charles Lew
fc357039f9 Remove #[main] attribute. 2021-04-16 13:04:02 +08:00
Tomasz Miąsko
985ae0b55b Match against attribute name when validating attributes
Extract attribute name once and match it against symbols that are being
validated, instead of using `Session::check_name` for each symbol
individually.

Assume that all validated attributes are used, instead of marking them
as such, since the attribute check should be exhaustive.
2021-04-11 00:00:00 +00:00
Dylan DPC
b81c6cdb57
Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
2021-04-07 13:07:14 +02:00
Amanieu d'Antras
32be124e30 Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
Wesley Norris
448d07683a Allow specifying alignment for functions 2021-04-05 17:36:51 -04:00
bors
5662d9343f Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514
Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`

Fixes #80936.

"spotlight" is not a very specific or self-explaining name.
Additionally, the dialog that it triggers is called "Notable traits".
So, "notable trait" is a better name.

* Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`
* Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]`
* Update documentation
* Improve documentation

r? `@Manishearth`
2021-04-02 07:04:58 +00:00
Camille GILLOT
9d8f833e05 Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
Josh Stone
72ebebe474 Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
bors
cb473c2c5b Auto merge of #83424 - cjgillot:noparam, r=lcnr
GenericParam does not need to be a HIR owner.

The special case is not required.

Universal impl traits design to regular generic parameters, and their content is owned by the enclosing item.

Existential (and opaque) impl traits generate their own enclosing item, and are collected through it.
2021-03-25 16:35:19 +00:00
bors
5b33de3340 Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr
implement `feature(const_generics_defaults)`

Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`.

~~This currently creates a field which is always false on `GenericParamDefKind` for future use when
consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~

r? `@lcnr`
2021-03-24 04:13:27 +00:00
Dylan DPC
2f611da1d6
Rollup merge of #83313 - cjgillot:assert, r=michaelwoerister
Only enable assert_dep_graph when query-dep-graph is enabled.

This is a debugging option. The only effect should be on rustc tests.

r? ``@michaelwoerister``
2021-03-24 01:52:28 +01:00
Camille GILLOT
4c0b7ac7ba GenericParam does not need to be a HIR owner. 2021-03-23 22:47:22 +01:00
varkor
8ef81388e2 Some refactoring 2021-03-23 17:16:20 +00:00
Camille GILLOT
31447f6f08 Fix comment. 2021-03-23 18:11:04 +01:00
Camille GILLOT
1aad7e738e Err if the debugging options are not passed. 2021-03-22 21:31:00 +01:00
mark
db5629adcb stabilize or_patterns 2021-03-19 19:45:32 -05:00
bors
cebc8fef5f Auto merge of #82951 - sexxi-goose:wr-mir-replace-methods2, r=nikomatsakis
Replace closures_captures and upvar_capture with closure_min_captures

Removed all uses of closures_captures and upvar_capture and refactored code to work with closure_min_captures. This also involved removing functions that were no longer needed like the bridge.

Closes https://github.com/rust-lang/project-rfc-2229/issues/18
r? `@nikomatsakis`
2021-03-19 18:23:44 +00:00
Dylan DPC
61372e1af6
Rollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514
rustdoc: allow list syntax for #[doc(alias)] attributes

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

It now allows to have:

```rust
#[doc(alias = "x")]
// and:
#[doc(alias("y", "z"))]
```

cc ``@jplatte``
r? ``@jyn514``
2021-03-19 15:03:21 +01:00
Jennifer Wills
52dba13e41 Replace closures_captures and upvar_capture with closure_min_captures
make changes to liveness to use closure_min_captures

use different span

borrow check uses new structures

rename to CapturedPlace

stop using upvar_capture in regionck

remove the bridge

cleanup from rebase + remove the upvar_capture reference from mutability_errors.rs

remove line from livenes test

make our unused var checking more consistent

update tests

adding more warnings to the tests

move is_ancestor_or_same_capture to rustc_middle/ty

update names to reflect the closures

add FIXME

check that all captures are immutable borrows before returning

add surrounding if statement like the original

move var out of the loop and rename

Co-authored-by: Logan Mosier <logmosier@gmail.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2021-03-18 20:45:49 -04:00
Vadim Petrochenkov
b25d3ba781 ast/hir: Rename field-related structures
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03:00
Camelid
34c6cee397 Rename #[doc(spotlight)] to #[doc(notable_trait)]
"spotlight" is not a very specific or self-explaining name.
Additionally, the dialog that it triggers is called "Notable traits".
So, "notable trait" is a better name.

* Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`
* Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]`
* Update documentation
* Improve documentation
2021-03-15 13:59:54 -07:00
Dylan DPC
75a15bf275
Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwco
Find more invalid doc attributes

- Lint on `#[doc(123)]`, `#[doc("hello")]`, etc.
- Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]`
- Add hyphen to "crate level"
- Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string
2021-03-15 16:22:52 +01:00
Camelid
8f40e1180f Use pretty-printer instead of span_to_snippet 2021-03-14 14:39:25 -07:00
Camelid
13076f90d2 Tweak diagnostics
- Tweak lint message
- Display multi-segment paths correctly
2021-03-14 14:00:02 -07:00
Camelid
5134047c40 Add hyphen to "crate level"
"crate level attribute" -> "crate-level attribute"
2021-03-13 16:29:49 -08:00
Camelid
7e972a39b8 Report error for each invalid nested attribute 2021-03-13 13:55:15 -08:00
Camelid
7189c05bf8 Lint non-meta doc attributes
E.g., `#[doc(123)]`.
2021-03-13 13:25:27 -08:00
Camelid
9613a88db5 Refactor check_doc_attrs body
This change makes it easier to follow the control flow.

I also moved the end-of-line comments attached to some symbols to before
the symbol listing. This allows rustfmt to format the code; otherwise no
formatting occurs (see rust-lang/rustfmt#4750).
2021-03-13 13:13:27 -08:00
Guillaume Gomez
1d26e6b632 Improve code by removing similar function calls and using loops instead for collecting iterators 2021-03-11 22:33:40 +01:00
Tomasz Miąsko
49431909a6 Validate rustc_layout_scalar_valid_range_{start,end} attributes 2021-03-11 00:00:00 +00:00
Guillaume Gomez
bbbefa3edc Allow doc alias attributes to use both list and value 2021-03-10 10:17:37 +01:00
Camille GILLOT
27ef0eeaa4 Track HirId when visiting attributes. 2021-03-09 19:27:59 +01:00
Camille GILLOT
c701872a6c Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00