about summary refs log tree commit diff
path: root/compiler/rustc_passes
AgeCommit message (Collapse)AuthorLines
2021-03-26Use iter::zip in compiler/Josh Stone-4/+8
2021-03-25Auto merge of #83424 - cjgillot:noparam, r=lcnrbors-13/+0
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-24Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnrbors-4/+3
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-24Rollup merge of #83313 - cjgillot:assert, r=michaelwoeristerDylan DPC-0/+20
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-23GenericParam does not need to be a HIR owner.Camille GILLOT-13/+0
2021-03-23Some refactoringvarkor-4/+3
2021-03-23Fix comment.Camille GILLOT-1/+2
2021-03-22Err if the debugging options are not passed.Camille GILLOT-0/+19
2021-03-19stabilize or_patternsmark-1/+1
2021-03-19Auto merge of #82951 - sexxi-goose:wr-mir-replace-methods2, r=nikomatsakisbors-55/+54
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-19Rollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514Dylan DPC-30/+83
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-18Replace closures_captures and upvar_capture with closure_min_capturesJennifer Wills-55/+54
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-16ast/hir: Rename field-related structuresVadim Petrochenkov-18/+18
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-15Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwcoDylan DPC-46/+65
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-14Use pretty-printer instead of `span_to_snippet`Camelid-7/+5
2021-03-14Tweak diagnosticsCamelid-6/+9
- Tweak lint message - Display multi-segment paths correctly
2021-03-13Add hyphen to "crate level"Camelid-2/+2
"crate level attribute" -> "crate-level attribute"
2021-03-13Report error for each invalid nested attributeCamelid-6/+9
2021-03-13Lint non-meta doc attributesCamelid-0/+10
E.g., `#[doc(123)]`.
2021-03-13Refactor `check_doc_attrs` bodyCamelid-36/+41
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-11Improve code by removing similar function calls and using loops instead for ↵Guillaume Gomez-59/+33
collecting iterators
2021-03-11Validate rustc_layout_scalar_valid_range_{start,end} attributesTomasz Miąsko-1/+36
2021-03-10Allow doc alias attributes to use both list and valueGuillaume Gomez-7/+86
2021-03-09Track HirId when visiting attributes.Camille GILLOT-3/+3
2021-03-09Remove hir::Item::attrs.Camille GILLOT-7/+10
2021-03-09Remove hir::ForeignItem::attrs.Camille GILLOT-1/+2
2021-03-09Remove hir::Crate::attrs.Camille GILLOT-2/+2
2021-03-09Do not store attrs in FnKind.Camille GILLOT-2/+3
2021-03-09Access attrs directly from HirId in rustc_passes::diagnostic_item.Camille GILLOT-6/+8
2021-03-09Access attrs directly from HirId in rustc_passes::lang_items.Camille GILLOT-14/+6
2021-03-09Access attrs directly from HirId in rustc_passes::dead.Camille GILLOT-23/+9
2021-03-09Access attrs directly from HirId in rustc_passes::stability.Camille GILLOT-12/+1
2021-03-09Access attrs directly from HirId in rustc_passes::check_attr.Camille GILLOT-50/+13
2021-03-07Rollup merge of #82651 - jyn514:rustdoc-warnings, r=GuillaumeGomezYuki Okushi-1/+2
Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, https://github.com/rust-lang/rust/pull/8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See https://github.com/rust-lang/rust/pull/81932#issuecomment-785291244 for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in https://github.com/rust-lang/rust/pull/52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in https://github.com/rust-lang/rust/pull/50541.
2021-03-05Rollup merge of #82708 - GuillaumeGomez:doc-test-attr-check, r=ManishearthGuillaume Gomez-7/+19
Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint Part of #82672. This PR does multiple things: * Create a new `INVALID_DOC_ATTRIBUTE` lint which is also "future incompatible", allowing us to use it as a warning for the moment until it turns (eventually) into a hard error. * Use this link when `#![doc(test(...))]` isn't used at the crate level. * Make #82702 use this new lint as well. r? ``@jyn514``
2021-03-05Make invalid_doc_attribute lint pluralGuillaume Gomez-3/+3
2021-03-05Auto merge of #71481 - estebank:inherit-stability, r=nikomatsakisbors-25/+53
Inherit `#[stable(..)]` annotations in enum variants and fields from its item Lint changes for #65515. The stdlib will have to be updated once this lands in beta and that version is promoted in master.
2021-03-04Also use INVALID_DOC_ATTRIBUTE for "unknown doc attribute" warningsGuillaume Gomez-6/+1
2021-03-04Add extra check for #[doc(test(...)] attributeGuillaume Gomez-1/+18
2021-03-03Change error about unknown doc attributes to a warningJoshua Nelson-9/+16
This prevents breakage across the ecosystem, since the error was just introduced recently without first having a warning period.
2021-03-02Report that `doc(plugins)` doesn't work using diagnostics instead of `println!`Joshua Nelson-1/+2
This also adds a test for the output and fixes `rustc_attr` to properly know that `plugins` is a valid attribute.
2021-03-02Rollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514Guillaume Gomez-0/+35
Warn about unknown doc attributes Fixes #82652. For the text error, I decided to go for "invalid" instead of "unknown". What do you think? r? `@jyn514`
2021-03-01Validate meta items used in \#\[doc(...)\]Guillaume Gomez-0/+35
2021-02-28Use identifier's span in unused lintGiacomo Stevanato-43/+66
2021-02-26Rollup merge of #82506 - estebank:unused_variable_lint, r=lcnrGuillaume Gomez-5/+10
Properly account for non-shorthand pattern field in unused variable lint Fix #82488
2021-02-25Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obkbors-0/+101
Add #[rustc_legacy_const_generics] This is the first step towards removing `#[rustc_args_required_const]`: a new attribute is added which rewrites function calls of the form `func(a, b, c)` to `func::<{b}>(a, c)`. This allows previously stabilized functions in `stdarch` which use `rustc_args_required_const` to use const generics instead. This new attribute is not intended to ever be stabilized, it is only intended for use in `stdarch` as a replacement for `#[rustc_args_required_const]`. ```rust #[rustc_legacy_const_generics(1)] pub fn foo<const Y: usize>(x: usize, z: usize) -> [usize; 3] { [x, Y, z] } fn main() { assert_eq!(foo(0 + 0, 1 + 1, 2 + 2), [0, 2, 4]); assert_eq!(foo::<{1 + 1}>(0 + 0, 2 + 2), [0, 2, 4]); } ``` r? `@oli-obk`
2021-02-25Improve checking for attributeAmanieu d'Antras-47/+56
2021-02-24Properly account for non-shorthand pattern field in unused variable lintEsteban Küber-5/+10
Fix #82488
2021-02-25Address review commentsAmanieu d'Antras-0/+17
2021-02-23Add #[rustc_legacy_const_generics]Amanieu d'Antras-0/+75