summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2021-07-21Correct fmtsurechen-10/+7
2021-07-21Simplify the collecting of `? Trait` bounds in where clausesurechen-33/+20
2021-07-20Auto merge of #87244 - jackh726:issue-71883, r=estebankbors-0/+1
Better diagnostics with mismatched types due to implicit static lifetime Fixes #78113 I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here. I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too. This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type. r? `@estebank`
2021-07-19Better errors when we don't have implicit statics in trait objectsjackh726-0/+1
2021-07-19Improve impl trait disallowed context error textSantiago Pastorino-1/+1
2021-07-18Remove impl_trait_in_bindings feature flagSantiago Pastorino-7/+1
2021-07-18Remove origin field from TypeAliasesOpaqueTySantiago Pastorino-10/+4
2021-07-18Remove OpaqueTyOrigin::Misc, use TyAlias insteadSantiago Pastorino-2/+2
2021-07-18Remove impl trait bindings handling on const AST loweringSantiago Pastorino-11/+1
2021-07-17Remove impl traits bindings error message handling on AST loweringSantiago Pastorino-6/+1
2021-07-17Fix TypeAliasesOpaqueTy origin docsSantiago Pastorino-1/+1
2021-07-17Rename OtherOpaqueTy to TypeAliasesOpaqueTySantiago Pastorino-12/+16
2021-07-17Remove OpaqueTyOrigin::BindingSantiago Pastorino-16/+5
2021-07-15Remove refs from pat slicesCameron Steffen-26/+48
2021-07-13Cache expansion hash.Camille GILLOT-3/+43
2021-07-11Auto merge of #86416 - Amanieu:asm_clobber_only, r=nagisabors-0/+16
Add clobber-only register classes for asm! These are needed to properly express a function call ABI using a clobber list, even though we don't support passing actual values into/out of these registers.
2021-07-10Add clobber-only register classes for asm!Amanieu d'Antras-0/+16
These are needed to properly express a function call ABI using a clobber list, even though we don't support passing actual values into/out of these registers.
2021-07-09Update the comment on `lower_expr_try`Scott McMurray-7/+8
I'd updated the ones inside the method, but not its doc comment.
2021-06-30Arena-allocate Crate during lowering.Camille GILLOT-4/+5
2021-06-15Auto merge of #86321 - JohnTitor:rollup-q61c8q4, r=JohnTitorbors-1/+1
Rollup of 10 pull requests Successful merges: - #80269 (Explain non-dropped sender recv in docs) - #82179 (Add functions `Duration::try_from_secs_{f32, f64}`) - #85608 (Stabilize `ops::ControlFlow` (just the type)) - #85792 (Refactor windows sockets impl methods) - #86220 (Improve maybe_uninit_extra docs) - #86277 (Remove must_use from ALLOWED_ATTRIBUTES) - #86285 (:arrow_up: rust-analyzer) - #86294 (Stabilize {std, core}::prelude::rust_*.) - #86306 (Add mailmap entries for myself) - #86314 (Remove trailing triple backticks in `mut_keyword` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-15Rollup merge of #85608 - scottmcm:stabilize-control-flow-enum-basics, r=m-ou-seYuki Okushi-1/+1
Stabilize `ops::ControlFlow` (just the type) Tracking issue: https://github.com/rust-lang/rust/issues/75744 (which also tracks items *not* closed by this PR). With the new `?` desugar implemented, [it's no longer possible to mix `Result` and `ControlFlow`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=13feec97f5c96a9d791d97f7de2d49a6). (At the time of making this PR, godbolt was still on the 2021-05-01 nightly, where you can see that [the mixing example compiled](https://rust.godbolt.org/z/13Ke54j16).) That resolves the only blocker I know of, so I'd like to propose that `ControlFlow` be considered for stabilization. Its basic existence was part of https://github.com/rust-lang/rfcs/pull/3058, where it got a bunch of positive comments (examples [1](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-758277325) [2](https://github.com/rust-lang/rfcs/pull/3058#pullrequestreview-592106494) [3](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-784444155) [4](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-797031584)). Its use in the compiler has been well received (https://github.com/rust-lang/rust/pull/78182#issuecomment-713695594), and there are ecosystem updates interested in using it (https://github.com/rust-itertools/itertools/issues/469#issuecomment-677729589, https://github.com/jonhoo/rust-imap/issues/194). As this will need an FCP, picking a libs member manually: r? `@m-ou-se` ## Stabilized APIs ```rust #[derive(Debug, Clone, Copy, PartialEq)] pub enum ControlFlow<B, C = ()> { /// Exit the operation without running subsequent phases. Break(B), /// Move on to the next phase of the operation as normal. Continue(C), } ``` As well as using `?` on a `ControlFlow<B, _>` in a function returning `ControlFlow<B, _>`. (Note, in particular, that there's no `From::from`-conversion on the `Break` value, the way there is for `Err`s.) ## Existing APIs *not* stabilized here All the associated methods and constants: `break_value`, `is_continue`, `map_break`, [`CONTINUE`](https://doc.rust-lang.org/nightly/std/ops/enum.ControlFlow.html#associatedconstant.CONTINUE), etc. Some of the existing methods in nightly seem reasonable, some seem like they should be removed, and some need more discussion to decide. But none of them are *essential*, so [as in the RFC](https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#methods-on-controlflow), they're all omitted from this PR. They can be considered separately later, as further usage demonstrates which are important.
2021-06-14Use the now available implementation of `IntoIterator` for arraysLeSeulArtichaut-1/+1
2021-06-10Add support for using qualified paths with structs in expression and patternRyan Levick-13/+15
position.
2021-06-01Rename take_trait_map.Camille GILLOT-2/+2
2021-06-01Remove StableVec.Camille GILLOT-2/+1
2021-06-01Only compute the trait_map once.Camille GILLOT-10/+10
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-9/+10
2021-05-30Rename take_trait_map.Camille GILLOT-2/+2
2021-05-30Remove StableVec.Camille GILLOT-2/+1
2021-05-30Only compute the trait_map once.Camille GILLOT-10/+10
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-05-23Stabilize ops::ControlFlow (just the type)Scott McMurray-1/+1
2021-05-18Auto merge of #84767 - scottmcm:try_trait_actual, r=lcnrbors-37/+31
Implement the new desugaring from `try_trait_v2` ~~Currently blocked on https://github.com/rust-lang/rust/issues/84782, which has a PR in https://github.com/rust-lang/rust/pull/84811~~ Rebased atop that fix. `try_trait_v2` tracking issue: https://github.com/rust-lang/rust/issues/84277 Unfortunately this is already touching a ton of things, so if you have suggestions for good ways to split it up, I'd be happy to hear them. (The combination between the use in the library, the compiler changes, the corresponding diagnostic differences, even MIR tests mean that I don't really have a great plan for it other than trying to have decently-readable commits. r? `@ghost` ~~(This probably shouldn't go in during the last week before the fork anyway.)~~ Fork happened.
2021-05-16Implement Anonymous{Struct, Union} in the ASTjedel1043-1/+13
Add unnamed_fields feature gate and gate unnamed fields on parsing
2021-05-13Clarify error message when both asm! and global_asm! are unsupportedAmanieu d'Antras-1/+2
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-323/+335
On x86, the default syntax is also switched to Intel to match asm!
2021-05-12Add more precise span informations to generic typesGiacomo Stevanato-24/+48
2021-05-11improve diagnosts for GATsb-naber-0/+5
2021-05-08Make `Diagnostic::span_fatal` unconditionally raise an errorJoshua Nelson-3/+1
It had no callers which didn't immediately call `raise()`, and this unifies the behavior with `Session`.
2021-05-06Actually implement the feature in the compilerScott McMurray-37/+31
Including all the bootstrapping tweaks in the library.
2021-05-04Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakisbors-8/+22
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021 This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition. r? `@estebank`
2021-04-29Make current_hir_id_owner a simple tuple.Camille GILLOT-17/+11
2021-04-13Lower async fn in traits.Camille GILLOT-3/+11
An error is already created by AST validation.
2021-04-11Implement token-based handling of attributes during expansionAaron Hill-45/+7
This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2021-04-08Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwcoDylan DPC-1/+1
Fix outdated crate names in compiler docs Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged.
2021-04-08Fix outdated crate names in compiler docspierwill-1/+1
Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged. Also fix incorrect file paths.
2021-04-08Change how edition is determinedRyan Levick-1/+1
2021-04-08Improve errorRyan Levick-3/+8
2021-04-08Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in ↵Ryan Levick-7/+16
Rust 2021
2021-04-07Rollup merge of #83935 - SNCPlay42:param-default-impl-trait, r=varkorDylan DPC-7/+1
forbid `impl Trait` in generic param defaults Fixes #83929 Forbid using `impl Trait` in the default types of generic parameters, e.g. `struct Foo<T = impl Trait>`. I assume this was never supposed to be allowed - it seems no UI test used it. Note that using `impl Trait` in this position did not hit a feature gate error; however, this *shouldn't* be a breaking change as any attempt to use it should have hit the ICE in #83929 and/or failed to provide a defining use of the `impl Trait`.