Commit Graph

233010 Commits

Author SHA1 Message Date
Keith Smiley
2939e8534a
Add comment about unused sdk versions 2023-08-22 08:55:51 -07:00
bors
4be90d0305 Auto merge of #11249 - GuillaumeGomez:ui-tests-annotations, r=Centri3,llogiq
Add error annotations in UI tests

As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Improve.20UI.20error.20checks), this PR adds missing error annotations in UI tests.

I used this script to generate them:

<details>

```python
import os

def handle_err(line, stderr, elems, kind, i):
    msg = line.split("{}: ".format(kind), 1)[1]
    i += 1
    try:
        line_nb = int(stderr[i].split(":")[1])
    except Exception:
        return i
    in_macro = False
    note_found = False
    help_found = False
    elem = {"kind": kind, "msg": msg, "line": line_nb, "notes": [], "helps": []}
    while i < len(stderr):
        if len(stderr[i]) == 0:
            break
        elif stderr[i].startswith("note:"):
            note_found = True # error checker doesn't like multi-note apparently.
        elif stderr[i].startswith("   = note:"):
            if not note_found and not help_found and "this error originates in the macro" not in stderr[i]:
                elem["notes"].append(stderr[i].split("   = note:", 1)[1].strip())
            note_found = True # error checker doesn't like multi-note apparently.
        elif stderr[i].startswith("   = help:") or stderr[i].startswith("help:"):
            help_found = True
        # elif stderr[i].startswith("help:"):
        #     if not help_found:
        #         elem["helps"].append(stderr[i].split("help:", 1)[1].strip())
        #         help_found = True # error checker doesn't like multi-help apparently.
        elif "in this macro invocation" in stderr[i]:
            in_macro = True
        i += 1
    if not in_macro:
        elems.append(elem)
    return i

def show_kind(kind):
    if kind == "error":
        return "ERROR"
    elif kind == "warning":
        return "WARNING"
    elif kind == "note":
        return "NOTE"
    return "HELP"

def generate_code_err(indent, elem, up):
    content = "{}//~{} {}: {}".format(indent, up, show_kind(elem["kind"]), elem["msg"])
    if up == "^":
        up = "|"
    for note in elem["notes"]:
        content += "\n{}//~{} {}: {}".format(indent, up, show_kind("note"), note)
    for help_msg in elem["helps"]:
        content += "\n{}//~{} {}: {}".format(indent, up, show_kind("help"), help_msg)
    return content, up

def update_content(p, content):
    TO_IGNORE = [
        "needless_bool/simple.rs", # https://github.com/rust-lang/rust-clippy/issues/11248
        "crashes/ice-7868.rs", # Has errors but in another file.
        "trivially_copy_pass_by_ref.rs", # the `N` in the stderr needs to be replaced by the number
        "tests/ui/large_types_passed_by_value.rs", # the `N` in the stderr needs to be replaced by the number
    ]
    for to_ignore in TO_IGNORE:
        if p.endswith(to_ignore):
            return
    try:
        with open(p.replace(".rs", ".stderr"), "r", encoding="utf8") as f:
            stderr = f.read().split('\n')
    except Exception:
        return
    print("Updating `{}`".format(p))
    i = 0
    elems = []
    while i < len(stderr):
        line = stderr[i]
        if line.startswith("error: ") and not line.startswith("error: aborting due to"):
            i = handle_err(line, stderr, elems, "error", i)
        elif line.startswith("warning: ") and not line.endswith("warning emitted") and line.endswith("warnings emitted"):
            i = handle_err(line, stderr, elems, "warning", i)
        i += 1
    elems.sort(key=lambda e: e["line"], reverse=True)
    i = 0
    while i < len(elems):
        elem = elems[i]
        indent = ""
        c = 0
        line = content[elem["line"] - 1]
        while c < len(line) and line[c] == ' ':
            indent += " "
            c += 1
        new_content, up = generate_code_err(indent, elem, "^")
        i += 1
        while i < len(elems) and elems[i]["line"] == elem["line"]:
            elem = elems[i]
            ret = generate_code_err(indent, elem, up)
            new_content += "\n" + ret[0]
            up = ret[1]
            i += 1
        content.insert(elem["line"], new_content)
    with open(p, "w", encoding="utf8") as f:
        f.write("\n".join(content))

def check_if_contains_ui_test(p):
    if not p.endswith(".rs"):
        return
    with open(p, "r", encoding="utf8") as f:
        x = f.read()
    if "//~" not in x and "`@run-rustfix"` not in x and "`@aux-build"` not in x:
        update_content(p, x.split("\n"))

for path, subdirs, files in os.walk("tests/ui"):
    for name in files:
        check_if_contains_ui_test(os.path.join(path, name))
```

</details>

Then ran `cargo uibless`.

changelog: none
2023-08-22 15:52:08 +00:00
Esteban Küber
b86285af16 Do not emit invalid suggestion in E0191 when spans overlap
Fix #115019.
2023-08-22 15:51:12 +00:00
David Koloski
6aef5b331f Disable bootstrap rustc version check
Mitigates #115065
2023-08-22 15:33:10 +00:00
Guillaume Gomez
f4670121d5 Move code comments to prevent having weird clippy fmt issues 2023-08-22 17:18:12 +02:00
Guillaume Gomez
a05d3a4137 Automatic generation of error annotations for ui tests 2023-08-22 17:18:11 +02:00
Guillaume Gomez
3a31c05578 Remove/move comments to prevent weird rustfmt wrapping 2023-08-22 17:17:48 +02:00
David Wood
d5269a1d7b
triagebot: add dependency licensing pings
Signed-off-by: David Wood <david@davidtw.co>
2023-08-22 16:15:00 +01:00
Guillaume Gomez
9c96605b20 Manually add annotations for ui tests 2023-08-22 17:14:08 +02:00
bors
3e9e5745df Auto merge of #115066 - allaboutevemirolive:pluralize_macro, r=Nilstrieb
Redefine the pluralize macro's arm

Redefine the unintuitive pluralize macro's arm because of the negation. The initial code starts with check if count is not 1, which is confusing and unintuitive.

The arm shoud start with checking,

- if "count" `is 1` then, append `""` (empty string) - indicate as singular
- Then check if "count" `is not 1` (more than 1), append `"s"` - indicate as plural

Before:
```rs
// This arm is abit confusing since it start with checking, if "count" is more than 1, append "s".
($x:expr) => {
    if $x != 1 { "s" } else { "" }
};
```

After:
```rs
// Pluralize based on count (e.g., apples)
($x:expr) => {
    if $x == 1 { "" } else { "s" }
};
```
2023-08-22 14:22:10 +00:00
Urgau
7ee77b5d1b Add support for ptr::write for the invalid_reference_casting lint 2023-08-22 15:47:29 +02:00
kadiwa
265c1b5d50
add regression test for not memcpying padding bytes 2023-08-22 15:10:56 +02:00
Eren K
efa41ef803
rust-gdbgui: remove excessive quotes
in commit 8dd0ec6, the `GDB_ARGS` variable was split across 3 lines. However, extra quotes were added to each line, such that the shell interprets the 3 lines as space separated strings, and tries to execute the latter two lines.
This commit simply removes the extra quotes.
2023-08-22 09:09:00 -04:00
bors
d8c69dfb37 Auto merge of #115095 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-08-22 12:32:50 +00:00
Ralf Jung
47ba2a9465 update lockfile 2023-08-22 13:47:38 +02:00
mojave2
d2744175ac
unknown unstable lint command line
fix ##113702

fix #113702

unknown unstable lint command lint

improve impelementation
2023-08-22 18:58:39 +08:00
Mark Rousskov
068e3d97d0 Update stage0 to next beta 2023-08-22 06:58:03 -04:00
Mark Rousskov
c8522adb97 Replace version placeholders with 1.73.0 2023-08-22 06:57:00 -04:00
bors
b2e9d73606 Auto merge of #115086 - RalfJung:miri-locked, r=albertlarsan68
bootstrap/miri: respect config_locked_deps
2023-08-22 10:43:48 +00:00
Zalathar
1fac8a0eab Treat StatementKind::Coverage as completely opaque for SMIR purposes
Coverage statements in MIR are heavily tied to internal details of the coverage
implementation that are likely to change, and are unlikely to be useful to
third-party tools for the foreseeable future.
2023-08-22 20:37:19 +10:00
Ethan Brierley
0e070aa548
Always use os-release rather than /lib to detect NixOS
[Two users over on zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Bootstrapping.20on.20NixOS) bumped into issues where NixOS wasn't being properly detected.

I believe this was caused by the presence of `/lib` on their machines. `/lib` is not standard on NixOS but can still be created by users or scripts.

We are already checking `/etc/os-release`. The presence of `ID=nixos` in it's output should be trustworthy and we shouldn't then go on to also check for `/lib`.
2023-08-22 11:06:43 +01:00
bors
0c2dde342b Auto merge of #3036 - RalfJung:josh-autostart, r=RalfJung
automatically start and stop josh in rustc-pull/push

Let's make use of the fact that this is not a shell script any more. :)
2023-08-22 09:25:49 +00:00
Ralf Jung
ee1fbd7a93 miri-script: start and stop josh automatically 2023-08-22 11:22:44 +02:00
Nilstrieb
d16e9c3369 Convert it into a warning
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-08-22 09:17:46 +00:00
Igor Aleksanov
e35eb91a33 Fix tuple_array_conversions lint on nightly 2023-08-22 13:15:05 +04:00
Arpad Borsos
2ceea9ae9d
Inline functions called from add_coverage
This removes quite a bit of indirection and duplicated code related to getting the `FunctionCoverage`.
2023-08-22 10:59:19 +02:00
bors
95305899b8 Auto merge of #115089 - fee1-dead-contrib:pause, r=fee1-dead
Remove myself from review rotation

I'll.. still be around, just not as active as I had been. I'm not adding myself to `users_on_vacation`, because anyone should still feel free to r? me if they want a specific review from me.
2023-08-22 08:55:43 +00:00
Ralf Jung
6117fa1fef make sure './miri many-seeds ./miri run' does not re-invoke the auto-ops 2023-08-22 10:29:26 +02:00
Deadbeef
ddf89a8776 Remove myself from review rotation 2023-08-22 08:05:00 +00:00
bors
57277c3a8e Auto merge of #3035 - RalfJung:serde, r=RalfJung
bump serde

bump to a version with the binary blob removed

also, respect CARGO_EXTRA_FLAGS in more places
2023-08-22 07:25:57 +00:00
Ralf Jung
269cbc20ac respect CARGO_EXTRA_FLAGS in more places 2023-08-22 09:25:33 +02:00
Nilstrieb
1b9159e448 Add disclaimer on size assertion macro
Sometimes people are inspired by rustc to add size assertions to their
code and copy the macro. This is bad because it causes hard build
errors. rustc happens to be special where it makes this okay.
2023-08-22 06:59:09 +00:00
Ralf Jung
28de139d35 bootstrap/miri: respect config_locked_deps 2023-08-22 08:54:51 +02:00
Ralf Jung
95fe7ab2a8 bump serde 2023-08-22 08:36:54 +02:00
bors
b4d09f3b81 Auto merge of #115075 - workingjubilee:retier-sparc-none, r=compiler-errors
Reassign sparc-unknown-none-elf to tier 3

It should never have been moved to tier 2. It is a new platform and the maintainer has agreed to do tier 3 maintenance for it, not tier 2.

r? `@jonathanpallant`
2023-08-22 06:36:15 +00:00
bors
32aa40538e Auto merge of #115055 - Kriskras99:master, r=ehuss
Fix table issues in platform support documentation (closes #115047)

mdBook needs an empty line before and after the table block.
In addition, in the tier-3 list three targets forgot about the host column and therefore showed the notes in the host column.

Closes #115047
2023-08-22 01:45:22 +00:00
John Kåre Alsaker
e41240e45b Fix races conditions with SyntaxContext decoding 2023-08-22 02:36:41 +02:00
bors
795ade084a Auto merge of #113365 - dima74:diralik/add-deprecated-suggestions, r=workingjubilee
Add `suggestion` for some `#[deprecated]` items

Consider code:
```rust
fn main() {
    let _ = ["a", "b"].connect(" ");
}
```

Currently it shows deprecated warning:
```rust
warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join
 --> src/main.rs:2:24
  |
2 |     let _ = ["a", "b"].connect(" ");
  |                        ^^^^^^^
  |
  = note: `#[warn(deprecated)]` on by default
```

This PR adds `suggestion` for `connect` and some other deprecated items, so the warning will be changed to this:
```rust
warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join
 --> src/main.rs:2:24
  |
2 |     let _ = ["a", "b"].connect(" ");
  |                        ^^^^^^^
  |
  = note: `#[warn(deprecated)]` on by default
help: replace the use of the deprecated method
  |
2 |     let _ = ["a", "b"].join(" ");
  |                        ^^^^
```
2023-08-22 00:02:50 +00:00
Tomasz Miąsko
0383131f7f Contents of reachable statics is reachable 2023-08-22 00:00:00 +00:00
Michael Goulet
b1c609e2a6 Fix elided lifetimes in rust-lang/rust 2023-08-21 23:53:09 +00:00
Noah Lev
4d9ac5df59 Fix test 2023-08-21 16:20:00 -07:00
John Kåre Alsaker
d9f7005ab6 Allow overwriting ExpnId for concurrent decoding 2023-08-22 00:50:25 +02:00
Josh Stone
ef0651972f Move a local to the #if block where it is used
For other cases (LLVM < 17), this was complaining under `-Wall`:

```
warning: llvm-wrapper/PassWrapper.cpp: In function ‘void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef, const char*)’:
warning: llvm-wrapper/PassWrapper.cpp:311:26: warning: unused variable ‘MCInfo’ [-Wunused-variable]
warning:   311 |   const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
warning:       |                          ^~~~~~
```
2023-08-21 15:27:08 -07:00
Red Rapious
b0bd6219c8 Simplified code and added tests 2023-08-21 23:36:15 +02:00
Michael Howell
3df9b4d65d rustdoc: use unicode-aware checks for redundant explicit link fastpath
Fixes #115064
2023-08-21 14:25:26 -07:00
Noah Lev
c90a5b2019 rustdoc-json: Rename typedef to type alias 2023-08-21 14:02:34 -07:00
Noah Lev
062d247cd7 rustdoc: Rename clean items from typedef to type alias 2023-08-21 13:56:22 -07:00
Keith Smiley
f988cbb065
Use target.abi instead of string matching llvm_target 2023-08-21 13:32:27 -07:00
Keith Smiley
d37fdc95d4
Always add LC_BUILD_VERSION for metadata object files
As of Xcode 15 Apple's linker has become a bit more strict about the
warnings it produces. One of those new warnings requires all valid
Mach-O object files in an archive to have a LC_BUILD_VERSION load
command:

```
ld: warning: no platform load command found in 'ARCHIVE[arm64][2106](lib.rmeta)', assuming: iOS-simulator
```

This was already being done for Mac Catalyst so this change expands this
logic to include it for all Apple platforms. I filed this behavior
change as FB12546320 and was told it was the new intentional behavior.
2023-08-21 13:31:57 -07:00
bors
ef85656a10 Auto merge of #115074 - matthiaskrgr:rollup-au2i7k0, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #115044 (stable_mir: docs clarification)
 - #115054 (Fix syntax in E0191 explanation.)
 - #115067 (docs: add alias log1p to ln_1p)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-21 20:28:17 +00:00