Skip to content

Don't trim path for unsafe_op_in_unsafe_fn lints - #106157

Merged
bors merged 1 commit into
rust-lang:masterfrom
LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2
Jan 4, 2023
Merged

bors merged 1 commit into
rust-lang:masterfrom
LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2

Conversation

@LeSeulArtichaut

Copy link
Copy Markdown
Contributor

Fixes #106126, alternative to #106127.
r? @ghost for now.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 26, 2022
@compiler-errors

Copy link
Copy Markdown
Contributor

r=me with FIXME stating that not trimming the path is non-ideal

@bors delegate+

@bors

bors commented Jan 2, 2023

Copy link
Copy Markdown
Collaborator

✌️ @LeSeulArtichaut can now approve this pull request

@LeSeulArtichaut
LeSeulArtichaut force-pushed the 106126-thir-unsafeck-good-path-bug-2 branch from 024a9a3 to 2a7d559 Compare January 2, 2023 23:29
@LeSeulArtichaut

Copy link
Copy Markdown
Contributor Author

@bors r=compiler-errors

@bors

bors commented Jan 2, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 2a7d559 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 2, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#104748 (Ensure `lld` is supported with `download-ci-llvm`)
 - rust-lang#105541 (Simplify some iterator combinators)
 - rust-lang#106045 (default OOM handler: use non-unwinding panic, to match std handler)
 - rust-lang#106157 (Don't trim path for `unsafe_op_in_unsafe_fn` lints)
 - rust-lang#106353 (Reduce spans for `unsafe impl` errors)
 - rust-lang#106381 (Jsondoclint: Add `--verbose` and `--json-output` options)
 - rust-lang#106411 (rustdoc: remove legacy font-feature-settings CSS)
 - rust-lang#106414 (Add cuviper to the review rotation for libs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit dc5247b into rust-lang:master Jan 4, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 4, 2023
@LeSeulArtichaut
LeSeulArtichaut deleted the 106126-thir-unsafeck-good-path-bug-2 branch January 4, 2023 08:01
@Enselic

Enselic commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Edit: it does work, see #106157 (comment).

Sorry to ping in an old PR, but it does not seem like the regression test works? Compiling the test code with nightly-2022-12-24 (the date of the initial PR, i.e. before this fix was merged) triggers no ICE.

Paste this in bash to see for yourselves:

cd $(mktemp -d)

cat >issue-106126.rs <<EOF 
#[macro_export]
macro_rules! foo {
    () => {
        unsafe fn __unsf() {}
        unsafe fn __foo() {
            __unsf();
        }
    };
}
EOF

cat >issue-106126-good-path-bug.rs <<EOF
// Regression test for #106126.
// check-pass
// aux-build:issue-106126.rs

#![deny(unsafe_op_in_unsafe_fn)]

#[macro_use]
extern crate issue_106126;

foo!();

fn main() {}
EOF

toolchain=nightly-2022-12-24

rustup install $toolchain --profile minimal

rustc +$toolchain --crate-type lib issue-106126.rs

rustc +$toolchain -L. issue-106126-good-path-bug.rs
# expected: error
# actual: no error

The reason I care is because this test blocks fixing #112504 which I am working on in #165210 (see #165210 (comment) for the exact CI failure). But since the original reproducer does not seem to work, I can't confirm that fixing that CI failure would still catch a regression of this fix.

Unless I am making some silly mistake, the best way forward to unblock #165210 seems to me to be to simply remove the test.

@Enselic

Enselic commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Turns out the test does work, one just has to pass -Zthir-unsafeck, see #165583 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: 'trimmed_def_paths constructed but no error emitted' in THIR unsafety checker

5 participants