about summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2021-12-07Remove the reg_thumb register class for asm! on ARMAmanieu d'Antras-1/+0
Also restricts r8-r14 from being used on Thumb1 targets as per #90736.
2021-12-07Auto merge of #91224 - couchand:2021-11/avr-asm, r=Amanieubors-0/+4
Support AVR for inline asm! A first pass at support for the AVR platform in inline `asm!`. Passes the initial compiler tests, have not yet done more complete verification. In particular, the register classes could use a lot more fleshing out, this draft PR so far only includes the most basic. cc `@Amanieu` `@dylanmckay`
2021-12-07Rollup merge of #87614 - notriddle:notriddle-count2len, r=Mark-SimulacrumMatthias Krüger-0/+1
Recommend fix `count()` -> `len()` on slices Fixes #87302
2021-12-06Recommend fix `count()` -> `len()` on slicesMichael Howell-0/+1
Fixes #87302
2021-12-06Implement concat_bytes!Smitty-0/+1
The tracking issue for this is #87555.
2021-12-06Implement inline asm! for AVR platformAndrew Dona-Couch-0/+4
2021-12-05Rollup merge of #91355 - alexcrichton:stabilize-thread-local-const, r=m-ou-seMatthias Krüger-1/+0
std: Stabilize the `thread_local_const_init` feature This commit is intended to follow the stabilization disposition of the FCP that has now finished in #84223. This stabilizes the ability to flag thread local initializers as `const` expressions which enables the macro to generate more efficient code for accessing it, notably removing runtime checks for initialization. More information can also be found in #84223 as well as the tests where the feature usage was removed in this PR. Closes #84223
2021-12-04Rollup merge of #90519 - estebank:issue-84003, r=petrochenkovMatthias Krüger-0/+10
Keep spans for generics in `#[derive(_)]` desugaring Keep the spans for generics coming from a `derive`d Item, so that errors and suggestions have better detail. Fix #84003.
2021-12-03add `unwind_asm` feature gate for `may_unwind` optioncynecx-0/+1
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-0/+1
2021-12-03Auto merge of #90737 - eholk:intofuture, r=tmandrybors-0/+2
Reintroduce `into_future` in `.await` desugaring This is a reintroduction of the remaining parts from https://github.com/rust-lang/rust/pull/65244 that have not been relanded yet. This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again. Issues #67644, #67982 /cc `@yoshuawuyts`
2021-12-03Annotate `derive`d spans and move span suggestion codeEsteban Kuber-0/+10
* Annotate `derive`d spans from the user's code with the appropciate context * Add `Span::can_be_used_for_suggestion` to query if the underlying span at the users' code
2021-12-03Improve 'cannot contain emoji' error.Mara Bos-0/+1
2021-12-03Improve the comments in `Symbol::interner`.Nicholas Nethercote-6/+13
2021-11-29std: Stabilize the `thread_local_const_init` featureAlex Crichton-1/+0
This commit is intended to follow the stabilization disposition of the FCP that has now finished in #84223. This stabilizes the ability to flag thread local initializers as `const` expressions which enables the macro to generate more efficient code for accessing it, notably removing runtime checks for initialization. More information can also be found in #84223 as well as the tests where the feature usage was removed in this PR. Closes #84223
2021-11-28Add parent crate assert to register_expn_idCameron Steffen-0/+1
2021-11-28Add fast path to is_descendant_ofCameron Steffen-2/+19
2021-11-25Rollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebankMatthias Krüger-0/+1
Print associated types on opaque `impl Trait` types This PR generalizes #91021, printing associated types for all opaque `impl Trait` types instead of just special-casing for future. before: ``` error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == u32` ``` after: ``` error[E0271]: type mismatch resolving `<impl Iterator<Item = usize> as Iterator>::Item == u32` ``` --- Questions: 1. I'm kinda lost in binders hell with this one. Is all of the `rebind`ing necessary? 2. Is there a map collection type that will give me a stable iteration order? Doesn't seem like TraitRef is Ord, so I can't just sort later.. 3. I removed the logic that suppresses printing generator projection types. It creates outputs like this [gist](https://gist.github.com/compiler-errors/d6f12fb30079feb1ad1d5f1ab39a3a8d). Should I put that back? 4. I also added spaces between traits, `impl A+B` -> `impl A + B`. I quite like this change, but is there a good reason to keep it like that? r? ````@estebank````
2021-11-24Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelidGuillaume Gomez-0/+1
Create rustdoc_internals feature gate As suggested by ``@camelid`` [here](https://github.com/rust-lang/rust/pull/90398#issuecomment-955093851), since `doc_keyword` and `doc_primitive` aren't meant to be stabilized, we could put them behind a same feature flag. This is pretty much what it would look like (needs to update the tests too). The tracking issue is https://github.com/rust-lang/rust/issues/90418. What do you think ``@rust-lang/rustdoc`` ?
2021-11-24Create rustdoc_internals feature gateGuillaume Gomez-0/+1
2021-11-23Add generator lang-itemMichael Goulet-0/+1
2021-11-23Rollup merge of #91140 - nbdd0121:const_typeck, r=oli-obkMatthias Krüger-0/+1
Split inline const to two feature gates and mark expression position inline const complete This PR splits inline const in pattern position into its own `#![feature(inline_const_pat)]` feature gate, and make the usage in expression position complete. I think I have resolved most outstanding issues related to `inline_const` with #89561 and other PRs. The only thing left that I am aware of is #90150 and the lack of lifetime checks when inline const is used in pattern position (FIXME in #89561). Implementation-wise when used in pattern position it has to be lowered during MIR building while in expression position it's evaluated only when monomorphizing (just like normal consts), so it makes some sense to separate it into two feature gates so one can progress without being blocked by another. ``@rustbot`` label: T-compiler F-inline_const
2021-11-23Rollup merge of #90856 - ↵Matthias Krüger-0/+1
ken-matsui:suggestion-to-wrap-vec-allocator-api-in-tuple, r=davidtwco Suggestion to wrap inner types using 'allocator_api' in tuple This PR provides a suggestion to wrap the inner types in tuple when being along with 'allocator_api'. Closes https://github.com/rust-lang/rust/issues/83250 ```rust fn main() { let _vec: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api' } ``` ```diff error[E0658]: use of unstable library feature 'allocator_api' --> $DIR/suggest-vec-allocator-api.rs:2:23 | LL | let _vec: Vec<u8, _> = vec![]; - | ^ + | ----^ + | | + | help: consider wrapping the inner types in tuple: `(u8, _)` | = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information = help: add `#![feature(allocator_api)]` to the crate attributes to enable ```
2021-11-24Suggestion to wrap inner types using `allocator_api` in tupleKen Matsui-0/+1
2021-11-22Reintroduce `into_future` in `.await` desugaringEric Holk-0/+2
This is a reintroduction of the remaining parts from https://github.com/rust-lang/rust/pull/65244 that have not been relanded yet. Issues GH-67644, GH-67982
2021-11-22Split inline const to two feature gatesGary Guo-0/+1
2021-11-21Simplify for loop desugarCameron Steffen-11/+3
2021-11-20Rollup merge of #90930 - Nilstrieb:fix-non-const-value-ice, r=estebankMatthias Krüger-0/+1
Fix `non-constant value` ICE (#90878) This also fixes the same suggestion, which was kind of broken, because it just searched for the last occurence of `const` to replace with a `let`. This works great in some cases, but when there is no const and a leading space to the file, it doesn't work and panic with overflow because it thought that it had found a const. I also changed the suggestion to only trigger if the `const` and the non-constant value are on the same line, because if they aren't, the suggestion is very likely to be wrong. Also don't trigger the suggestion if the found `const` is on line 0, because that triggers the ICE. Asking Esteban to review since he was the last one to change the relevant code. r? ``@estebank`` Fixes #90878
2021-11-20Rollup merge of #90575 - m-ou-se:compatible-variant-improvements, r=estebankMatthias Krüger-7/+12
Improve suggestions for compatible variants on type mismatch. Fixes #90553. Before: ![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png) After: ![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png) r? `````@estebank`````
2021-11-18rustc: Remove `#[rustc_synthetic]`Vadim Petrochenkov-1/+0
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-16Add SourceMap::indentation_before.Mara Bos-7/+12
2021-11-15Fix `non-constant value` ICE (#90878)Nilstrieb-0/+1
This also fixes the same suggestion, which was kind of broken, because it just searched for the last occurence of `const` to replace with a `let`. This works great in some cases, but when there is no const and a leading space to the file, it doesn't work and panic with overflow because it thought that it had found a const. I also changed the suggestion to only trigger if the `const` and the non-constant value are on the same line, because if they aren't, the suggestion is very likely to be wrong. Also don't trigger the suggestion if the found `const` is on line 0, because that triggers the ICE.
2021-11-09Auto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-sebors-0/+1
Don't destructure args tuple in format_args! This allows Clippy to parse the HIR more simply since `arg0` is changed to `_args.0`. (cc rust-lang/rust-clippy#7843). From rustc's perspective, I think this is something between a lateral move and a tiny improvement since there are fewer bindings. r? `@m-ou-se`
2021-11-07Auto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514bors-10/+5
more clippy fixes
2021-11-07more clippy fixesMatthias Krüger-10/+5
2021-11-07Auto merge of #90348 - Amanieu:asm_feature_gates, r=joshtriplettbors-0/+3
Add features gates for experimental asm features This PR splits off parts of `asm!` into separate features because they are not ready for stabilization. Specifically this adds: - `asm_const` for `const` operands. - `asm_sym` for `sym` operands. - `asm_experimental_arch` for architectures other than x86, x86_64, arm, aarch64 and riscv. r? `@nagisa`
2021-11-07Add features gates for experimental asm featuresAmanieu d'Antras-0/+3
2021-11-06Don't destructure args tuple in format_args!Cameron Steffen-0/+1
2021-11-03Remove `MaybeMutBorrowedLocals`Tomasz Miąsko-1/+0
2021-11-02Split doc_cfg and doc_auto_cfg featuresGuillaume Gomez-0/+1
2021-10-30Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkovGuillaume Gomez-1/+1
Improve and test cross-crate hygiene - Decode the parent expansion for traits and enums in `rustc_resolve`, this was already being used for resolution in typeck - Avoid suggesting importing names with def-site hygiene, since it's often not useful - Add more tests r? `@petrochenkov`
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-2/+0
2021-10-27Auto merge of #89652 - rcvalle:rust-cfi, r=nagisabors-0/+1
Add LLVM CFI support to the Rust compiler This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you, `@eddyb` and `@pcc,` for all the help!
2021-10-25Add LLVM CFI support to the Rust compilerRamon de C Valle-0/+1
This commit adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+2
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-23Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakisbors-0/+1
Implement coherence checks for negative trait impls The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3). This feature is necessary to handle the following from impl on box. ```rust impl From<&str> for Box<dyn Error> { ... } ``` Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile. We would have this in `alloc`: ```rust impl From<&str> for Box<dyn Error> {} // A impl<E> From<E> for Box<dyn Error> where E: Error {} // B ``` and this in `core`: ```rust trait Error {} impl !Error for &str {} ``` r? `@nikomatsakis` This PR was built on top of `@yaahc` PR #85764. Language team proposal: to https://github.com/rust-lang/lang-team/issues/96
2021-10-23Rollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726Matthias Krüger-0/+1
add feature flag for `type_changing_struct_update` This implements the PR0 part of the mentoring notes within #86618. overrides the previous inactive #86646 pr. r? ```@nikomatsakis```
2021-10-22Add rustc_strict_coherence attribute and use it to check overlapSantiago Pastorino-0/+1
2021-10-22add feature flag for `type_changing_struct_update`Charles Lew-0/+1
2021-10-21Don't suggest importing items with hygienic namesMatthew Jasper-1/+1
This will potentially hide a few correct suggestions, but importing these items from another module is not generally possible.