Commit Graph

17659 Commits

Author SHA1 Message Date
Matthias Krüger
e64177c3f8
Rollup merge of #102615 - Nilstrieb:there-are-many-error-codes, r=compiler-errors
Cleanup some error code explanations

E0045: Use a stable non-C ABI instead
E0092: Use an atomic intrinsic that actually exists
E0161: Don't use box_syntax
E0579: Format ranges in the rustfmt style
E0622: Use the rustfmt style
E0743: Remove feature gate as it's not needed
2022-10-03 19:12:19 +02:00
Matthias Krüger
aa076d6144
Rollup merge of #102613 - TaKO8Ki:fix-part-of-101739, r=compiler-errors
Fix ICE #101739

Fixes a part of #101739

This cannot cover the following case. It causes `too many args provided` error and obligation does not have references error. I want your advice to solve the following cases as well in this pull request or a follow-up.

```rust
#![crate_type = "lib"]
#![feature(transmutability)]
#![allow(dead_code, incomplete_features, non_camel_case_types)]

mod assert {
    use std::mem::BikeshedIntrinsicFrom;

    pub fn is_transmutable<
        Src,
        Dst,
        Context,
        const ASSUME_ALIGNMENT: bool,
        const ASSUME_LIFETIMES: bool,
        const ASSUME_VALIDITY: bool,
        const ASSUME_VISIBILITY: bool,
    >()
    where
        Dst: BikeshedIntrinsicFrom<
            Src,
            Context,
            ASSUME_ALIGNMENT,
            ASSUME_LIFETIMES,
            ASSUME_VALIDITY,
            ASSUME_VISIBILITY,
        >,
    {}
}

fn via_const() {
    struct Context;
    #[repr(C)] struct Src;
    #[repr(C)] struct Dst;

    const FALSE: bool = false;

    assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>();
}
```
2022-10-03 19:12:19 +02:00
Matthias Krüger
8ede2340b7
Rollup merge of #102597 - compiler-errors:issue-102571, r=davidtwco
Avoid ICE in printing RPITIT type

Fixes #102571
2022-10-03 19:12:18 +02:00
bors
f47e9af824 Auto merge of #102551 - bjorn3:cg_ssa_cleanup, r=davidtwco
Some more cleanup for rustc_codegen_ssa

With the aim to make non-LLVM like backends, like Cranelift, easier to support using cg_ssa.
2022-10-03 11:02:58 +00:00
Takayuki Maeda
0e615caa8d check if const is ADT or not 2022-10-03 17:51:18 +09:00
bors
6b139c5b3e Auto merge of #102614 - matthiaskrgr:rollup-fjyu7oo, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #102550 (rustdoc: remove no-op CSS on `.impl, .method` etc)
 - #102591 (Fix duplicate usage of `a` article.)
 - #102592 (Remove a couple lifetimes that can be infered)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-03 07:30:34 +00:00
nils
1df0a1890a Cleanup some error code explanations
E0045: Use a stable non-C ABI instead
E0092: Use an atomic intrinsic that actually exists
E0161: Don't use box_syntax
E0579: Format ranges in the rustfmt style
E0622: Use the rustfmt style
E0743: Remove feature gate as it's not needed
2022-10-03 08:53:06 +02:00
Matthias Krüger
d5fb8d2aef
Rollup merge of #102592 - WaffleLapkin:less_lifetimes, r=cjgillot
Remove a couple lifetimes that can be infered

From the review: https://github.com/rust-lang/rust/pull/101986#discussion_r974497497

r? `@cjgillot`
2022-10-03 08:00:48 +02:00
Matthias Krüger
d679ec5e2f
Rollup merge of #102591 - JarvisCraft:fix-double-a-article, r=compiler-errors
Fix duplicate usage of `a` article.

This fixes a typo first appearing in #94624 in which test-macro diagnostic uses "a" article twice.

Since I searched the sources for " a a " sequences, I also fixed the same issue in a few files where I found it.
2022-10-03 08:00:47 +02:00
Takayuki Maeda
82510b90c6 return when obligation has references_error 2022-10-03 14:17:42 +09:00
bors
dbaf3e67aa Auto merge of #102508 - nnethercote:even-more-lexer-improvements, r=matklad
Even more lexer improvements

These are just about code clarity, rather than performance.

r? `@matklad`
2022-10-03 04:49:46 +00:00
bors
607b8296e0 Auto merge of #102503 - cuviper:x86-stack-probes, r=nagisa
Enable inline stack probes on X86 with LLVM 16

The known problems with x86 inline-asm stack probes have been solved on LLVM main (16), so this flips the switch. Anyone using bleeding-edge LLVM with rustc can start testing this, as I have done locally. We'll get more direct rust-ci when LLVM 16 branches and we start our upgrade, and we can always patch or disable it then if we find new problems.

The previous attempt was #77885, reverted in #84708.
2022-10-03 02:09:05 +00:00
Nicholas Nethercote
4e5ddf1adf Invert is_top_level to avoid negation. 2022-10-03 11:42:29 +11:00
Nicholas Nethercote
a822d08bd1 Remove TokenStreamBuilder.
It's now only used in one function. Also, the "should we glue the
tokens?" check is only necessary when pushing a `TokenTree::Token`, not
when pushing a `TokenTree::Delimited`.

As part of this, we now do the "should we glue the tokens?" check
immediately, which avoids having look back at the previous token. It
also puts all the logic dealing with token gluing in a single place.
2022-10-03 11:42:29 +11:00
Nicholas Nethercote
8d0754d602 Inline and remove parse_token_tree_non_delim_non_eof.
It has a single call site.
2022-10-03 11:42:29 +11:00
Nicholas Nethercote
ce7676829e Merge parse_token_trees_until_close_delim and parse_all_token_trees.
Because they're very similar, and this will allow some follow-up
changes.
2022-10-03 11:42:29 +11:00
Nicholas Nethercote
9de9cf19d7 Add comments to TokenCursor::desugar.
It took me some time to work out what this code was doing.
2022-10-03 11:42:29 +11:00
Nicholas Nethercote
40e4827fd2 Rewrite Token::is_op.
An exhaustive match is more readable and more future-proof.
2022-10-03 11:42:29 +11:00
Nicholas Nethercote
bbb53bf772 Add comments to Spacing. 2022-10-03 11:42:21 +11:00
Nicholas Nethercote
3be86e6528 Clarify operator splitting.
I found this code hard to read.
2022-10-03 11:41:36 +11:00
Michael Goulet
90a8d67491 Avoid ICE in printing RPITIT type 2022-10-02 20:43:13 +00:00
Petr Portnov
afae9576dc
Fix duplicate usage of a article.
This fixes a typo first appearing in #94624
in which test-macro diagnostic uses "a" article twice.

Since I searched sources for " a a " sequences,
I also fixed the same issue in a few source files where I found it.

Signed-off-by: Petr Portnov <gh@progrm-jarvis.ru>
2022-10-02 21:40:39 +03:00
Maybe Waffle
8cc8140775 Remove a couple lifetimes that could be infered 2022-10-02 15:40:20 +00:00
bors
39323a5877 Auto merge of #102586 - Dylan-DPC:rollup-g107h6z, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #100451 (Do not panic when a test function returns Result::Err.)
 - #102098 (Use fetch_update in sync::Weak::upgrade)
 - #102538 (Give `def_span` the same SyntaxContext as `span_with_body`.)
 - #102556 (Make `feature(const_btree_len)` implied by `feature(const_btree_new)`)
 - #102566 (Add a known-bug test for #102498)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-02 15:31:06 +00:00
Dylan DPC
f3ab5a66a9
Rollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-dead
Give `def_span` the same SyntaxContext as `span_with_body`.

https://github.com/rust-lang/rust/issues/102217

I'm not sure how to add a test, since the erroneous span was crafted using a proc macro.
The debug assertion in `def_span` will ensure we have the correct behaviour.
2022-10-02 20:42:21 +05:30
bjorn3
268e02c387 Remove type argument of array_alloca and rename to byte_array_alloca 2022-10-02 13:42:14 +00:00
bjorn3
0fe84bc38b Remove dynamic_alloca from BuilderMethods 2022-10-02 13:42:02 +00:00
bors
91931ec2fc Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-se
Change `is_some_and` to take by value

Consistent with other function-accepting `Option` methods.

Tracking issue: #93050

r? `@m-ou-se`
2022-10-02 12:48:15 +00:00
bors
47b2eee173 Auto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa
Declare `main` as visibility hidden on targets that default to hidden.

On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden.

This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.
2022-10-02 04:12:09 +00:00
bors
57f097ea25 Auto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk
Compute lint levels by definition

Second attempt to https://github.com/rust-lang/rust/pull/101620.

I think that I have removed the perf regression.
2022-10-01 19:54:55 +00:00
bors
56a35bc906 Auto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #101675 (Improve `File::set_times` error handling)
 - #102500 (Remove `expr_parentheses_needed` from `ParseSess`)
 - #102533 (rustdoc: remove unused CSS selector `a.source`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-01 17:11:19 +00:00
bjorn3
62cf644c64 Merge apply_attrs_callsite into call and invoke
Some codegen backends are not able to apply callsite attrs after the fact.
2022-10-01 17:01:31 +00:00
Cameron Steffen
4f12de0660 Change feature name to is_some_and 2022-10-01 11:45:52 -05:00
bjorn3
a3cc67c796 Remove unused target_cpu and tune_cpu methods from ExtraBackendMethods 2022-10-01 16:45:33 +00:00
bjorn3
c431ea681c Remove several unused methods from MiscMethods 2022-10-01 16:45:07 +00:00
bjorn3
7c91ec4652 Remove unused Context assoc type from WriteBackendMethods 2022-10-01 16:34:45 +00:00
Matthias Krüger
cc009bc536
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
Remove `expr_parentheses_needed` from `ParseSess`

Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.
2022-10-01 16:45:05 +02:00
Camille GILLOT
fec53fd9db Add sanity Drop impl. 2022-10-01 16:24:44 +02:00
Camille GILLOT
299e10d7ad Add FIXME. 2022-10-01 16:24:34 +02:00
Camille GILLOT
9f2ab5b9ad Use a SortedMap instead of a VecMap. 2022-10-01 16:24:30 +02:00
Camille GILLOT
13608715d8 Replace retain with assertion. 2022-10-01 16:23:20 +02:00
Camille GILLOT
c2d5dd2566 Add fast path without visiting. 2022-10-01 16:23:10 +02:00
Camille GILLOT
e78dd6d781 Simplify LintLevelsProvider. 2022-10-01 16:23:00 +02:00
Camille GILLOT
d08669c4fa Compute by owner instead of HirId. 2022-10-01 16:22:40 +02:00
Camille GILLOT
26e5fe9e85 Do not fetch HIR node when iterating to find lint. 2022-10-01 16:20:21 +02:00
Camille GILLOT
6e76599f5f Correct Key impl for HirId. 2022-10-01 16:20:08 +02:00
Camille GILLOT
273b54d6ac Add FIXME. 2022-10-01 16:19:52 +02:00
Camille GILLOT
af495f8bb6 Comment LintLevelSets. 2022-10-01 16:19:40 +02:00
Camille GILLOT
34bc5c8824 Move lint level computation to rustc_middle::lint. 2022-10-01 16:18:54 +02:00
Camille GILLOT
6977f7dbe9 Reduce visibilities and remove dead code. 2022-10-01 16:18:42 +02:00